Aman Shaikh
08/15/2025, 12:05 AMexpect/actual
.
For example, I want my common code to have something like:
expect class GoogleAuthProvider constructor(context: Any) {
suspend fun signIn(): GoogleAccount?
suspend fun signOut()
}
If I were using CocoaPods, I could do something like this in `iosMain/GoogleAuthProvider.ios.kt`:
import cocoapods.GoogleSignIn.GIDSignIn
import com.peliplat.mobile.data.model.auth.socialAuth.GoogleAccount
GIDSignIn.sharedInstance.signInWithPresentingViewController(rootViewController)
That works because CocoaPods dependencies are automatically available to Kotlin via the cocoapods.*
import.
But in the case of SPM, I’m not sure:
• How can I import the SPM dependency (Google Sign-In) so that I can call its APIs in iosMain
Kotlin code?
• Do I need to create a Swift wrapper for SPM dependencies and then expose them to Kotlin?
• What is the recommended way to implement the actual
class in KMP when using SPM instead of CocoaPods?
I’m new to KMP, so any guidance or examples would be super helpful 🙏
Cc: @OrlandoPablichjenkov
08/15/2025, 12:50 AMAman Shaikh
08/15/2025, 7:20 PMDumitru Preguza
08/18/2025, 1:23 PMAman Shaikh
08/25/2025, 4:49 PM