Wednesday, September 10, 2025
HomeiOS Developmentios - Calling native Swift perform from Kotlin Multiplatform shared code

ios – Calling native Swift perform from Kotlin Multiplatform shared code


I am making an attempt to implement Firebase Cloud Messaging on a Kotlin Multiplatform venture. Every thing goes nice aside from the iOS half.

I’ve some shared code:

count on droop enjoyable getFCMToken(): String?;

And within the Android venture, I take advantage of precise for a correct implementation and it really works. For the iOS code, within iosApp, I arrange every thing appropriately, I added this following implementation:

@objc static func getFCMToken() -> String? {
   return Messaging.messaging().fcmToken
}

Nevertheless, I’ve been making an attempt to get the shared code to work and name the native Swift code with no luck.

I’ve tried placing the perform in a category and calling that class within iosMain kotlin code. I’ve tried Bridging Header. Each with no luck.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments