CBLReplication

@interface CBLReplication : NSObject

A replication between a local and a target database. The target is usually remote, identified by a URL, but may instead be local. Replications are by default bidirectional; to change this, set either the push or pull property to NO before starting. The replication runs asynchronously, so set a delegate or observe the status property to be notified of progress.

  • The local database.

    Declaration

    Objective-C

    @property (readonly, nonatomic) CBLDatabase *_Nonnull database;

    Swift

    var database: CBLDatabase { get }
  • The URL of the remote database to replicate with, or nil if the target database is local.

    Declaration

    Objective-C

    @property (readonly, nonatomic, nullable) NSURL *remoteURL;

    Swift

    var remoteURL: URL? { get }
  • The target database, if it’s local, else nil.

    Declaration

    Objective-C

    @property (readonly, nonatomic, nullable) CBLDatabase *otherDatabase;

    Swift

    var otherDatabase: CBLDatabase? { get }
  • Should the replication push documents to the target?

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) BOOL push;

    Swift

    var push: Bool { get set }
  • Should the replication pull documents from the target?

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) BOOL pull;

    Swift

    var pull: Bool { get set }
  • Should the replication stay active indefinitely, and push/pull changed documents?

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) BOOL continuous;

    Swift

    var continuous: Bool { get set }
  • An object that will receive progress and error notifications.

    Declaration

    Objective-C

    @property (readwrite, nonatomic, nullable) id<CBLReplicationDelegate> delegate;

    Swift

    weak var delegate: CBLReplicationDelegate? { get set }
  • Starts the replication. This method returns immediately; the replication runs asynchronously and will report its progress to the delegate. (After the replication starts, changes to the push, pull or continuous properties are ignored.)

    Declaration

    Objective-C

    - (void)start;

    Swift

    func start()
  • Stops a running replication. This method returns immediately; when the replicator actually stops, the CBLReplication will change its status’s activity level to kCBLStopped and call the delegate.

    Declaration

    Objective-C

    - (void)stop;

    Swift

    func stop()
  • The replication’s current status: its activity level and progress. Observable.

    Declaration

    Objective-C

    @property (readonly, nonatomic) CBLReplicationStatus status;

    Swift

    var status: CBLReplicationStatus { get }
  • Any error that’s occurred during replication. Observable.

    Declaration

    Objective-C

    @property (readonly, nonatomic, nullable) NSError *lastError;

    Swift

    var lastError: Error? { get }