Would this sample code below still be considered a...
# multiplatform
i
Would this sample code below still be considered as the best practice for consuming asynchronous functions from the shared module? Inspired by: https://github.com/kotlin-hands-on/kmm-networking-and-data-storage/tree/final
Copy code
// Shared.kt
@Throws(Exception::class)
suspend fun getSomething(param: SomeParam): Result<Something> {
    // Some implementation.
}
Copy code
// iosAppViewModel.swift
func getSomething(param: SomeParam) {
    Shared().getSomething(param: param, completionHandler: { [weak self] result, error in
        if let result = result {
            // Do something with result.
        } else if let error = error {
            // Do something with error.
        }
    })
}
Copy code
// androidAppViewModel.kt
fun getSomething(param: SomeParam) {
    viewModelScope.launch {
        kotlin.runCatching {
            Shared().getSomething(param)
        }.onSuccess { result ->
            // Do something with result.
        }.onFailure { error ->
            // Do something with error.
        }
    }
}
Thank you!