# swift-runtime
A safe Rust interface to the Swift runtime, over
[`swift-runtime-sys`](https://crates.io/crates/swift-runtime-sys): metadata
lookup and inspection, reference counting, dynamic casts and type names, with the
pointer arithmetic and the lifetime rules kept on this side of the boundary.
```rust
use swift_runtime::metadata::Metadata;
// `from_raw` rejects null, and everything after it is safe: the kind, the size
// and stride, and whether the type is POD all come from the value witness table.
if let Some(m) = Metadata::from_raw(raw) {
println!("{:?} — {} bytes, stride {}", m.kind(), m.size(), m.stride());
}
```
[`swiftui-native`](https://crates.io/crates/swiftui-native) is what this was built
for: SwiftUI driven entirely from Rust.
## Requirements
* arm64 macOS or iOS. The Swift 6.3+ runtime ships with the OS.
* Rust 1.82 or newer.
## Licence
GPL-3.0. See [the repository](https://github.com/eugenehp/rswift).