Obviously probably not possible to answer this exa...
# kotlin-native
j
Obviously probably not possible to answer this exactly at this point but roughly when should we hope to see direct Swift interop.....I know it's in postponed column still in https://kotlinlang.org/docs/roadmap.html#roadmap-details but seems to be feature many people are clamouring for
🙏 4
k
It's a long discussion, but I'm not sure it'll solve the issues people would like to solve. To me the big missing features are structs and enums with associated data. Swift interop won't provide either. Also, there are unexpected problems. Generics support will be tricky. I'm a little rusty on the details, but Swift generics don't support variance, and you can't really cast around it (you can cast around generics incompatibility if it's Objc). However, I do think it'll help with binary size, as the objc adapter binary (not sure what it's called by the team) is relatively heavy. Maybe also performance? I haven't looked at the async/await support in swift yet, so can't comment.
It's not to say that I'm uninterested or I don't think it's good, but it's one of those things that sounds great, but then you get it and you still have mostly the same problems 🙂
j
It may not help that much with the async/await either....at least not directly.....it could be that some boiler plate code still would need to be generated for this to manage for example associated scope and perhaps somehow mapping that to Swift
task
with associated cancellation behaviour.
k
We're getting into Swift gen in a fairly significant way to help improve the dev experience. Working on packaging now. Can't really use the default cocoapods support, at least not easily. Anyway, may be able to generate some adapter code for async, if that helps.
j
seems like some kind of mapping could be done from async/await to kotlin suspend functions....and then perhaps Combine (or AsyncStream when that becomes available) to Kotlin Flows. The latter has been done in a few places but be nice to standardise somewhat if possible.....the async/await I'm not fully sure about yet
k
The Flows to Combine or RxSwift (or whatever) has been in the discussions for a while. Russell's been working on that some, sort of thinking through it in code. There's some generics and casting boilerplate involved IIRC, which would be the target for Swift gen. There are other projects living in this space, but they all feel a bit too "comprehensive". We're trying to nail down the core part then add around it rather than have a big "thing", but currently focused on the packaging part and other issues, so the "reactive bridge" thing has been on hold for a bit.
👍 1
I also want to catch up on the discussion around Compose and ViewModel and state management in general. We're not doing compose in prod yet, but I think we're starting a greenfield thing soon and will likely be giving it a shot there.
I know these things aren't exactly related, but the "reactive bridge" also needs a lifecycle management component on the iOS side, which inevitably looks a little like ViewModel, but that's all turning into a big argument on the Android side. Anyway, not a Friday kind of problem 🙂
j
yeah, there's been some "interesting" discussions around that recently 🙂
m
One of the big issues I have is not being able to have Kotlin interop with Swift libraries easily.
1