此 SDK 版本需要 Kuzzle v1.0.0-beta.1 或更高版本。
对于 UI 和链接对象开发者,Kuzzle 是一个开源解决方案,用于处理所有数据管理(CRUD、实时存储、搜索、高级功能等)。
您可以在 Github 上访问 Kuzzle 仓库
从 2016 年 6 月 1 日起,iOS (Swift/Objective-C)完整 SDK 文档可在 此处 获取。
由于使用了动态框架,我们支持 iOS 8+。SDK 以 Swift 2.x 编写,并支持 Objective-C。
Swift
import kuzzlesdk
Objective-C
#import "kuzzlesdkObjC/kuzzlesdkObjC-Swift.h"
// or when using cocapods
#import <kuzzlesdkObjC/kuzzlesdkObjC-Swift.h>
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];
}];
Kuzzle 在 Apache 2 许可 下发布。