Objective-C setup
Apple platforms through the Slab C interface
Objective-C uses Slab's C interface directly, through the Slab framework
in Slab.xcframework (iPhone/iPad, Simulator and Mac, arm64). There is no
separate wrapper: every function in the C reference is
callable as is.
Example: Classify.m.
Add to an app
- Drag
Slab.xcframeworkinto the Xcode project and set it to Embed & Sign, or add theiosfolder as a local Swift package and link itsSlabframework. - Import it with
@import Slab;(modules enabled, the default) or#import <Slab/Slab.h>.
Bridging notes
- Handles are
uint8_t *. Free each with its_freefunction; ARC does not manage them. Wrap them in your own classes withdeallocif you like. - Strings in: pass UTF-8 bytes and their length, e.g.
NSData *d = [s dataUsingEncoding:NSUTF8StringEncoding]then(uint8_t *)d.bytes, d.length. - Strings out: build an
NSStringfrom the_ptr/_lenpair withinitWithBytes:length:encoding:. Copy before the next call on that object. - Camera frames: lock a 32BGRA
CVPixelBufferand pass its base address, bytes per row, width and height toslab_frame_set_pixelswithSLAB_PIXEL_BGRA8andcopy = 1. - Threads: one operation at a time per session; run sessions on a
background queue.
slab_session_cancelworks from any thread.
Swift apps can use the Swift API instead.
Requirements and license
Use iOS / iPadOS 18 or later, or macOS 15 or later on Apple silicon. The simulator slice is arm64. List the bundle ID of every app or extension that loads Slab in the license. New app-ID licenses require neither an Apple App ID prefix nor a Keychain group. See Licenses & renewals.
License details
Slab 0.2.0 exposes the attached license on Config and Session. Use it to display expiry and send renewal reminders to whoever maintains the license.
| Config member | Value |
|---|---|
slab_config_runtime_license_seconds_left(cfg) |
Seconds remaining |
slab_config_runtime_license_expires_at(cfg) |
Expiry, Unix seconds |
slab_config_runtime_license_not_before(cfg) |
Start of validity, Unix seconds |
slab_config_runtime_license_issued_at(cfg) |
Issue time, Unix seconds |
slab_config_runtime_license_kind(cfg) |
License kind |
slab_config_runtime_license_features(cfg) |
Enabled feature flags |
slab_config_runtime_license_id_ptr(cfg) / _id_len(cfg) |
License ID |
Seconds remaining becomes negative after expiry and is 0 without a license. Kind values are 0 none, 1 production, 2 trial and 3 pilot. Feature bits are 1 core, 2 graph models, 4 generative, 8 GPU, 16 NPU and 32 protected models.
The session equivalents start with slab_session_runtime_license_ and take a session handle.
For protected models, generate a license with your model key in the console. Attach that license before opening the pack. See licensing for model protection and renewals.