What version of Objective-C/iOS APIs are available...
# multiplatform
j
What version of Objective-C/iOS APIs are available to for a KMP project? Is it based on Kotlin/ Kotlin Multiplatform plugin version? I’m wondering if I can write some Kotlin code in /iosMain source set to access the
UiTraitCollection
and read
horizontalSizeClass
and
verticalSizeClass
.
👀 1
a
UiTraitCollection
is a very old API(introduced for
ios 8
) and is supported by any reasonably fresh kotlin (any 2.* would suffice) As for the original question - the SDK version used is defined by your xcode project, and the API bindings are bundled with kotlin version. For example, kotlin 2.4.20 comes with sdk 26.4 bundled, kotlin 2.3.0 comes with sdk 26.0 bundled. Kotlin 2.5.0 would bundle sdk 27. You can use kotlin 2.4.20 with xcode 27, our internal testing has not found problems with this combination. If there are problems - please report those, so we would be able to fix them 🙂
j
What exactly is an API binding?
a
Prebuilded cinterop libraries that come with the compiler, that allows one to call from Kotlin into Objective-C defined platform libraries.
j
So, even if I set my SDK version higher in Xcode, for same example 27.1, I cannot call new APIs because of the hight supported API binding is sdk 26.0?
a
For those fresh APIs one would have to either wait for kotlin 2.5.0, or use a technic we call Reverse Import