Latest 1.0.0
Homepage https://github.com/kuzzleio/sdk-ios
License Apache2
Platforms ios 8.0, requires ARC
Dependencies Socket.IO-Client-Swift
Authors ,

Build Status
codecov

Carthage Compatible

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

Official Kuzzle iOS SDK

This SDK version requires Kuzzle v1.0.0-beta.1 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" ~> "1.0.0"

or, for Objective-C support:

github "kuzzleio/sdk-ios" ~> "1.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', '~> 1.0.0'

or, for Objective-C support:

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

pod 'kuzzlesdkObjC', '~> 1.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.

Latest podspec

{
    "name": "kuzzlesdkObjC",
    "version": "1.0.0",
    "summary": "iOS client for Kuzzle (ObjC)",
    "homepage": "https://github.com/kuzzleio/sdk-ios",
    "license": {
        "type": "Apache2",
        "file": "LICENSE"
    },
    "authors": {
        "Maciej Madaj": "[email protected]",
        "kuzzle.io": "[email protected]"
    },
    "platforms": {
        "ios": "8.0"
    },
    "requires_arc": true,
    "source": {
        "git": "https://github.com/kuzzleio/sdk-ios.git",
        "tag": "1.0.0_objc",
        "submodules": true
    },
    "source_files": "kuzzlesdk/**/*.{h,swift}",
    "dependencies": {
        "Socket.IO-Client-Swift": [
            "~> 6.0.0"
        ]
    }
}

Pin It on Pinterest

Share This