iOS SDK
Using our iOS SDK makes it easy to integrate Shen.AI into a new or existing iOS app.
The best way to get started is to download and build one of our example apps:
- Swift example available here on GitHub .
- Objective-C example available here on GitHub .
The iOS integration uses the Objective-C API of the SDK, so it can be used directly in Swift and in Objective-C projects.
Installing the SDK package
The SDK is packaged as an iOS Framework. To start working with the SDK, you’ll need to download the SDK package and extract it in your iOS codebase.
Add the framework to your project by dragging it into the Xcode project navigator. Make sure to select the “Copy items if needed” option.
Custom frame input
If your app already owns the video pipeline, you can initialize the SDK with CameraMode.customFrames. In this mode the SDK will not open a camera and will wait for frames from your app.
let settings = InitializationSettings()
settings.cameraMode = .customFrames
let initResult = ShenaiSDK.initialize(API_KEY, userID: USER_ID, settings: settings)Frames are submitted through the native iOS API as I420 data:
let metadata = FrameMetadata()
metadata.timestampUs = Int64(DispatchTime.now().uptimeNanoseconds / 1_000)
metadata.cameraFacingUser = true
let accepted = ShenaiSDK.handleNextFrame(i420FrameData, width: width, height: height, metadata: metadata)timestampUs is optional. When you provide it, it should be a monotonic capture timestamp in microseconds. If you leave it unset or negative, the SDK synthesizes monotonic submission-time timestamps. For best accuracy, provide source timestamps when available and prefer uniform sampling of at least 30 FPS. In CustomFrames mode, submit frames already rotated and resized as you want them processed; SDK-side rotation, frameWidth, and frameHeight are ignored.
handleNextFrame(...) is the native iOS frame-submission API for CustomFrames. If you use Flutter, React Native, Capacitor, or MAUI, configure CustomFrames in the framework layer and call the native Android/iOS frame-submission APIs from platform code; the framework bindings themselves do not accept raw frames.
Further steps
Please see permissions, initialization, configuration and video measurement for further steps.