Swift

UForm for Swift

UFORM_SWIFT_ARTIFACT=build_swift/UFormC.xcframework swift build 4.0.0-rc.1 · 3ee5e534

It requires Swift 6.2 or newer, on macOS 15, iOS 18, tvOS 18, watchOS 11, visionOS 2, or Linux. Models are tokenizer-free, so the package has no dependencies beyond the C library: text crosses as UTF-8 bytes, media as encoded files or decoded samples.

Topics

Installation1The package compiles the Swift surface only.
Quickstart
Receivers and Deferred Calls21The receiver chooses where a verb runs and how it completes, and the verb stays the same.
Executors80A model says where its weights live; an Executor says who runs the calls on them.
Arenas2Every output whose length scales with the call - pooled embeddings, per-token states and their offsets - lands in an Arena you pass, and the verb answers views over it without copying.
Encoding58
Choices7textChoose scores each text's legal choices, one byte each, through one forward of the byte decoder, a softmax over that item's choices alone at its question type's calibrated inverse temperature.
Models24Residency is the constructor's name, as in the C lifecycle verbs, so a residency a build lacks has no constructor to call.
Training122Training is GPU-only, so every constructor takes a VRAM executor, and the trainer's verbs block on it.
Errors22UFormError is the only error the SDK throws, and every method says so with throws(UFormError), so a catch reads error.status with no cast.
Design