Skip to main content
Latest version: v0.9.2

Prerequisites​

Make sure you have:
  • Xcode 15.0 or later with Swift 5.9.
  • An iOS project targeting iOS 15.0+ (macOS 12.0+ or Mac Catalyst 15.0+ are also supported).
  • A physical iPhone or iPad with at least 3 GB RAM for best performance. The simulator works for development but runs models much slower.
Always test on a real device before shipping. Simulator performance is not representative of production behaviour.

Install the SDK​

Choose your preferred installation method:
Recommended
  1. In Xcode choose File -> Add Package Dependencies.
  2. Enter https://github.com/Liquid4All/leap-ios.git.
  3. Select the 0.9.2 release (or newer).
  4. Add the LeapSDK product to your app target.
  5. (Optional) Add LeapModelDownloader if you plan to download model bundles at runtime.
The constrained-generation macros (@Generatable, @Guide) ship inside the LeapSDK product. No additional package is required.

Getting and Loading Models​

The SDK uses GGUF manifests for loading models (recommended for all new projects due to superior inference performance and better default generation parameters).
Legacy Executorch bundle support is available in the accordion below for existing projects.

Loading from GGUF manifest

The LEAP Edge SDK supports directly downloading LEAP models in GGUF format. Given the model name and quantization method (which you can find in the LEAP Model Library), the SDK will automatically download the necessary GGUF files along with generation parameters for optimal performance.
Browse the Leap Model Library and download a .bundle file for the model/quantization you want. .bundle packages contain metadata plus assets for the ExecuTorch backend.You can either:
  • Ship it with the app - drag the bundle into your Xcode project and ensure it is added to the main target.
  • Download at runtime - use LeapModelDownloader to fetch bundles on demand.
Use Leap.load(url:options:) inside an async context. Passing a .bundle loads the model through the ExecuTorch backend.

Example

Need custom runtime settings (threads, context size, GPU layers)? Pass a LiquidInferenceEngineOptions value:

Stream responses​

send(_:) (shown above) launches a Task that consumes the AsyncThrowingStream returned by Conversation.generateResponse. Each MessageResponse case maps to UI updates, tool execution, or completion metadata. Cancel the task manually (for example via stopGeneration()) to interrupt generation early. You can also observe conversation.isGenerating to disable UI controls while a request is in flight.

Send images and audio (optional)​

When the loaded model ships with multimodal weights (and companion files were detected), you can mix text, image, and audio content in the same message:

Add tool results back to the history​

Next steps​

You now have a project that loads an on-device model, streams responses, and is ready for advanced features like structured output and tool use. Edit this page