In swift, the code check availability of APIs on different version.
if #available(iOS 14.0, *) {
// Do something for iOS 14.0 and later
} else {
// Fallback on earlier versions
}
How can I implement it in Kotlin Multi Platform (iOS)?
I can't find the way to check APIs iOS availability in KMM
In your ios-specific sourceset, you can try something like this:
import platform.UIKit.UIDevice
// Etc
fun systemVersion() = UIDevice.currentDevice.systemVersion
I haven't tried this, but got the Swift version from https://stackoverflow.com/a/58080004/227313 and that's the Kotlin version of how you'd call it.
If you want to get that value in common code, you can do an expect/actual function.