I’m working on a Kotlin Multiplatform project and need to integrate Okta for authentication. I’ve successfully implemented the functionality for Android using file.android.kt
, but I’m encountering issues with the iOS part.
The problem is that I need to either import the Okta iOS library into a file.ios.kt
file to run platform-specific functions, or somehow call Okta functions defined in Swift from this Kotlin file. However, Kotlin Multiplatform doesn’t allow directly importing Swift or Objective-C libraries into a .ios.kt
file.
The solutions I’ve considered so far are:
- Import the Okta iOS library directly into
file.ios.kt
. - Create a Swift class that handles the Okta functionality and call its methods from
file.ios.kt
.
Currently, I’m leaning towards the second approach: creating a Swift class that uses Okta and exposing its functions to Kotlin using interoperability. However, I’m wondering if there’s a more efficient way or if anyone has successfully imported the Okta SDK directly into a .ios.kt
file.
Any advice or solutions would be greatly appreciated. Thanks!