Can some explain to me if I wanted to use Firebase...
# multiplatform
m
Can some explain to me if I wanted to use Firebase SDK for Android and IOS how I could use "expect" and "actual" to realize this? For example with Firestore.
s
Make a repo object that interfaces with Firestore and don’t expose anything Firestore related to the calling code. The expect code defines the methods available and the actual on each platform works with Firebase in the platform specific way.
c
Here's a KMP Firestore implementation that uses expect/actual with mostly extension functions : https://github.com/touchlab/FirestoreKMP
☝️ 1
m
@Chuck Greb yea first and one of 2 libraries that I have found on GitHub before asking this. The library isn't supported and the amount of code required is not worth me forking to maintain. I just want to use Rest API.
@Sam sounds good and easy for Android side but not sure how to do that with iOS side without native firebase library
@Sam could you link me an example doing this for any library?
And thanks for your help!
s
I don’t have an example. These are the docs on it. https://kotlinlang.org/docs/reference/native/cocoapods.html