top | item 45699672

(no title)

timsneath | 4 months ago

It's worth noting that this doesn't add any expectations for how your UI is built. The example shown in the screenshot continues to use Jetpack Compose (Android's native UI) with Kotlin invoking Swift business logic. You can also use other UI frameworks on Android, of course, including some that are written in Swift.

One nice thing about this implementation is that it shares many of the same characteristics as Swift on other platforms: unlike some common alternatives, it's not garbage collected but uses reference counting; it uses the same underlying libraries, concurrency primitives and memory model.

Excited to see how folk use it... it's technology that will hopefully springboard some other interesting innovations.

[Disclosure: I work on developer tools and frameworks at Apple.]

discuss

order

jitl|4 months ago

This seems great, we are looking for a code sharing language between platforms and the options so far are the Usual Suspects:

- TypeScript: we have a few million lines already, but it runs poorly on Android midrange devices.

- Rust: very efficient on Android / iOS but on web there’s very expensive memcopy between WASM memory and JS. Safe but hard to write and refactor casually. Would be great for server perf tho. Async has many footgun for our JS devs. Biggest long term downside: borrow checker speed limit on developer velocity for business logic.

- Kotlin: can target JS directly avoiding bridge cost. iOS devs are uneasy about it. Async story is extremely confusing. Biggest long term downside: how Byzantine the JVM ecosystem is on the server.

Until I saw this Swift wasn’t really in the running. I need to explore the web target situation. Swift is maturing but still weak in ecosystem on non-Apple platform compared to other options. Still swift is moving towards a great combo of speed + safety + usability.

Biggest long term downside: type inference pain. Swift is the only language I’ve used that will tell me “the types seem wrong / ambiguous, but the compiler has no idea what your specific mistake is” and there’s no way to fix it other than trying random code permutations. I hit that one with node-swift yesterday and gave up.

Is there anything in the works for taming the type inference or some way to force-select which overload I want?

wffurr|4 months ago

How does transpiration work without GC? I would think all the Kotlin equivalents would be GC heap allocated objects.