Mehdi
01/16/2019, 9:47 AMMehdi
01/16/2019, 9:50 AM540grunkspin
01/16/2019, 10:21 AMresult
variable?Mehdi
01/16/2019, 10:48 AMMehdi
01/16/2019, 10:53 AMMehdi
01/16/2019, 10:54 AM540grunkspin
01/16/2019, 1:13 PMfun getResponse(lat: Double, long: Double): Deferred<Result<ForecastResponse>>{
return async (<http://Dispatchers.IO|Dispatchers.IO>) {
requestForecast(lat, long)
}
}
and then
launch (Dispatchers.Main) {
val response = inst.getResponse(37.8267, -122.4233).await()
}
540grunkspin
01/16/2019, 1:21 PMdave08
01/17/2019, 3:26 AMwithContext(<http://Dispatchers.IO|Dispatchers.IO>) { }
if you await at the same time as calling. It comes out to the same and is more efficient. @540grunkspin540grunkspin
01/17/2019, 8:44 AMwithContext
Mehdi
01/17/2019, 4:26 PM540grunkspin
01/17/2019, 5:37 PM