mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-09-10 03:41:53 +02:00
WIP
This commit is contained in:
+7
-7
@@ -42,12 +42,7 @@ import CoreData
|
||||
)
|
||||
```
|
||||
*/
|
||||
public struct Tweak: FetchClause, QueryClause, DeleteClause {
|
||||
|
||||
/**
|
||||
The block to customize the `NSFetchRequest`
|
||||
*/
|
||||
public let closure: (_ fetchRequest: NSFetchRequest<NSFetchRequestResult>) -> Void
|
||||
public struct Tweak: FetchClause, QueryClause, DeleteClause, Sendable {
|
||||
|
||||
/**
|
||||
Initializes a `Tweak` clause with a closure where the `NSFetchRequest` may be configured.
|
||||
@@ -55,7 +50,7 @@ public struct Tweak: FetchClause, QueryClause, DeleteClause {
|
||||
- Important: `Tweak`'s closure is executed only just before the fetch occurs, so make sure that any values captured by the closure is not prone to race conditions. Also, some utilities (such as `ListMonitor`s) may keep `FetchClause`s in memory and may thus introduce retain cycles if reference captures are not handled properly.
|
||||
- parameter closure: the block to customize the `NSFetchRequest`
|
||||
*/
|
||||
public init(_ closure: @escaping (_ fetchRequest: NSFetchRequest<NSFetchRequestResult>) -> Void) {
|
||||
public init(_ closure: @escaping @Sendable (_ fetchRequest: NSFetchRequest<NSFetchRequestResult>) -> Void) {
|
||||
|
||||
self.closure = closure
|
||||
}
|
||||
@@ -67,4 +62,9 @@ public struct Tweak: FetchClause, QueryClause, DeleteClause {
|
||||
|
||||
self.closure(fetchRequest as! NSFetchRequest<NSFetchRequestResult>)
|
||||
}
|
||||
|
||||
|
||||
// MARK: Private
|
||||
|
||||
public let closure: @Sendable (_ fetchRequest: NSFetchRequest<NSFetchRequestResult>) -> Void
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user