Repository navigation
fix(ios): read the system appearance before the window has a root view controller - #20
Merged
Merged
Conversation
…w controller The launch event fires before the primary window gets its root view controller, and both Application.systemAppearance() and IOSNativeWindow.systemAppearance() returned null then. Apps that pick their theme in a launch handler got no appearance and rendered with empty colors. Fall back to the window and then the screen trait collection when there is no root view controller yet. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Checklist
What is the current behavior?
The launch event fires before the primary window gets its root view controller.
Application.systemAppearance()andIOSNativeWindow.systemAppearance()both returnnulluntil then, so a launch handler that picks its theme fromsystemAppearance()(themeauto) gets nothing and apps render with empty colors.What is the new behavior?
Both getters fall back to the window's trait collection, then
UIScreen.mainScreen.traitCollection, when there is no root view controller yet. Once a root view controller exists it is still used first, so behavior after launch is unchanged.Checked in the iOS simulator (iPhone 17, iOS 27) with an app whose launch handler resolves the
autotheme: the first screen renders with theme colors.Notes
🤖 Generated with Claude Code