DeliteAI iOS SDK¶
DeliteAI iOS SDK is an powerful yet easy to integrate SDK into your iOS applications enabling you to build AI agentic workflows and experiences in your apps without worrying about low level interfaces or privacy challenges as the AI is run locally on-device.
Table of Contents¶
Integrating DeliteAI iOS SDK into your application: If you want to integrate the DeliteAI iOS SDK into your existing application.
Local Development & Testing: If you want to run the iOS SDK locally via the example app or execute its unit tests.
Running the Example App Locally
Running Unit Tests
Integrating DeliteAI iOS SDK into Your Project¶
This section guides you through the process of adding the DeliteAI iOS SDK to your application and making your first API calls.
Installation¶
CocoaPods¶
DeliteAI iOS SDK is available as a CocoaPod. To integrate it into your Xcode project:
Add the DeliteAI iOS SDK source and pod to your Podfile:
source 'git@github.com:NimbleEdge/deliteAI-iOS-Podspecs.git' # deliteAI source source 'https://github.com/CocoaPods/Specs.git' # cocoaPods source platform :ios, '12.0' target 'YourAppTarget' do use_frameworks! pod 'DeliteAI', end
Install the pod:
pod install
Open the generated
.xcworkspace
file in Xcode.
Integrating DeliteAI iOS SDK in Code¶
Once you’ve installed the SDK, follow the steps below to integrate DeliteAI into your app code.
Import the Package
Import DeliteAI into your Swift files to access DeliteAI iOS SDK’s core APIs
import DeliteAI
Initialize the SDK
Before using any methods, you must initialize the SDK with your credentials and endpoint.
let nimbleNetConfig = NimbleNetConfig( clientId: "quick-start-client", clientSecret: "quick-start-secret", host: "[https://your-server.com/](https://your-server.com/)", deviceId: "qs-iOS", debug: true, compatibilityTag: "RankerV1", online: true ) let result = NimbleNetApi.initialize(config: nimbleNetConfig) if result.status { print("NimbleNet initialized successfully") } else { print("NimbleNet initialization failed with error: \(result.error?.localizedDescription ?? "")") }
Check SDK Readiness
Always verify the SDK is ready before making further calls:
let ready = NimbleNetApi.isReady() if (ready.status) { print("NimbleNet sdk is ready") } else { print("NimbleNet sdk is not ready: \(ready.error?.localizedDescription ?? "")") }
Record Restaurant Click Events
Track user clicks with the required fields:
var eventData: [String : Any] = [ "restaurant_id": 8001, "category": "desserts", "priceForTwo": 2500, "distance": 4.3 ] var eventResult = NimbleNetApi.addEvent(events: eventData, eventType: "RestaurantClicksTable") if (eventResult.status) { print("NimbleNet Event recorded") } else { print("NimbleNet Event failed: \(eventResult.error?.message ?? "Unknown error")") }
Fetch Restaurant Rankings
Invoke the
rerank_restaurant
workflow to get top restaurants:let inputs: [String: NimbleNetTensor] = [ "category": NimbleNetTensor( data: "desserts", datatype: DataType.string, shape: [] ) ] let ranking = NimbleNetApi.runMethod(methodName: "rerank_restaurant", inputs: inputs) if (ranking.status) { let outputs = ranking.payload?.map let topRestaurants = outputs?["topRestaurants"] print("NimbleNet Top restaurants: \(topRestaurants?.name ?? "")") } else { print("NimbleNet Ranking failed: \(ranking.error?.message ?? "Unknown error")") }