Extending the Framework - nothirst/TICoreDataSync GitHub Wiki

Extending TICoreDataSync by adding support for other sync types, such as WebDAV

At present, TICoreDataSync supports synchronization via anything you can access through NSFileManager, such as the Dropbox folder on the desktop, as well as the Dropbox SDK for Mac and iOS applications.

At present there is an iCloud implementation being maintained in a feature branch.

If you need to add your own sync option, you’ll need to write a set of classes that must override certain methods.

Sync Managers

You’ll need to provide sync-specific subclasses for each of the two types of sync manager: application and document.

This means subclassing TICDSApplicationSyncManager and TICDSDocumentSyncManager. Each subclass will be required to implement the methods that return the operation objects used to perform the various synchronization-related tasks. For example, the TICDSDropboxSDKBasedApplicationSyncManager class returns a TICDSDropboxSDKBasedWholeStoreDownloadOperation instance from the wholeStoreDownloadOperationForDocumentWithIdentifier: method, which is declared by the TICDSApplicationSyncManager.

Operation Objects

You’ll also need to provide a set of operation classes to handle the upload and download of files during each synchronization task.

Each operation should be a subclass of one of the Generic Operations, such as TICDSApplicationRegistrationOperation or TICDSDocumentRegistrationOperation.

Each generic operation requires you to override specific methods to handle the file transfers between local and remote. As each file-movement task is complete, you’ll need to use the predefined callback methods to indicate success or failure.

Note that if encryption is enabled, your subclass is responsible for encrypting all files before they are uploaded, and decrypting all files before they are moved to their local locations. This is relatively trivial — see the TICDSFileManagerBasedApplicationRegistrationOperation.m file for an example.

For more information on what each operation does, either check the documentation, or take a look at the [operation task diagrams](Operation Task Diagrams).

Temporary Files

If you need a temporary location to store files locally, the underlying TICDSOperation class, from which all other generic operations are derived, will provide you with a directory specific to the operation.

Call the tempDirectoryPath method to return the path to this directory; if this is the first time it’s been requested, this directory will be automatically created before the method returns the path.

Note that once the operation completes all its tasks, this directory (and all its contents) will automatically be removed.