Tweak
public struct Tweak : FetchClause, QueryClause, DeleteClause
extension Tweak: CustomDebugStringConvertible, CoreStoreDebugStringConvertible
The Tweak clause allows fine-tuning the NSFetchRequest for a fetch or query.
Sample usage:
let employees = transaction.fetchAll(
From<MyPersonEntity>(),
Tweak { (fetchRequest) -> Void in
fetchRequest.includesPendingChanges = false
fetchRequest.fetchLimit = 5
}
)
-
The block to customize the
NSFetchRequestDeclaration
Swift
public let closure: (_ fetchRequest: NSFetchRequest<NSFetchRequestResult>) -> Void -
Initializes a
Tweakclause with a closure where theNSFetchRequestmay be configured.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 asListMonitors) may keepFetchClauses in memory and may thus introduce retain cycles if reference captures are not handled properly.Declaration
Swift
public init(_ closure: @escaping (_ fetchRequest: NSFetchRequest<NSFetchRequestResult>) -> Void)Parameters
closurethe block to customize the
NSFetchRequest
-
Declaration
Swift
public var debugDescription: String { get }
View on GitHub
Tweak Structure Reference