-
Notifications
You must be signed in to change notification settings - Fork 37
Open
Milestone
Description
Currently the whole library is focused on Kotlin to Swift cases but there are also valid cases for Swift to Kotlin support.
For example you should be able to call the following function from Swift:
suspend fun doSomething(something: suspend (String) -> String): String = TODO()
https://kotlinlang.slack.com/archives/C3PQML5NU/p1644904527044239
chris-hatton
Metadata
Metadata
Assignees
Labels
No labels
Projects
Milestone
Relationships
Development
Select code repository
Activity
Merge branch 'master' into feature/GH-42-swift-to-kotlin-wrappers
Merge branch 'master' into feature/GH-42-swift-to-kotlin-wrappers
rickclephas commentedon Apr 22, 2022
Some thoughts about Swift implementations of Kotlin classes/interfaces.
Kotlin code:
Generated Kotlin code:
Swift code:
Note: this won't work because
A
is an interface and doesn't expose the extension functions like this.Support for interfaces is limited anyway because ObjC doesn't support default implementations.
Note: this way calling the Swift implementations from Swift will convert from async to
NativeSuspend
and back to async.To fix that we would need an extension/wrapper function in Swift that can directly call the async version instead.
That would need some kind of Swift codegen (during Kotlin compile) to make this easy to use.
chris-hatton commentedon Jul 28, 2023
Just dropping a note to say I too arrived here looking for a library to help with consuming a Swift ASyncStream from Kotlin/Native.
Merge branch 'master' into feature/GH-42-swift-to-kotlin-wrappers
Merge branch 'master' into feature/GH-42-swift-to-kotlin-wrappers
davidgarywood commentedon Jul 18, 2024
Me too! Does anything like this exist ?
Merge branch 'master' into feature/GH-42-swift-to-kotlin-wrappers
Merge branch 'master' into feature/GH-42-swift-to-kotlin-wrappers
Merge branch 'master' into feature/GH-42-swift-to-kotlin-wrappers
l2hyunwoo commentedon Feb 6, 2025
Hello, any updates in here?