diff --git a/Sources/Features/WebShell/WebShellView.swift b/Sources/Features/WebShell/WebShellView.swift index e6c1859..2d7e9e7 100644 --- a/Sources/Features/WebShell/WebShellView.swift +++ b/Sources/Features/WebShell/WebShellView.swift @@ -112,6 +112,12 @@ final class WebNavState { webView.navigationDelegate = context.coordinator webView.uiDelegate = context.coordinator webView.allowsBackForwardNavigationGestures = true + // Ohne diese drei flackert WKWebView bis zum first paint weiß + // gegen das Paper-Theme — egal was die SwiftUI-Hülle als + // Background setzt. + webView.isOpaque = false + webView.backgroundColor = .clear + webView.scrollView.backgroundColor = .clear webView.scrollView.refreshControl = makeRefreshControl( webView: webView, coordinator: context.coordinator @@ -162,6 +168,9 @@ final class WebNavState { webView.navigationDelegate = context.coordinator webView.uiDelegate = context.coordinator webView.allowsBackForwardNavigationGestures = true + // macOS-Pendant zu UIView.isOpaque=false — sonst weißer + // Flash vor first paint. + webView.setValue(false, forKey: "drawsBackground") context.coordinator.observe(webView: webView) context.coordinator.load(target.url, into: webView) return webView diff --git a/Sources/Resources/Assets.xcassets/LaunchBackground.colorset/Contents.json b/Sources/Resources/Assets.xcassets/LaunchBackground.colorset/Contents.json new file mode 100644 index 0000000..95677a8 --- /dev/null +++ b/Sources/Resources/Assets.xcassets/LaunchBackground.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0.936", + "green" : "0.954", + "red" : "0.964" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0.077", + "green" : "0.087", + "red" : "0.103" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/project.yml b/project.yml index f79e71c..f5ed973 100644 --- a/project.yml +++ b/project.yml @@ -66,7 +66,13 @@ targets: # ist die Info.plist XcodeGen-getrieben, also explizit hier. CFBundleIconName: AppIcon LSApplicationCategoryType: "public.app-category.reference" - UILaunchScreen: {} + # Paper-Theme-Background als Launch-Screen statt System-Weiß, + # damit zwischen Tap und first SwiftUI-paint kein weißer Flash + # mehr sichtbar ist. Asset hat Light + Dark Variante, matcht + # `--color-background` aus mana/packages/themes/paper.css und + # `ZitareTheme.background` im Native-Code. + UILaunchScreen: + UIColorName: LaunchBackground UISupportedInterfaceOrientations: - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft