SDK 4.0 Apple quick start

SDK 4.0 on iOS and macOS: the install line, App Attest, where the model comes from, and what changes from 3.x.

SDK 4.0 for iOS and macOS is the same Swift package as 3.x, TajweedFormer from github.com/Quran-Lab/tajweedformer-apple, with the Quran Lab Core inside it (iOS 15 and macOS 12, on Apple silicon). The calls are the ones of 3.x.

Install

// Package.swift, or in Xcode: File > Add Package Dependencies
.package(url: "https://github.com/Quran-Lab/tajweedformer-apple", from: "4.0.0")
// product TajweedFormer

import TajweedFormer

SwiftPM fetches the Core, QuranLabCore.xcframework, with the package and checks it against the checksum in the package's manifest. Leave it as it is beyond Xcode's own signing: the Core checks its own code, and a changed Core gets no lease.

What changes for an Apple app

The calls stay those of 3.x: TajweedClient(key:), client.model(), model.listen() and chunk.decoded.

  • The Core. The engine, the model's formats and its keys move into Quran Lab's closed Core, which ships with the package. The model is downloaded encrypted, installed for this install, and opened only by the Core, in its memory.
  • The model downloads when your app asks for it. Making the Client downloads nothing: the model downloads at the first client.model() or client.prefetch(), and once more after the upgrade, so that first call needs a connection. Call client.prefetch() where you want the model on the device before the first take.
  • The install's key is made in the Secure Enclave. On a Mac without one, and in the Simulator, it is a key in the device's Keychain, and the SDK says so.
  • App Attest makes an install hardware-verified. With App Attest on a production key, an install is of the class that may use the Neural Engine, and its shared recordings upload; without it, or with a development key, it runs on the CPU and is never locked out. Every install gets its lease either way: learners can use the model offline for days at a time (the exact time is set by Quran Lab and may change). Add the App Attest capability to your app's target. Offline use and the lease
  • The Simulator needs a development key. Quran Lab leases the Core's Simulator build to development keys only.
  • Remove the analytics parameter of TajweedClientOptions if you set it: anonymous analytics are always on in 4.0.
  • Remove the audience parameter of TajweedClientOptions if you set it: every app shows the same sharing sheet in 4.0, and client.sharing.setOn(_:) takes the learner's switch alone. Code that sets the removed parameters no longer compiles.
  • The Neural Engine is still tested against the CPU engine before it is used, now by the Core, and only when the lease allows it. It needs iOS 18 or macOS 15, and is never tried in the Simulator.
  • Privacy manifests. The package's manifests now also declare crash data (not linked to the learner, not used for tracking) and the boot clock, which the lease reads. Check your App Store privacy answers against them.

What changes from 3.x has what changes in every SDK.