https://kotlinlang.org logo
#ktor
Title
# ktor
r

ribesg

03/01/2019, 12:26 PM
So what do you do when using Ktor client from iOS, as coroutines don’t really work in Swift? Do you use RxSwift to create Observables? We’re basically creating a MPP implementation of a microservice, and I’m wondering what a get request for a resource should return to work asynchronously
Should I use something like
Deferred<Result<MyResourceType>
as return type?
s

Sam

03/01/2019, 4:10 PM
I’m not sure that will work. In the past I have created wrapper methods that took completion blocks in Kotlin and those methods called the suspending functions. You can wrap them in RxSwift easily enough with Observable.create() where the observable.onNext and onComplete get called within the completion block.
3 Views