-
-
Notifications
You must be signed in to change notification settings - Fork 45
Open
Description
We have updated Skip packages in a recent release (Skip 1.6.36, Skip UI 1.46.0) and are beginning to see this issue crash some apps on startup.
It seems to be happening surrounding the storage of our colorScheme, which is declared in our main RootView:
public struct RootView : View {
@AppStorage(Theme.storageKey) private var theme: String = Theme.SYSTEM.rawValue
var preferredColorScheme: ColorScheme? {
switch theme {
case Theme.DARK.rawValue:
return .dark
case Theme.LIGHT.rawValue:
return .light
default:
// nil allows for user's system setting default colour scheme to prevail
return nil
}
}
Digging a bit deeper in our stacktrace shows it may also be coming from Skips templated Main.kt file:
@Composable
internal fun PresentationRootView(context: ComposeContext) {
val colorScheme = if (isSystemInDarkTheme()) ColorScheme.dark else ColorScheme.light
PresentationRoot(defaultColorScheme = colorScheme, context = context) { ctx ->
val contentContext = ctx.content()
Box(modifier = ctx.modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
RootView().Compose(context = contentContext)
}
}
}
What is confusing me a bit is that we are providing default values for all @AppStorage variables throughout the app.
I did notice this somewhat similar issue, which seems to indicate that preference keys should not be declared private, which we have done.
Is this as simple as now needing to declare @AppStorage vars as the default public? Anything else at play? Thank you. -Gavyn
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels