Swift, Swiftui, iOS App Development, Mobile App Development, Programming.
@MainActor () async -> DataHandler { let container = preview ? previewContainer : sharedModelContainer return { DataHandler(modelContainer: container, mainActor: true) } } Next, we define a new environment key and extend EnvironmentValues to inject the new helper method: public struct