https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
b

Brian

11/02/2018, 9:39 AM
Hey! I'm trying to access types and methods of the stdlib (specifically:
Sequence
) from Swift. It seems, that the generated framework headers only include definitions for my code but misses a lot from the stdlib. So there actually is the compiled
KotlinSequence
accessible but all the factory and extension functions are not -- which renders it pretty useless. Is there a way, to make some or all types and methods available in a compiled native xcode framework? Any hints are much appreciated! See also my question on stackoverflow: https://stackoverflow.com/questions/53103956/access-kotlin-standard-library-from-swift
s

svyatoslav.scherbina

11/02/2018, 12:27 PM
The only option available currently for extensions and factories is to add simple wrappers for these functions to your module, e.g.
Copy code
fun <T : Any> generateSequence(nextFunction: () -> T?): Sequence<T> = kotlin.sequences.generateSequence(nextFunction)
👍 1
b

Brian

11/02/2018, 12:33 PM
Oh ok. Actually that’s what I started with. But that felt like too much boilerplate to write
Wouldn’t it be possible, somehow, to add definitions to the headers? Maybe via a Gradle config?
… or maybe let me ask my last question differently 😉 : is this something that will be improved in the future?
s

svyatoslav.scherbina

11/02/2018, 2:49 PM
We have no specific plans for improving experience in this particular case with
Sequence
.