Syncano's iOS library is written in Objective-C and provides communication with Syncano (www.syncano.com) via HTTPS RESTful interface and TCP sockets.
The full source code can be found on Github - feel free to browse or contribute.
Click here to learn more about Syncano or create an account!
We use CocoaPods for external libraries dependencies and their installation. You have to install CocoaPods plugin and use it to install external libraries Syncano's iOS Library depends on.
To install CocoaPods on your Mac type:
$ [sudo] gem install cocoapods
To install libraries used by syncano-ios
execute this command in the same directory as the 'Podfile' file:
$ pod install
To compile the library, make sure to use syncano-ios.xcworkspace
(not .xcodeproj
).
You can download archived sources of the latest version of Syncano’s iOS Library by right clicking on following link and choosing “Save As…”:
Our library depends on following third party frameworks, so you will need to download them as well:
If you want to use CocoaPods, add this to your Podfile:
pod ‘syncano-ios’, ‘~>3.1.2’
Unzip previously downloaded files, drag the .xcodeproject
files to your project/workspace, and add their targets as your app dependency.
If you use CocoaPods, after adding our library to your Podfile, type the following into your terminal:
$ pod install
To add external library dependencies, edit 'Podfile' in your main directory and type:
pod 'library name'
To remove an external library, remove the line with this library in 'Podfile', save it, and execute this command:
$ pod install
Documentation and further information on CocoaPods is available at: http://cocoapods.org/
Appledoc documentation can be generated by building a Documentation
target in syncano-ios.xcworkspace
. Docs will be in the Syncano-Docs
directory and will be installed to the Xcode documentation, too. In case something is wrong, logs are put into the appledoc.log
file. If you need to download appledoc
visit https://github.com/tomaz/appledoc/.
To write documentation, we recommend using the VVDocumenter
XCode plugin. It makes writing correctly structured documentation a little easier. Simply place your cursor above method/class/anything you wish to describe, and type ///
to generate a documentation template snippet for that item.
/// Used for REST connection
#import <Syncano/Syncano.h>
(This will be used to send requests to your instance of Syncano.):
Syncano *syncano = [Syncano syncanoForDomain:@“YOUR-SYNCANO-DOMAIN” apiKey:@“YOUR-API-KEY-123456”];
(Use a project ID and collection ID from your admin GUI, i.e. YourDomain.syncano.com, for the below. You can use the “default” values or create your own.):
NSString *textToSend = @“Some sample text”;
UIImage *imageToSend = [UIImage imageNamed:@“sampleImage.png”];
SyncanoParameters_DataObjects_New *params = [[SyncanoParameters_DataObjects_New alloc] initWithProjectId:@“PROJECT_ID” collectionId:@“COLLECTION_ID” state:@"pending"];
params.text = textToSend;
params.image = imageToSend;
///For an asynchronous connection, enter the below and work with the returned response
[syncano dataNew:params callback:^(SyncanoResponse_DataObjects_New *response) {
if (response.isResponseOK) {
}
}
///Describe what you want to download by using parameters
SyncanoParameters_DataObjects_Get *params = [[SyncanoParameters_DataObjects_Get alloc] initWithProjectId:@“PROJECT_ID” collectionId:@“COLLECTION_ID”];
params.dataId = @“123456”; // set if you want to download one particular object. Leave empty if you want to download all objects from that collection
///For an asynchronous connection, enter the below and work with the returned response
[syncano dataGet:params callback:^(SyncanoResponse_DataObjects_Get *response) {
if (response.isResponseOK) {
SyncanoData *data = response.data;
}
}
We also offer synchronous connections if you’d like to manage threading yourself. You can use the exact same methods to connect with Syncano using TCP socket - just use SyncanoSyncServer class object instead of Syncano class.
Syncano's iOS Library (syncano-ios) is available under the MIT license. See the LICENSE file for more info.