Hi, I would like to get a clarification on Kotlin ...
# multiplatform
r
Hi, I would like to get a clarification on Kotlin Multiplatform support for iOS dependencies. From this page https://kotlinlang.org/docs/multiplatform-ios-dependencies.html, it states that we can import iOS dependencies through exported Objective-C. However, this page https://kotlinlang.org/docs/native-objc-interop.html states that "The Objective-C libraries import is Experimental." I would like to confirm if this experimental import applies to adding iOS dependencies.
Following up on this. Would anyone happen to know?
r
Yes the docs are correct. When you add an ObjC dependency you’ll need to OptIn on the
ExperimentalForeignApi
.
And like the second link mentions: the default platform libraries such as Foundation don’t have this requirement
r
So adding any iOS dependencies is considered experimental?
r
Yes. In general the “Kotlin/Native interop with C and Objective C” is in beta: https://kotlinlang.org/docs/components-stability.html#current-stability-of-kotlin-components
Also the documentation from the OptIn annotation contains more details about why it’s considered experimental: https://github.com/JetBrains/kotlin/blob/c1d181b979b80fc8ed9196c621aeaec4c9eee246/kotlin-native/Interop/Runtime/src/main/kotlin/kotlinx/cinterop/Annotations.kt#L42-L60
thank you color 1