FetchAndSaveOperation

public class FetchAndSaveOperation: Operation

An operation that fetches data from CloudKit and saves it to Core Data, you can use it without calling CloudCore.fetchAndSave methods if you application relies on Operation

  • Private cloud database for the CKContainer specified by CloudCoreConfig

    Declaration

    Swift

    public static let allDatabases = [
  • Called every time if error occurs

    Declaration

    Swift

    public var errorBlock: ErrorBlock?
  • Initialize operation, it’s recommended to set errorBlock

    Declaration

    Swift

    public init(from databases: [CKDatabase] = FetchAndSaveOperation.allDatabases, persistentContainer: NSPersistentContainer, tokens: Tokens = CloudCore.tokens)

    Parameters

    databases

    list of databases to fetch data from (only private is supported now)

    persistentContainer

    NSPersistentContainer that will be used to save data

    tokens

    previously saved Tokens, you can generate new ones if you want to fetch all data

  • Performs the receiver’s non-concurrent task.

    Declaration

    Swift

    override public func main()