Hey guys I need help in ios code. I have ```class ...
# ios
v
Hey guys I need help in ios code. I have
Copy code
class KtorCountryApi : NetworkRoute(), KoinComponent {

    private val httpClient by inject<HttpClient>()

    suspend fun getCountry(): ApiResponse<KtorCountriesResponse> {
        val response = httpClient.get {
            url("xyz")
        }
        return apiCall(response)
    }
}
NetworkRoute
Copy code
open class NetworkRoute {
    suspend inline fun <reified T : Any> apiCall(httpResponse: HttpResponse): ApiResponse<T> {
        return try {
            ApiResponse.Success(httpResponse.body())
        } catch (e: Exception) {
            ApiResponse.Error()
        }
    }
}
when I am calling in ios code
Copy code
let ktorApi = KtorCountryApi()
    ktorApi.getCountry()
I am getting weird issue
'async' call in a function that does not support concurrency
r
suspend
Kotlin functions are exposed as the Swift
async
thingies, so you need to use that on the Swift side https://docs.swift.org/swift-book/LanguageGuide/Concurrency.html
v
thanks Gael