Skip to content

Platform Support

Oliver Atkinson edited this page May 31, 2026 · 1 revision

Platform Support

Lexicon is verified on macOS and Linux with SwiftPM tests. CI also runs tests on an Android emulator and cross-builds Android ARM64.

Package Requirements

The package currently declares:

  • Swift tools version 6.3
  • Swift language mode 6
  • macOS 15
  • iOS 18

macOS and iOS

On Apple platforms, Lexicon.Graph.from(sentences:) can use NaturalLanguage for tokenization and lexical classes.

The base Swift package and CLI work normally on macOS. MLX semantic search is also intended for Apple platforms.

Linux

Linux builds use a deterministic fallback for sentence graph generation where NaturalLanguage is unavailable. The API remains available, but lexical-class behavior is simpler than Apple's NaturalLanguage implementation.

Android

Android support is verified in two ways:

  • cross-compiling the package with the official Swift SDK for Android
  • running SwiftPM tests on an Android API 28 emulator

Cross-build commands:

swift build --swift-sdk aarch64-unknown-linux-android28 --static-swift-stdlib
swift build --swift-sdk x86_64-unknown-linux-android28 --static-swift-stdlib

The Android test job uses the emulator harness from skiptools/swift-android-action because SwiftPM cross-compilation alone builds the test runner but does not execute it on an Android runtime.

Search Providers

Search can run without semantic embeddings:

swift run lexicon search commerce.lexicon submit order --embedding-provider none

Semantic search can use system support where available or MLX when the CLI is built with the MLXSearch package trait:

swift run --traits MLXSearch lexicon search commerce.lexicon "order submit" \
	--embedding-provider mlx \
	--embedding-model TaylorAI/bge-micro-v2

MLX document embeddings are cached under the user cache directory by default. Use --embedding-cache and --rebuild-embeddings to control cache behavior.

CI Guidance

For ordinary pull requests:

swift test -Xswiftc -warnings-as-errors
swift build --product lexicon -Xswiftc -warnings-as-errors
swift build --product lexicon-generate -Xswiftc -warnings-as-errors
swift build --product lexicon-lsp -Xswiftc -warnings-as-errors

For concurrency-focused checks:

swift test -Xswiftc -strict-concurrency=complete -Xswiftc -warnings-as-errors

Clone this wiki locally