Hey everyone, I am trying to add a cocoapods libra...
# multiplatform
v
Hey everyone, I am trying to add a cocoapods library to my KMP Project After Gradle Sync I am able to access the classes But there is no functions inside the class How can i fix this??? I am trying to add this cocoapod library https://github.com/PhonePe/PhonePePayment/ Code in Thread
I see only these when i Cmd+Click on the class
Copy code
// IntelliJ API Decompiler stub source generated from a class file
// Implementation of methods is not available

package cocoapods.PhonePePayment

public typealias swift_uint3 = kotlinx.cinterop.Vector128

public typealias swift_int4Var = kotlinx.cinterop.Vector128VarOf<cocoapods.PhonePePayment.swift_int4>

public typealias swift_float4 = kotlinx.cinterop.Vector128

public typealias swift_double2Var = kotlinx.cinterop.Vector128VarOf<cocoapods.PhonePePayment.swift_double2>

public typealias swift_int4 = kotlinx.cinterop.Vector128

public typealias swift_uint4Var = kotlinx.cinterop.Vector128VarOf<cocoapods.PhonePePayment.swift_uint4>

public typealias char16_tVar = kotlinx.cinterop.UShortVarOf<cocoapods.PhonePePayment.char16_t>

public typealias char32_tVar = kotlinx.cinterop.UIntVarOf<cocoapods.PhonePePayment.char32_t>

public typealias char16_t = platform.posix.uint_least16_t

public typealias swift_double2 = kotlinx.cinterop.Vector128

public typealias swift_uint4 = kotlinx.cinterop.Vector128

public typealias swift_int3 = kotlinx.cinterop.Vector128

public typealias swift_float3Var = kotlinx.cinterop.Vector128VarOf<cocoapods.PhonePePayment.swift_float3>

public typealias swift_float3 = kotlinx.cinterop.Vector128

public typealias swift_uint3Var = kotlinx.cinterop.Vector128VarOf<cocoapods.PhonePePayment.swift_uint3>

public typealias swift_float4Var = kotlinx.cinterop.Vector128VarOf<cocoapods.PhonePePayment.swift_float4>

public typealias char32_t = platform.posix.uint_least32_t

public typealias swift_int3Var = kotlinx.cinterop.Vector128VarOf<cocoapods.PhonePePayment.swift_int3>

@kotlinx.cinterop.ExperimentalForeignApi public open expect class PPPayment : platform.darwin.NSObject {
    public expect companion object : cocoapods.PhonePePayment.PPPaymentMeta, kotlinx.cinterop.ObjCClassOf<cocoapods.PhonePePayment.PPPayment> {
    }

    @kotlin.commonizer.ObjCCallable @kotlinx.cinterop.ObjCConstructor public constructor() { /* compiled code */ }

    @kotlin.commonizer.ObjCCallable @kotlinx.cinterop.ObjCMethod @kotlin.Deprecated @kotlinx.cinterop.internal.CCall.ConsumesReceiver @kotlinx.cinterop.internal.CCall.ReturnsRetained public open expect fun init(): cocoapods.PhonePePayment.PPPayment { /* compiled code */ }
}

@kotlinx.cinterop.ExperimentalForeignApi public open expect class PPPaymentMeta : platform.darwin.NSObjectMeta {
    protected constructor() { /* compiled code */ }

    @kotlin.commonizer.ObjCCallable @kotlinx.cinterop.ObjCMethod @kotlin.Deprecated public open expect fun alloc(): cocoapods.PhonePePayment.PPPayment? { /* compiled code */ }

    @kotlin.commonizer.ObjCCallable @kotlinx.cinterop.ObjCMethod @kotlin.Deprecated public open expect fun allocWithZone(zone: kotlinx.cinterop.CPointer<cnames.structs._NSZone>?): cocoapods.PhonePePayment.PPPayment? { /* compiled code */ }

    @kotlin.commonizer.ObjCCallable @kotlinx.cinterop.ObjCMethod public open expect fun new(): cocoapods.PhonePePayment.PPPayment? { /* compiled code */ }
}

@kotlinx.cinterop.ExperimentalForeignApi public open expect class DPSTransactionRequest : platform.darwin.NSObject {
    public expect companion object : cocoapods.PhonePePayment.DPSTransactionRequestMeta, kotlinx.cinterop.ObjCClassOf<cocoapods.PhonePePayment.DPSTransactionRequest> {
    }

    @kotlin.commonizer.ObjCCallable @kotlinx.cinterop.ObjCConstructor public constructor() { /* compiled code */ }

    @kotlin.commonizer.ObjCCallable @kotlinx.cinterop.ObjCMethod @kotlin.Deprecated @kotlinx.cinterop.internal.CCall.ConsumesReceiver @kotlinx.cinterop.internal.CCall.ReturnsRetained public open expect fun init(): cocoapods.PhonePePayment.DPSTransactionRequest? { /* compiled code */ }
}

@kotlinx.cinterop.ExperimentalForeignApi public open expect class DPSTransactionRequestMeta : platform.darwin.NSObjectMeta {
    protected constructor() { /* compiled code */ }

    @kotlin.commonizer.ObjCCallable @kotlinx.cinterop.ObjCMethod @kotlin.Deprecated public open expect fun alloc(): cocoapods.PhonePePayment.DPSTransactionRequest? { /* compiled code */ }

    @kotlin.commonizer.ObjCCallable @kotlinx.cinterop.ObjCMethod @kotlin.Deprecated public open expect fun allocWithZone(zone: kotlinx.cinterop.CPointer<cnames.structs._NSZone>?): cocoapods.PhonePePayment.DPSTransactionRequest? { /* compiled code */ }

    @kotlin.commonizer.ObjCCallable @kotlinx.cinterop.ObjCMethod public open expect fun new(): cocoapods.PhonePePayment.DPSTransactionRequest? { /* compiled code */ }
}
This happens with a lot of libraries out there With this library as well https://github.com/linkedin/Hakawai
f
you should write your issue in the iOS channel
the payment SDK is a binary Pod, apparently not really friendly with the cinterop
The Hakawai seem to be ok
v
@François thanks I checked the plugin, does this mean that I have to copy paste the swift files from the library to my project?
f
The plugin can’t add external dependency for now, the maintainer is currently working on it. I don’t think you can correctly use the Payment SDK from kotlin. Only method exposed here can be implemented.
v
Ahh I see Maybe It wont work Thanks
The issue i am facing is Hakawai is that, even though the CInterop works but if I implement any interface It forces me to implement some random functions
Copy code
val delegate = object: HKWMentionsDefaultChooserViewDelegateProtocol {
    override fun description(): String? {
        TODO("Not yet implemented")
    }

    //needed
    override fun asyncRetrieveEntitiesForKeyString(
        keyString: String,
        searchType: HKWMentionsSearchType,
        controlCharacter: unichar,
        completion: ((List<*>?, Boolean, Boolean) -> Unit)?
    ) {
        TODO("Not yet implemented")
    }

    //needed
    override fun cellForMentionsEntity(
        entity: HKWMentionsEntityProtocolProtocol?,
        withMatchString: String?,
        tableView: UITableView?,
        atIndexPath: NSIndexPath?
    ): UITableViewCell? {
        TODO("Not yet implemented")
    }

    override fun `class`(): ObjCClass? {
        TODO("Not yet implemented")
    }
    override fun conformsToProtocol(aProtocol: Protocol?): Boolean {
        TODO("Not yet implemented")
    }
    override fun hash(): NSUInteger {
        TODO("Not yet implemented")
    }
    override fun heightForCellForMentionsEntity(
        entity: HKWMentionsEntityProtocolProtocol?,
        tableView: UITableView?
    ): CGFloat {
        TODO("Not yet implemented")
    }
    override fun isEqual(`object`: Any?): Boolean {
        TODO("Not yet implemented")
    }
    override fun isKindOfClass(aClass: ObjCClass?): Boolean {
        TODO("Not yet implemented")
    }
    override fun isMemberOfClass(aClass: ObjCClass?): Boolean {
        TODO("Not yet implemented")
    }
    override fun isProxy(): Boolean {
        TODO("Not yet implemented")
    }
    override fun performSelector(aSelector: COpaquePointer?, withObject: Any?): Any? {
        TODO("Not yet implemented")
    }
    override fun performSelector(aSelector: COpaquePointer?): Any? {
        TODO("Not yet implemented")
    }
    override fun performSelector(
        aSelector: COpaquePointer?,
        withObject: Any?,
        _withObject: Any?
    ): Any? {
        TODO("Not yet implemented")
    }
    override fun respondsToSelector(aSelector: COpaquePointer?): Boolean {
        TODO("Not yet implemented")
    }
    override fun superclass(): ObjCClass? {
        TODO("Not yet implemented")
    }
}
This is what the CInterop has
Copy code
@kotlinx.cinterop.ExperimentalForeignApi public expect interface HKWMentionsDefaultChooserViewDelegateProtocol : platform.darwin.NSObjectProtocol {
    @kotlin.commonizer.ObjCCallable @kotlinx.cinterop.ObjCMethod public abstract expect fun asyncRetrieveEntitiesForKeyString(keyString: kotlin.String, searchType: cocoapods.Hakawai.HKWMentionsSearchType, controlCharacter: kotlin.UShort /* from: platform.Foundation.unichar */, completion: ((kotlin.collections.List<*>?, kotlin.Boolean, kotlin.Boolean) -> kotlin.Unit)?): kotlin.Unit

    @kotlin.commonizer.ObjCCallable @kotlinx.cinterop.ObjCMethod public abstract expect fun cellForMentionsEntity(entity: cocoapods.Hakawai.HKWMentionsEntityProtocolProtocol?, withMatchString: kotlin.String?, tableView: platform.UIKit.UITableView?, atIndexPath: platform.Foundation.NSIndexPath?): platform.UIKit.UITableViewCell?

    @kotlin.commonizer.ObjCCallable @kotlinx.cinterop.ObjCMethod public open expect fun entityCanBeTrimmed(entity: cocoapods.Hakawai.HKWMentionsEntityProtocolProtocol?): kotlin.Boolean { /* compiled code */ }

    @kotlin.commonizer.ObjCCallable @kotlinx.cinterop.ObjCMethod public abstract expect fun heightForCellForMentionsEntity(entity: cocoapods.Hakawai.HKWMentionsEntityProtocolProtocol?, tableView: platform.UIKit.UITableView?): kotlin.Double /* from: platform.CoreGraphics.CGFloat */

    @kotlin.commonizer.ObjCCallable @kotlinx.cinterop.ObjCMethod public open expect fun heightForLoadingCellInTableView(tableView: platform.UIKit.UITableView?): kotlin.Double /* from: platform.CoreGraphics.CGFloat */ { /* compiled code */ }

    @kotlin.commonizer.ObjCCallable @kotlinx.cinterop.ObjCMethod public open expect fun loadingCellForTableView(tableView: platform.UIKit.UITableView?): platform.UIKit.UITableViewCell? { /* compiled code */ }

    @kotlin.commonizer.ObjCCallable @kotlinx.cinterop.ObjCMethod public open expect fun trimmedNameForEntity(entity: cocoapods.Hakawai.HKWMentionsEntityProtocolProtocol?): kotlin.String { /* compiled code */ }
}
f
you need to extend your class with NSObject and the protocol
v
Ah, that worked Thanks a lot
Is this some problem from the Kotlin C-Interop side?
f
no, it’s the objc behavior.