Relative Content

Tag Archive for swiftcrud

Where do SwiftData CRUD methods go?

So far all of the examples I have found that introduce SwiftData have the various functions as part of a View, which is definitely bad form, though I understand why in an introduction it’s better to not also introduce additional complexity.
But thus far I can’t find an example of actual best practice for production code. Does this tend to just go in a ViewController and the assumption is everyone “gets it”? Given how many posts I have seen about NOT using MVVM with SwiftUI I wonder if there is a different option people are tending towards? The closest thing I have found is here and at 7 years old I suspect the community has arrived at some more concrete best practices since. Varied based on project and team size of course. Mine will be a team of one and a moderately sized project, but I am just doing tiny POC stuff at the moment.