Classes

The following classes are available globally.

  • An Objective-C compatible equivalent to DittoIdentity.

    The identity configurations that you can use when initializing a DittoKit instance are:

    • development: An identity to be used while in development when you want to control either or both of the app name and the site ID of the peer.
    • production: The identity to use when in production. This accepts a certificate bundle, which includes identity information, as a base 64 encoded string.
    See more

    Declaration

    Swift

    @objc
    public class DittoIdentityObjC : NSObject
  • DittoKit is the entry point for accessing Ditto-related functionality.

    See more

    Declaration

    Swift

    @objc
    public class DittoKit : NSObject
  • Configuration for the database backend that DittoStore uses. Currently this is LMDB.

    See more

    Declaration

    Swift

    @objc
    public class DittoDBConfig : NSObject
  • Provides an interface to specify a path to a key in a document that you can then call a function on to get the value at the specified key as a specific type. You obtain a DittoDocumentPath by subscripting a DittoDocument and you can then further subscript a DittoDocumentPath to further specify the key of the document that you want to get the value of.

    See more

    Declaration

    Swift

    @objcMembers
    @objc
    public class DittoDocumentPath : NSObject
  • The type that is returned when calling when calling observe or observeLocal on a DittoPendingCursorOperation object. It handles the logic for calling the event handler that is provided to observe or observeLocal calls. DittoLiveQuery objects must be kept in scope for as long as you with to have your event handler be called when there is an update to a document matching the query you provide.

    See more

    Declaration

    Swift

    @objc
    public class DittoLiveQuery : NSObject
  • An Objective-C compatible equivalent to DittoLiveQueryEvent. It describes the different types of event that you can receive when dealing with live queries.

    • initial: The first event that will be delivered and it will only be delivered once.
    • update: This event will be delivered each time the results of the provided query change. It contains information about the set of documents that previously matched the query before the update, along with information about what documents have been inserted, deleted, updated, or moved, as part of the set of matching documents.
    • error: This event will be delivered if there’s an error in relation to a live query.

    You can switch on the type and then get the value of the event as the appropriate type using the relevant function out of: asInitialEvent, asUpdateEvent, and asErrorEvent.

    See more

    Declaration

    Swift

    @objc
    public class DittoLiveQueryEventObjC : NSObject
  • Represents the initial event that will be the value of an DittoLiveQueryEventObjC when its type is initial and asInitialEvent is called on it.

    Declaration

    Swift

    @objc
    public class DittoLiveQueryInitialEvent : NSObject, DittoLiveQueryEventValueObjC
  • Represents an update event that will be the value of an DittoLiveQueryEventObjC when its type is update and asUpdateEvent is called on it.

    See more

    Declaration

    Swift

    @objc
    public class DittoLiveQueryUpdateEvent : NSObject, DittoLiveQueryEventValueObjC
  • Represents the initial event that will be the value of an DittoLiveQueryEventObjC when its type is error and asErrorEvent is called on it.

    See more

    Declaration

    Swift

    @objc
    public class DittoLiveQueryErrorEvent : NSObject, DittoLiveQueryEventValueObjC
  • Represents how a document has moved in the list of matching documents as part of a live query update event.

    See more

    Declaration

    Swift

    @objc
    public class DittoLiveQueryMove : NSObject
  • This is used as part of update operations for documents. It provides access to updating a document through a subscript-based API. A subscript operation returns a DittoMutableDocumentPath that you can then use to chain further subscript operations to in order to access nested values in a document. Once you’ve defined the path to a key in a document that you’d like to update, by using subscripts, then you can use the functionality defined on DittoMutableDocumentPath to perform the desired document update(s). Note that objects of this type should only be used within the scope of the update closure that they are provided in.

    See more

    Declaration

    Swift

    @objc
    public class DittoMutableDocument : NSObject
  • Provides an interface to specify a path to a key in a document that you can then call various update functions on. You obtain a DittoMutableDocumentPath by subscripting a DittoMutableDocument and you can then further subscript a DittoMutbaleDocumentPath to further specify the key of the document that you want to update.

    See more

    Declaration

    Swift

    @objcMembers
    @objc
    public class DittoMutableDocumentPath : NSObject
  • An Objective-C compatible equivalent to DittoUpdateResult. Describes the result of an update operation performed on a DittoMutableDocument.

    • set: Describes the set update that was performed.
    • removed: Describes the remove update that was performed.
    • replacedWithCounter: Describes the replaceWithCounter update that was performed.
    • incremented: Describes the increment update that was performed.
    • replacedText: Describes the replaceText update that was performed.
    • pushed: Describes the push update that was performed.
    • popped: Describes the pop update that was performed.

    You can switch on the type and then get the value of the result as the appropriate type using the relevant function out of:

    • asSet
    • asRemoved
    • asReplacedWithCounter
    • asIncremented
    • asReplacedText
    • asPushed
    • asPopped
    See more

    Declaration

    Swift

    @objc
    public class DittoUpdateResultObjC : NSObject
  • Represents the update result that will be the value of a DittoUpdateResultObjC when its type is set and asSet is called on it.

    See more

    Declaration

    Swift

    @objc
    public class DittoUpdateResultSet : NSObject, DittoUpdateResultValueObjC
  • Represents the update result that will be the value of a DittoUpdateResultObjC when its type is removed and asRemoved is called on it.

    See more

    Declaration

    Swift

    @objc
    public class DittoUpdateResultRemoved : NSObject, DittoUpdateResultValueObjC
  • Represents the update result that will be the value of a DittoUpdateResultObjC when its type is replacedWithCounter and asReplacedWithCounter is called on it.

    See more

    Declaration

    Swift

    @objc
    public class DittoUpdateResultReplacedWithCounter : NSObject, DittoUpdateResultValueObjC
  • Represents the update result that will be the value of a DittoUpdateResultObjC when its type is incremented and asIncremented is called on it.

    See more

    Declaration

    Swift

    @objc
    public class DittoUpdateResultIncremented : NSObject, DittoUpdateResultValueObjC
  • Represents the update result that will be the value of a DittoUpdateResultObjC when its type is replacedText and asReplacedText is called on it.

    See more

    Declaration

    Swift

    @objc
    public class DittoUpdateResultReplacedText : NSObject, DittoUpdateResultValueObjC
  • Represents the update result that will be the value of a DittoUpdateResultObjC when its type is pushed and asPushed is called on it.

    See more

    Declaration

    Swift

    @objc
    public class DittoUpdateResultPushed : NSObject, DittoUpdateResultValueObjC
  • Represents the update result that will be the value of a DittoUpdateResultObjC when its type is popped and asPopped is called on it.

    See more

    Declaration

    Swift

    @objc
    public class DittoUpdateResultPopped : NSObject, DittoUpdateResultValueObjC
  • These objects are returned when using find-like functionality on DittoCollections. They allow chaining of further query-related functions to do things like add a limit to the number of documents you want returned or specify how you want the documents to be sorted and ordered. You can either call exec on the object to get an array of DittoDocuments as an immediate return value, or you can establish either a live query or a subscription, which both work over time. A live query, established by calling observe, will notify you every time there’s an update to a document that matches the query you provided in the preceding find-like call. A subscription, established by calling subscribe, will act as a signal to other peers that the device connects to that you would like to receive updates from them about documents that match the query you provided in the preceding find-like call. Calling observe will generate both a subscription and a live query at the same time. If you’d like to only observe local changes then you can call observeLocal. Update and remove functionality is also exposed through this object.

    See more

    Declaration

    Swift

    @objc
    public class DittoPendingCursorOperation : NSObject, QuerySorting, QueryObserving, QueryInstructing
  • These objects are returned when using findByID functionality on DittoCollections. You can either call exec on the object to get an immediate return value, or you can establish either a live query or a subscription, which both work over time. A live query, established by calling observe, will notify you every time there’s an update to the document with the ID you provided in the preceding findByID call. A subscription, established by calling subscribe, will act as a signal to other peers that you would like to receive updates from them about the document with the ID you provided in the preceding findByID call. Calling observe will generate both a subscription and a live query at the same time. If you’d like to only observe local changes then you can call observeLocal. Update and remove functionality is also exposed through this object.

    See more

    Declaration

    Swift

    @objc
    public class DittoPendingIDSpecificOperation : NSObject, DocumentObserving, DocumentInstructing
  • The type that is returned when calling observe or observeLocal on a DittoPendingIDSpecificOperation object. It handles the logic for calling the event handler that is provided to observe or observeLocal calls. DittoSingleDocumentLiveQuery objects must be kept in scope for as long as you with to have your event handler be called when there is an update to the referenced document.

    See more

    Declaration

    Swift

    @objc
    public class DittoSingleDocumentLiveQuery : NSObject
  • Represents a change to a document by providing a value representing the document’s old state and a value representing the document’s new state. If it is the first time that one of these events is delivered for a DittoSingleDocumentLiveQuery then the isInitial value will be true and the newDocument value will be populated, if there existed a document with the relevant ID. If there is no matching document found then both oldDocument and newDocument will be nil. If the document exists and is removed at a later date then an event will be delivered where oldDocument will be the most recent version of the document and newDocument will be nil. Similarly, if there was no document with the relevant ID and a document with the ID is later added then an event will be delivered where oldDocument is nil and newDocument will be the document as it was just inserted.

    See more

    Declaration

    Swift

    @objc
    public class DittoSingleDocumentLiveQueryEvent : NSObject
  • While DittoSubscription objects remain in scope they ensure that documents in the collection specified and that match the query provided will try to be kept up-to-date with the latest changes from remote peers.

    See more

    Declaration

    Swift

    @objc
    public class DittoSubscription : NSObject
  • DittoWriteTransaction exposes functionality that allows you to perform multiple operations on the store within a single write transaction. You must use the scoped function to get collection-scoped access to the write transaction object, which will then allow you to perform insert, update, remove or evict operations using the write transaction.

    See more

    Declaration

    Swift

    @objc
    public class DittoWriteTransaction : NSObject
  • DittoScopedWriteTransaction exposes functionality that allows you to perform multiple operations on the store within a single write transaction.

    See more

    Declaration

    Swift

    @objc
    public class DittoScopedWriteTransaction : NSObject
  • An Objective-C compatible equivalent to DittoWriteTransactionResult. Describes the result of a write transaction operation.

    • inserted: Describes a document that has been inserted, referencing its ID and the collection it was inserted into.
    • updated: Describes a document that has been updated, referencing its ID and the collection it belongs to.
    • evicted: Describes a document that has been evicted, referencing its ID and the collection it belonged to.
    • removed: Describes a document that has been removed, referencing its ID and the collection it belonged to.

    You can switch on the type and then get the value of the result as the appropriate type using the relevant function out of:

    • asInserted
    • asUpdated
    • asEvicted
    • asRemoved
    See more

    Declaration

    Swift

    @objc
    public class DittoWriteTransactionResultObjC : NSObject
  • Represents the write transaction result that will be the value of a DittoWriteTransactionResultObjC when its type is inserted and asInserted is called on it.

    See more

    Declaration

    Swift

    @objc
    public class DittoWriteTransactionResultInserted : NSObject, DittoWriteTransactionResultValueObjC
  • Represents the write transaction result that will be the value of a DittoWriteTransactionResultObjC when its type is updated and asUpdated is called on it.

    See more

    Declaration

    Swift

    @objc
    public class DittoWriteTransactionResultUpdated : NSObject, DittoWriteTransactionResultValueObjC
  • Represents the write transaction result that will be the value of a DittoWriteTransactionResultObjC when its type is evicted and asEvicted is called on it.

    See more

    Declaration

    Swift

    @objc
    public class DittoWriteTransactionResultEvicted : NSObject, DittoWriteTransactionResultValueObjC
  • Represents the write transaction result that will be the value of a DittoWriteTransactionResultObjC when its type is removed and asRemoved is called on it.

    See more

    Declaration

    Swift

    @objc
    public class DittoWriteTransactionResultRemoved : NSObject, DittoWriteTransactionResultValueObjC