File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
Sources/ManagedModels/SwiftUI Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ public extension View {
25
25
self . modelContext ( container. viewContext)
26
26
}
27
27
28
+ @MainActor
28
29
@ViewBuilder
29
30
func modelContainer(
30
31
for modelTypes : [ any PersistentModel . Type ] ,
@@ -48,6 +49,7 @@ public extension View {
48
49
}
49
50
}
50
51
52
+ @MainActor
51
53
@inlinable
52
54
func modelContainer(
53
55
for modelType : any PersistentModel . Type ,
@@ -73,6 +75,7 @@ public extension Scene {
73
75
self . modelContext ( container. viewContext)
74
76
}
75
77
78
+ @MainActor
76
79
@SceneBuilder
77
80
func modelContainer(
78
81
for modelTypes : [ any PersistentModel . Type ] ,
@@ -92,6 +95,7 @@ public extension Scene {
92
95
self . modelContainer ( try ! result. get ( ) )
93
96
}
94
97
98
+ @MainActor
95
99
@inlinable
96
100
func modelContainer(
97
101
for modelType : any PersistentModel . Type ,
@@ -113,8 +117,10 @@ public extension Scene {
113
117
// MARK: - Primitive
114
118
115
119
// Note: The docs say that a container is only ever created once! So cache it.
116
- nonisolated ( unsafe) private var modelToContainer = [ ObjectIdentifier: NSPersistentContainer ] ( )
120
+ @MainActor
121
+ private var modelToContainer = [ ObjectIdentifier: NSPersistentContainer ] ( )
117
122
123
+ @MainActor
118
124
private func makeModelContainer(
119
125
for modelTypes : [ any PersistentModel . Type ] ,
120
126
inMemory : Bool = false ,
You can’t perform that action at this time.
0 commit comments