API

This page shows a high level overview of the API. For more details, see the documentation in the code.

Listening

public func listenForUpdates(listener: ConsistencyManagerListener)

Adds an object as a listener to the consistency manager. Note: you don’t need to pass in a model to listen to; the manager will call your delegate method to get the current model.

You do not need to worry about removing listeners as the library does not maintain strong references to listeners.

Updating Models

public func updateWithNewModel(model: ConsistencyManagerModel, context: Any? = nil)

Provides a REST-like interface for updating models. Simply pass in an updated model, and all the listeners will automatically be updated. You can also optionally pass in a context here which will then be passed back to listeners that were affected by this change. See Other Features for more information.

Deleting Models

public func deleteModel(model: ConsistencyManagerModel, context: Any? = nil)

Deletes a model from any tree which is listening to it. Like updateWithNewModel, you can pass in a context here which will be passed back to any listener affected by this change.