Official iOS SDK for Kuzzle
Swift Objective-C Other
Latest commit fc96593 Sep 7, 2016 @jenow jenow release
Permalink
Failed to load latest commit information.
Carthage/Checkouts
bin KUZ-455 Setting up dependencies. Mar 1, 2016
kuzzlesdk.xcodeproj
kuzzlesdk.xcworkspace
kuzzlesdk correct copyright Aug 10, 2016
kuzzlesdkObjC
kuzzlesdkObjCTests correct copyright Aug 10, 2016
kuzzlesdkTests
.gitignore
.gitmodules
.slather.yml
.travis.yml Added missing slather in .travis.yml. Jun 1, 2016
CHANGELOG.md
Cartfile
Cartfile.private KUZ-149 Added OCMock to Carthage and ObjC target. May 4, 2016
Cartfile.resolved KUZ-149 Trying to find reason why one of tests rarely not succeed. May 30, 2016
LICENSE Update LICENSE Jul 6, 2016
README.md
kuzzlesdk.podspec
kuzzlesdkObjC.podspec release Sep 7, 2016
kuzzlesdkTestsRemote-Info.plist
travis-codecov.sh correct copyright Aug 10, 2016
travis-deploy.rb
travis-script.sh correct copyright Aug 10, 2016

README.md

Build Status codecov

Carthage Compatible

Join the chat at https://gitter.im/kuzzleio/kuzzle

Official Kuzzle iOS SDK

This SDK version requires Kuzzle v2.0.0 or higher.

About Kuzzle

For UI and linked objects developers, Kuzzle is an open-source solution that handles all the data management (CRUD, real-time storage, search, high-level features, etc).

You can access the Kuzzle repository on Github

SDK Documentation

The complete SDK documentation for iOS (Swift/Objective-C) is available here from 01.06.2016.

Because of usage of dynamic framework we support iOS 8+. SDK is written in Swift 2.x with Obj-C support.

Installation

Carthage

Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.

You can install Carthage with Homebrew using the following command:

$ brew update
$ brew install carthage

To integrate Kuzzle iOS SDK into your Xcode project using Carthage, specify it in your Cartfile:

github "kuzzleio/sdk-ios" ~> "2.0.0"

or, for Objective-C support:

github "kuzzleio/sdk-ios" ~> "2.0.0_objc"

Run carthage update --platform ios and drag the built kuzzlesdk.framework (for swift projects) or kuzzlesdkObjC.framework for Objective-C support.

CocoaPods

CocoaPods is a dependency manager for Swift and Objective-C Cocoa projects. You can install it with the following command:

$ gem install cocoapods

To integrate Kuzzle iOS SDK into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!

pod 'kuzzlesdk', '~> 2.0.0'

or, for Objective-C support:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!

pod 'kuzzlesdkObjC', '~> 2.0.0_objc'

Usage

Import

Swift:

import kuzzlesdk

Objective-C

#import "kuzzlesdkObjC/kuzzlesdkObjC-Swift.h"
// or when using cocapods
#import <kuzzlesdkObjC/kuzzlesdkObjC-Swift.h>

Connect to kuzzle

Swift:

let kuzzle = try Kuzzle(url: "localhost", options: options, connectionCallback: {
    result in
    switch result {
        case let .onError(error):
            // handle error
        case let .onSuccess(success):
            // handle success
            // e.g. create document
            let dataCollection = kuzzle.dataCollectionFactory(collectionName: "test", index: "index")
            let document = KuzzleDocument(dataCollection).
            try! document.setContent(content: ["foo": "bar"]).apply()
        break
    }
})

Objective-C:

NSError* error = nil;
kuzzle = [[Kuzzle alloc] initWithUrl: @"localhost" error: &error connectionCallback:^(id onSuccess, NSError* onError) {
    if(onError) {
        // handle error
        return;
    }
    // handler success
    // e.g. create document
    // use line below to immedietaly access Kuzzle after successful connection
    __weak Kuzzle* weakKuzzle = kuzzle;
    NSError* error = nil;
    KuzzleDataCollection* dataCollection = [weakKuzzle dataCollectionFactoryWithCollectionName: @"test" error: &error];
    KuzzleDocument* document = [[KuzzleDocument alloc] initWithCollection: dataCollection];
    // calling save will store document on remote kuzzle instance
    [[document setContentWithContent: @{@"foo": @"bar"}] saveAndReturnError: &error];
}];

License

Kuzzle is published under Apache 2 License.