commit | e92d03713fc8645ae214f8b285a51069cb4531c9 | [log] [tgz] |
---|---|---|
author | Minh Tu Le <minhtule05@gmail.com> | Sat Mar 07 11:49:22 2015 +0800 |
committer | Minh Tu Le <minhtule05@gmail.com> | Fri Aug 07 16:11:06 2015 +0800 |
tree | fcfdfb16737b55a8cbc444a7b13ccdc5c7630405 | |
parent | 5fc62259aca736c30352dab87bbd9eb892f06cb5 [diff] |
Update .gitignore
[] (https://travis-ci.org/minhtule/PredictionIO-Swift-SDK)
The Swift SDK provides a convenient API for your iOS application to record your users' behaviors in the event server and retrieve predictions from PredictionIO engines.
Only CocoaPods 0.36.0 beta (and rc1) supports Swift and embedded frameworks. So CocoaPods needs to be installed with the following command.
$ gem install cocoapods --pre
Add the following lines to your Podfile
.
platform :ios, '8.0' use_frameworks! pod 'PredictionIOSDK', :git => 'https://github.com/minhtule/PredictionIO-iOS-SDK.git'
Then run the following command.
$ pod install
You can just drag two files: PredictionIOSDK.swift
and Alamofire.swift
into your project.
Note that Alamofire.swift
has been slightly modified from the original; however, if you have already integrated the original Alamofire.swift
file to your project, you don't need to include Alamofire.swift
from this repo again.
Use EngineClient
to query predictions from the PredictionIO Engines.
let engineClient = EngineClient(baseURL: "http://localhost:8000") let query = [ "user": 1, "num": 2 ] engineClient.sendQuery(query) { (request, response, JSON, error) in if let data = JSON as? [String: [[String: AnyObject]]] { ... } ... }
Use EventClient
to send information to the PredictionIO Event Server.
let eventClient = EventClient(accessKey: accessKey, baseURL: "http://localhost:7070") let event = Event( event: "rate", entityType: "user", entityID: "1", targetEntityType: "item", targetEntityID: "9", properties: [ "rating": 5 ] ) eventClient.createEvent(event) { (request, response, JSON, error) in ... }
There are other convenient methods to modify user‘s or item’s properties. Please see the API documentation for more details.
The latest API documentation is available at http://minhtule.github.io/PredictionIO-Swift-SDK/index.html.
PredictionIO Swift SDK is released under the Apache License 2.0. Please see LICENSE for details.