Ryan Simon
02/13/2020, 6:42 AMAny
to a more concrete type
Could not cast value of type 'kobjcc0'
Ryan Simon
02/13/2020, 6:44 AMkobjcc0
Ryan Simon
02/13/2020, 6:45 AMRyan Simon
02/13/2020, 6:46 AMbinaries.framework {
freeCompilerArgs += "-Xobjc-generics"
}
But it didn’t really help with this caseRyan Simon
02/13/2020, 6:47 AMsealed class Either<out L, out R> {
data class Error<out L>(val value: L) : Either<L, Nothing>()
data class Success<out R>(val value: R) : Either<Nothing, R>()
val isSuccess get() = this is Success<R>
val isError get() = this is Error<L>
fun <L> error(value: L) = Error(value)
fun <R> success(value: R) = Success(value)
fun either(fnL: (L) -> Any, fnR: (R) -> Any): Any =
when (this) {
is Error -> fnL(value)
is Success -> fnR(value)
}
suspend fun eitherSuspend(fnL: suspend (L) -> Any, fnR: suspend (R) -> Any): Any =
when (this) {
is Error -> fnL(value)
is Success -> fnR(value)
}
}
Artyom Degtyarev [JB]
02/13/2020, 7:47 AMReturnedSuccessWithAnyValue.value as! String
? I just tried with a simple piece of code but cannot reproduce the error for now.russhwolf
02/13/2020, 1:37 PML : Any
) or else objc will see them as Any?
. Might not be the only issue you're having though.Ryan Simon
02/13/2020, 3:29 PMRyan Simon
02/13/2020, 3:30 PMRyan Simon
02/13/2020, 3:30 PMRyan Simon
02/13/2020, 3:31 PMbasher
02/13/2020, 3:33 PMRyan Simon
02/13/2020, 8:37 PMRyan Simon
02/13/2020, 10:47 PMtasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinNativeLink>().configureEach {
this.binary.freeCompilerArgs += "-Xobjc-generics"
}
Ryan Simon
02/13/2020, 10:47 PMbasher
02/13/2020, 10:47 PMRyan Simon
02/13/2020, 10:48 PM