File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -119,17 +119,15 @@ public extension Database {
119119 }
120120
121121 func fetch< R> ( _ closure: @Sendable @escaping ( _ ctx: NSManagedObjectContext ) throws -> R ) async throws -> R {
122- let context = createPrivateContext ( )
123-
124122 if #available( iOS 15 , macOS 12 , * ) {
125- return try await context . perform {
126- try closure ( context )
123+ return try await writerContext . perform {
124+ try closure ( self . writerContext )
127125 }
128126 } else {
129127 return try await withCheckedThrowingContinuation { continuation in
130- context . perform {
128+ writerContext . perform {
131129 do {
132- continuation. resume ( with: . success( try closure ( context ) ) )
130+ continuation. resume ( with: . success( try closure ( self . writerContext ) ) )
133131 } catch {
134132 continuation. resume ( with: . failure( error) )
135133 }
You can’t perform that action at this time.
0 commit comments