CBLConflictResolver

@protocol CBLConflictResolver <NSObject>

Abstract interface for an application-defined object that can resolve a conflict between two revisions of a document. Called when saving a CBLDocument, when there is a a newer revision already in the database; and also when the replicator pulls a remote revision that conflicts with a locally-saved revision.

  • Resolves conflicting edits of a document against their common base. - parameter: localProperties The revision that is being saved, or the revision in the local database for which there is a server-side conflict. - parameter: conflictingProperties The conflicting revision that is already stored in the database, or on the server. - parameter: baseProperties The common parent revision of these two revisions, if available. - returns: The resolved set of properties for the document to store, or nil to give up if automatic resolution isn’t possible.

    Declaration

    Objective-C

    - (nullable NSDictionary<NSString *, id> *)
    resolveMine:(nonnull NSDictionary<NSString *, id> *)localProperties
     withTheirs:(nonnull NSDictionary<NSString *, id> *)conflictingProperties
        andBase:(nonnull NSDictionary<NSString *, id> *)baseProperties;

    Swift

    func resolveMine(_ localProperties: [String : Any], withTheirs conflictingProperties: [String : Any], andBase baseProperties: [String : Any]) -> [String : Any]?

    Parameters

    localProperties

    The revision that is being saved, or the revision in the local database for which there is a server-side conflict.

    conflictingProperties

    The conflicting revision that is already stored in the database, or on the server.

    baseProperties

    The common parent revision of these two revisions, if available.

    Return Value

    The resolved set of properties for the document to store, or nil to give up if automatic resolution isn’t possible.