Skip to content

Add oxbitnet-swift — Swift bindings via C FFI#12

Merged
m96-chan merged 1 commit into
mainfrom
feat/swift
Feb 21, 2026
Merged

Add oxbitnet-swift — Swift bindings via C FFI#12
m96-chan merged 1 commit into
mainfrom
feat/swift

Conversation

@m96-chan

Copy link
Copy Markdown
Owner

Summary

  • Add oxbitnet-swift SPM package wrapping oxbitnet-ffi with idiomatic Swift APIs
  • AsyncThrowingStream<String, Error> for token streaming (for try await pattern)
  • Async + sync model loading, cooperative cancellation, thread-safe handle via NSLock + GCD
  • Vendored C header + modulemap for standalone SPM consumption
  • CLI chat example in Examples/Chat/
  • Updated root README with Swift quick start, install, API table, example, and architecture entry

Test plan

  • cargo build -p oxbitnet-ffi --release produces liboxbitnet_ffi
  • swift build -Xlinker -L../../../../target/release compiles the Swift package
  • swift run -Xlinker -L../../../../target/release Chat model.gguf "Hello!" runs the example
  • Verify AsyncThrowingStream cancellation stops token generation
  • Verify dispose() is safe to call multiple times and from deinit

Closes #6

🤖 Generated with Claude Code

Wraps oxbitnet-ffi with idiomatic Swift: async/await loading,
AsyncThrowingStream token streaming, cooperative cancellation,
and thread-safe handle management via NSLock + GCD.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@m96-chan m96-chan merged commit afd5bfb into main Feb 21, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Swift bindings (oxbitnet-swift)

1 participant