Repository navigation
Releases: AniCanon/swift-android-codegen
Release list
v0.4.0
Streams: AsyncStream → Kotlin Flow
- A non-async
@AndroidBridgeprotocol requirement returningAsyncStream<T>orAsyncThrowingStream<T, Error>becomes a coldFlow<T>on the generated bridge. - New
StreamObservation<Element>inSwiftAndroidCodegen: pull-basednext()/cancel()over anyAsyncSequence. bridge-gen --swift-output-dir/ GradleswiftOutputDir: writes<P>+AndroidStreams.swift(commit it; add the directory to jextract'sswiftFilterInclude; rungenerateSwiftAndroidBridgesbefore jextract).- Runtime:
observationFlow(open, next, cancel). Completion,first()/take()and collector cancellation all call the Swiftcancel()exactly once. - Streams are bridged on protocols only. Unsupported shapes are skipped with a warning.
Consumers: generated Swift is unguarded, so every platform that builds the shared package needs this version of the SwiftAndroidCodegen library. Bump the Swift package, the Gradle plugin and the runtime together.
v0.2.3
Bugfix release.
- Unwrap
Optionalreturns in generated Kotlin bridges. swift-java binds a SwiftT?return asCompletableFuture<Optional<T>>, but the emitter annotated the bridge method asT?and returned the awaited value unchanged, so the generated source did not compile. Optional returns now append.orElse(null), alongside the existing.toByteArray()/.toList()conversions. Surfaced by the first optional-returning@AndroidBridgemethod,QuickCreateClient.latest()(#5).
Known limitations, unchanged by this release: [T]? and Data? returns still emit the wrong conversion, and optional primitives would need OptionalLong/OptionalInt/OptionalDouble handling if swift-java binds them that way. No bridged method hits either case yet.
v0.2.2
Bugfix release.
- Only pass a
SwiftArenaargument for bridge returns that wrap Swift objects. Previously the Kotlin bridge emitter appended an arena to every non-void call, which failed to resolve forString/primitive/[String]returns (no arena accessor overload exists). Fixes generated bridges for methods like-> [String](#2).
v0.2.1
v0.2.0
What's Changed
On-demand codegen workflow
Bridge generation is now an explicit, on-demand step rather than running at build time. Generated Kotlin files are committed to source control and compiled as normal sources — no codegen runs during assembleDebug.
./gradlew generateSwiftAndroidBridgesThis follows the same pattern as jOOQ and similar tools: you regenerate when your Swift API changes, review the diff, and commit.
Stored instance pattern
Each bridge now creates its SwiftArena.ofAuto() and Swift instance once at construction time as stored properties, reusing them across all method calls. This avoids per-call allocation overhead while keeping memory safe — the auto arena ties Swift object lifetimes to Java GC reachability.
Documentation
- Updated setup guide to reflect the on-demand workflow
- Documented
SwiftArena.ofAuto()lifecycle semantics - Added explicit
./gradlew generateSwiftAndroidBridgesstep to setup instructions - Updated runtime dependency version reference
Housekeeping
- Added
.build/and rootPackage.resolvedto.gitignore
Full Changelog: v0.1.0...v0.2.0
v0.1.0
Initial release: Swift-to-Android bridge code generator.
- Swift macro
@AndroidBridgefor annotating Swift types - Gradle plugin generates Kotlin bridge classes from swift-java Java bindings
- Arena parameter hiding (uses default auto-arena)
- Optional return type → nullable Kotlin type mapping
- Kotlin factory functions for swift-java
initmethods