Christian Gaisl
05/02/2021, 7:03 PM//Does not work with SwiftUI preview
class Greeting1(
var testString: String
) {
fun greeting(): String {
return "Hello, ${Platform().platform}!"
}
}
//Works with SwiftUI preview
class Greeting2(
testString: String
) {
fun greeting(): String {
return "Hello, ${Platform().platform}!"
}
}
An instance of this class being part of the view, even if none of its members are actually displayed, crashes the preview. It works fine on the simulator though.
This does not happen in the template project when using the Xcode build phases framework approach, the one with the packForXcode task.
Does anyone have any idea what could cause this?xxfast
05/03/2021, 3:31 AMChristian Gaisl
05/03/2021, 5:47 AMJosé González Gómez
05/03/2021, 11:12 AMChristian Gaisl
05/03/2021, 8:44 PMRemoteHumanReadableError: Failed to update preview.
The preview process appears to have crashed.
Error encountered when sending 'previewInstances' message to agent.
==================================
| RemoteHumanReadableError: The operation couldn't be completed. (BSServiceConnectionErrorDomain error 3.)
|
| BSServiceConnectionErrorDomain (3):
| ==BSErrorCodeDescription: OperationFailed
Nevertheless, I tried one of the suggested solutions, which was using the following settings in my “shared” gradle file:
kotlin {
targets.withType<org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget> {
binaries.withType<org.jetbrains.kotlin.gradle.plugin.mpp.Framework> {
isStatic = false
}
}
}
However, I did not get this to compile with this setting enabled, Xcode could not find the shared library at all anymore. I tried setting the framework search paths to $(inherited), but no luck. 😕Vitor Prado
05/03/2021, 9:58 PMxxfast
05/04/2021, 1:17 AMVitor Prado
05/04/2021, 12:37 PMChristian Gaisl
05/04/2021, 2:55 PM