SwiftData DataService?

In the Menu app, a DataService was used to abstract data access, which seemed like a nice pattern. Now working on my actual app, I’ve started to use SwiftData. It looks like SwiftData expects some of its operations to happen inside of Views, so it seems like I’d be going against convention to try to move all the SwiftData access inside a service… and SwiftData itself is somewhat of a generic abstraction for data access, so is the general practice just to use SwiftData directly?

For a good introduction on SwiftData have a look at this 8 part series from Paul Hudson on how to set up a project using it. Surprisingly simple.

This is the first video in the series: