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 NSFetchRequest

    Declaration

    Swift

    public let closure: (_ fetchRequest: NSFetchRequest<NSFetchRequestResult>) -> Void
  • Initializes a Tweak clause with a closure where the NSFetchRequest may 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 as ListMonitors) may keep FetchClauses 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

    closure

    the block to customize the NSFetchRequest

CustomDebugStringConvertible

  • Declaration

    Swift

    public var debugDescription: String { get }