upcarta
  • Sign In
  • Sign Up
  • Explore
  • Search

Property Wrappers Vs Data Access Layer

  • Article
  • Jul 15, 2023
  • #Datainfrastructure
Mohammad Azam
@MohammadAzam
(Author)
azamsharp.com
Read on azamsharp.com
1 Recommender
1 Mention
Yesterday, I had the opportunity to speak at WomenWhoCode Mobile event. It was a remote event and well attended. I spoke about SwiftUI architecture best practices. When I was cover... Show More

Yesterday, I had the opportunity to speak at WomenWhoCode Mobile event. It was a remote event and well attended. I spoke about SwiftUI architecture best practices.

When I was covering Core Data I mentioned that you should use @FetchRequest property wrappers as they are optimized to work with SwiftUI. Same is true for @Query property wrapper in SwiftData.

During this time an interesting question was raised. An attendee asked what if you want to change the data access layer in the future. Currently our views are tightly coupled with either Core Data or SwiftData but what happens if we want to use Realm or GRDB.

I have thought about this question for a very long time. This is one of those questions, which does not have a straight forward answer or a single answer to be exact. The answer is opinion based so let’s take a look at both sides of the equation. I will use SwiftData in my examples.

Show Less
Recommend
Post
Save
Complete
Collect
Mentions
See All
Christian Findlay @ChristianFindlay · Jul 29, 2023
  • Post
  • From Twitter
This is a great article by @azamsharp about database abstractions https://azamsharp.com/2023/07/15/property-wrappers-vs-data-access-layer.html It's technically about #swiftui , but the point is the same for #flutter or #dotnet This is something I've grappled with for well over a decade. Hard to answer clearly.
  • upcarta ©2025
  • Home
  • About
  • Terms
  • Privacy
  • Cookies
  • @upcarta