kpgalligan
07/27/2021, 11:59 PM@ObjCMethod
annotation. We've been doing some experiments with cinterop and can successfully link and call to objc methods. As a concrete example, on iOS the objc class for Crashlytics is FIRCrashlytics
. We only care about getting the global instance and logging a string, so after seeing what cinterop does, we just made this Kotlin class. It'll successfully link to the objc, and calls the methods as we expect.
@ExternalObjCClass
open class FIRCrashlytics : NSObject() {
@ExternalObjCClass
companion object : NSObjectMeta(), ObjCClassOf<FIRCrashlytics> {
@ObjCMethod("crashlytics", "@16@0:8")
external fun crashlytics(): FIRCrashlytics
}
@ObjCMethod(selector = "log:", encoding = "v24@0:8@16")
open external fun log(msg: String)
}
kpgalligan
07/28/2021, 12:01 AMkpgalligan
07/28/2021, 12:03 AMMichal Klimczak
08/18/2021, 6:15 AMkpgalligan
08/18/2021, 12:48 PMkpgalligan
08/18/2021, 12:50 PMencoding
does)