vanniktech
01/16/2020, 6:19 PM-Xobjc-generics
enabled. However when trying to run a release build I get: cannot specialize non-generic type
Seems like Kotlin Generics are only working for debug builds. Is there any additional config needed?kpgalligan
01/16/2020, 6:50 PMvanniktech
01/24/2020, 8:09 AMkotlin {
def sdkName = System.getenv("SDK_NAME")
if (sdkName != null && sdkName.startsWith("iphoneos")) {
iosArm64("ios")
} else {
iosX64("ios")
}
cocoapods {
summary = "BeCoachShared"
homepage = "<https://becoach.app/>"
}
// When using cocoapods plugin we can't configure the Framework directly.
targets.ios.binaries
.findAll { it instanceof org.jetbrains.kotlin.gradle.plugin.mpp.Framework }
.every {
it.embedBitcode("YES".equals(System.getenv("ENABLE_BITCODE")) ? "bitcode" : "marker")
it.setFreeCompilerArgs(it.getFreeCompilerArgs() + "-Xobjc-generics")
}
}
When trying to run my iOS App for an iPhone 11 with a Debug Build Configuration everything works. When I switch to release I’m getting:
ErrorHandling.swift7344: Cannot specialize non-generic type ‘SuccessFailure’
This is the generated class (Release Build Configuration):
__attribute__((swift_name("SuccessFailure")))
@interface DatabaseSuccessFailure : KotlinBase
@end;
which obviously is missing the Type declaration. This is the generated class (Debug Build Configuration):
__attribute__((swift_name("SuccessFailure")))
@interface DatabaseSuccessFailure<T> : KotlinBase
@end;
in Kotlin the class looks like this:
// T : Any so that Swift understand that T can never be null.
sealed class SuccessFailure<T : Any>
vanniktech
02/10/2020, 8:22 AM