Skip to content

Releases: AniCanon/swift-android-codegen

v0.4.0

Choose a tag to compare

@rmenezes rmenezes released this 26 Sep 21:24
032732d

Streams: AsyncStream → Kotlin Flow

  • A non-async @AndroidBridge protocol requirement returning AsyncStream<T> or AsyncThrowingStream<T, Error> becomes a cold Flow<T> on the generated bridge.
  • New StreamObservation<Element> in SwiftAndroidCodegen: pull-based next() / cancel() over any AsyncSequence.
  • bridge-gen --swift-output-dir / Gradle swiftOutputDir: writes <P>+AndroidStreams.swift (commit it; add the directory to jextract's swiftFilterInclude; run generateSwiftAndroidBridges before jextract).
  • Runtime: observationFlow(open, next, cancel). Completion, first()/take() and collector cancellation all call the Swift cancel() 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

Choose a tag to compare

@rmenezes rmenezes released this 09 Aug 20:44

Bugfix release.

  • Unwrap Optional returns in generated Kotlin bridges. swift-java binds a Swift T? return as CompletableFuture<Optional<T>>, but the emitter annotated the bridge method as T? 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 @AndroidBridge method, 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

Choose a tag to compare

@rmenezes rmenezes released this 16 Jun 15:38

Bugfix release.

  • Only pass a SwiftArena argument for bridge returns that wrap Swift objects. Previously the Kotlin bridge emitter appended an arena to every non-void call, which failed to resolve for String/primitive/[String] returns (no arena accessor overload exists). Fixes generated bridges for methods like -> [String] (#2).

v0.2.1

Choose a tag to compare

@rmenezes rmenezes released this 09 Apr 23:01
b97e325

What's Changed

New Contributors

Full Changelog: v0.2.0...v0.2.1

v0.2.0

Choose a tag to compare

@rmenezes rmenezes released this 03 Apr 12:10

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 generateSwiftAndroidBridges

This 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 generateSwiftAndroidBridges step to setup instructions
  • Updated runtime dependency version reference

Housekeeping

  • Added .build/ and root Package.resolved to .gitignore

Full Changelog: v0.1.0...v0.2.0

v0.1.0

Choose a tag to compare

@rmenezes rmenezes released this 02 Apr 23:09

Initial release: Swift-to-Android bridge code generator.

  • Swift macro @AndroidBridge for 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 init methods