Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optionally override interface style of presented view controller. #12

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lightandshadow68
Copy link

This PR allows overriding the interface style of the presented view controller. Specifically, it adds the ability to set the overrideUserInterfaceStyle property on the view controller before it is presented. This allows omitting the .preferredColorScheme(.dark) modifier, which didn't seem to survive the presentation and retroactively caused interface style changes in the view calling .shee(....

@edudnyk
Copy link
Owner

edudnyk commented Jan 12, 2023

Hi @lightandshadow68,

Thanks for this PR.
Given your problem statement, I think you can do better here.

In SheetModifier.swift, you can declare @Environment(\.colorScheme) private var colorScheme.
This will collect the color scheme assigned outside of the sheet with .preferredColorScheme(..).

Then, you can automatically pass that to sheetHost.overrideUserInterfaceStyle in the same file, without the necessity of exposing this property in UIViewControllerProxy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants