From cdbbff9dbbb616586a07ed244dadfa64ca03b802 Mon Sep 17 00:00:00 2001 From: jguz-pubnub Date: Thu, 19 Sep 2024 08:43:18 +0200 Subject: [PATCH] Added @ObjCName annotation and helper constructor (iOS) --- .../src/iosMain/kotlin/com/pubnub/api/PubNubImpl.kt | 6 ++++++ .../src/nonJvm/kotlin/com/pubnub/api/PubNub.nonJvm.kt | 3 +++ swift | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/pubnub-kotlin/pubnub-kotlin-api/src/iosMain/kotlin/com/pubnub/api/PubNubImpl.kt b/pubnub-kotlin/pubnub-kotlin-api/src/iosMain/kotlin/com/pubnub/api/PubNubImpl.kt index 24503d37b..845dec771 100644 --- a/pubnub-kotlin/pubnub-kotlin-api/src/iosMain/kotlin/com/pubnub/api/PubNubImpl.kt +++ b/pubnub-kotlin/pubnub-kotlin-api/src/iosMain/kotlin/com/pubnub/api/PubNubImpl.kt @@ -152,6 +152,12 @@ class PubNubImpl(private val pubNubObjC: KMPPubNub) : PubNub { ) ) + companion object { + fun create(kmpPubNub: Any): PubNubImpl { + return PubNubImpl(kmpPubNub as KMPPubNub) + } + } + override val configuration: PNConfiguration = createPNConfiguration( UserId(pubNubObjC.configObjC().userId()), "", // todo diff --git a/pubnub-kotlin/pubnub-kotlin-api/src/nonJvm/kotlin/com/pubnub/api/PubNub.nonJvm.kt b/pubnub-kotlin/pubnub-kotlin-api/src/nonJvm/kotlin/com/pubnub/api/PubNub.nonJvm.kt index 587bfeb9f..15d6dee02 100644 --- a/pubnub-kotlin/pubnub-kotlin-api/src/nonJvm/kotlin/com/pubnub/api/PubNub.nonJvm.kt +++ b/pubnub-kotlin/pubnub-kotlin-api/src/nonJvm/kotlin/com/pubnub/api/PubNub.nonJvm.kt @@ -72,7 +72,10 @@ import com.pubnub.api.v2.subscriptions.SubscriptionOptions import com.pubnub.api.v2.subscriptions.SubscriptionSet import com.pubnub.kmp.CustomObject import com.pubnub.kmp.Uploadable +import kotlin.experimental.ExperimentalObjCName +@OptIn(ExperimentalObjCName::class) +@ObjCName("PubNubInterface") actual interface PubNub { actual val configuration: PNConfiguration diff --git a/swift b/swift index 725893b39..59ce8fe77 160000 --- a/swift +++ b/swift @@ -1 +1 @@ -Subproject commit 725893b39e128db689f79ff2fa08d246f8c3530b +Subproject commit 59ce8fe77aad1747208864e6eafba353a1a15199