hooliooo
06/21/2019, 9:50 AMfun someAPIRequest(input: String, callback: (SomeModel?, SomeError?) -> Unit) {
....
}
From what I read, Kotlin Native interoperability to iOS is Kotlin => Objective-C => Swift, correct? To change that into a Result type I’d implement something like:
sealed class SomeResult<T, E> {
data class Success<T, E>(val value: T): SomeResult<T, E>()
data class Failure<T, E>(val value: E): SomeResult<T, E>()
}
fun someAPIRequest(input: String, callback: (SomeResult<SomeModel, SomeError>) -> Unit) {
....
}
But then, I’d have to typecast in Swift, correct? I wouldn’t be able to leverage the Swift Result type because it’s a language feature right?kpgalligan
06/21/2019, 10:03 AM