Is it true that only pure Objective-C cocoapods ca...
# multiplatform
a
Is it true that only pure Objective-C cocoapods can be included in a KMM project? I found this Starscream library for WebSockets, it seems very popular among iOS developers but it's written in Swift.
nope 1
I have Android covered with OkHttp websockets and also want this for iOS done while keeping the same experience by using IntelliJ and Kotlin
m
I know that doesn't really answer your question but you can also do WebSockets with
NSURLSessionWebSocketTask
on iOS 13+
(which removes the Starscream dependency)
a
@mbonnin I'm already using it, it's available right out of the box... but, I didn't manage to get a callback or notified in any other way when the connection drops or when I turn off Wi-Fi. That's a deal breaker and that's why I need another solution
m
Ouch, yea, that hurts
s
If the Swift pod exposes an interface for objC, it can be used from Kotlin. You also could write a wrapper in Swift that provides an ObjC interface.
k
the API that kotlin uses to bridge must be objective-C
or C
z
does the documentation cover an example of bridging? or does someone have an article example?
k
the libcurl sample in the K/N samples repo
👍 1
a
Starscream use
URLSessionWebSocketTask
under the hood anyway, you can take a look at how they use it internally.
m
@Antoine Lamy
Starscream works with iOS 8/10.10
How can it use
URLSessionWebSocketTask
that's only available with iOS 13+ ?
l
It probably uses multiple APIs
m
Then I'm wondering what you get by using the
URLSessionWebSocketTask
"backend", I guess smaller binary size
a
On iOS 12+ they use
NWConnection
and bellow that they use Foundation
CFReadStream
👍 1