Installation
This guide covers how to install whichtime for each supported platform.
Rust
Add whichtime to your Cargo.toml for the recommended Rust API:
toml
[dependencies]
whichtime = "0.1"Then run:
bash
cargo buildIf you need the lower-level engine crate directly, install whichtime-sys instead:
toml
[dependencies]
whichtime-sys = "0.1"Swift (iOS/macOS)
Via SwiftPM
Add to your Package.swift:
swift
dependencies: [
.package(url: "https://github.com/transcodeworks/whichtime", from: "0.1.0")
]Or in Xcode:
- File → Add Package Dependencies
- Enter:
https://github.com/transcodeworks/whichtime - Add
WhichtimeCoreto your target
Build from Source
bash
cd common
./build-ios.shThis produces:
target/ios/libwhichtime-rs.xcframework— Universal framework for iOS and simulatorsswift/Sources/UniFFI/WhichTime.swift— Swift bindings
Kotlin (Android/JVM)
Kotlin support is currently a preview/source-build integration.
Build from Source
bash
cd common
./build-kotlin.shThis generates:
- Native libraries for your platform
kotlin/src/main/kotlin/works/transcode/whichtime/whichtime.kt— Kotlin bindings
Python
Python support is currently a preview/source-build integration.
Build from Source
bash
# Build the bindings
./common/build-python.sh
# Install in development mode
cd python
pip install -e .This generates:
python/whichtime/whichtime.py— Python bindingspython/whichtime/libwhichtime.dylib— Native library (or.soon Linux)
Verifying Installation
Rust
rust
use whichtime::WhichTime;
fn main() {
let parser = WhichTime::new();
println!("whichtime is ready!");
}Swift
swift
import WhichtimeCore
let parser = WhichTimeParser()
print("whichtime is ready!")Kotlin
kotlin
import works.transcode.whichtime.WhichTimeParser
fun main() {
val parser = WhichTimeParser()
println("whichtime is ready!")
}Python
python
from whichtime import WhichTimeParser
parser = WhichTimeParser()
print("whichtime is ready!")Troubleshooting
Rust: Build Errors
Ensure you have Rust 2024 edition (1.85+):
bash
rustup updateSwift: Missing XCFramework
If Xcode can't find the framework, rebuild:
bash
cd common
./build-ios.shPython: Import Errors
Ensure the native library is in the correct location:
bash
ls python/whichtime/
# Should show: whichtime.py, libwhichtime.dylib (or .so)Kotlin: UnsatisfiedLinkError
Ensure the native library is in your library path:
bash
# macOS/Linux
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/libwhichtime
# Or place the library in a standard location