in kotlin native, can we use NSURL for the network...
# multiplatform
t
in kotlin native, can we use NSURL for the network stack? (trying to find ktor alternative)
t
Thanks Nikolay!
s
One gotcha to be aware of is that NSURLSession will call your call back on a background thread. It is up to you to switch over to the main thread (GCD or other mechanism).
t
Is there a way to set the NSURLRequest.HTTPMethod to "GET"?
oh! that is very nice to know @Sam. thank you for that bit!
Ah! There is a NSMutableURLRequest... 😢
s
That's a common pattern with the Cocoa frameworks.
t
very interesting. how did you figure that out?
s
I came to Kotlin after doing over 5 years of iOS development. It's just one of those things you learn when learning Obj-C.
t
ahhhh! i'm glad you told me about that quirk about NSURLSessions
👍 1
If my dispatcher for my coroutine is dispatch_get_main_queue(), do I need to bring it to the main thread when I use NSURLSession?