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

Added segment control to switch UI between light and dark mode #47

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

Conversation

fchangbushel
Copy link

No description provided.


if #available(iOS 12.0, *) {
// Start observing style change
startObserving(&UserInterfaceStyleManager.shared)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to start observing?


// Observe user interface style change
if #available(iOS 12.0, *) {
startObserving(&UserInterfaceStyleManager.shared)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to start observing?

@available(iOS 12.0, *)
internal class AppearanceInfoKnob : DroarKnob {

private enum BuildInfoRow: Int {
Copy link
Contributor

@Alarson93 Alarson93 Jul 14, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make this CaseIterable and remove "count"

BuildInfoRow.allCases().count

}

func droarKnobNumberOfCells() -> Int {
return BuildInfoRow.count.rawValue
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the enum count (not as a case)

@Alarson93
Copy link
Contributor

Alarson93 commented Jul 14, 2020

We talked about this in person - but for visibility:
I don't think we should force views/view controllers to be a particular style.
If a VC is explicitly set to light, then we should never need to force it to be dark. Also - the current approach (with observers) doesn't scale very well; it's very heavy handed.

I would suggest simulating the system color style by modifying the key window's style. This will change unspecified view styles to the new mode (dark or light) while probably(?) leaving the already set views as they are.
Actually - the key window might be good enough, but it may also be worth changing the style of ALL windows; this may be safer as it cannot be guaranteed that there is only one window in an app.

Ex: if View A is light and View B is unspecified, setting the style in Droar to dark should result in View A being light and View B being dark.

Ultimately this will be like switching your systems style, but from within Droar and it will only impact the current app session.

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

Successfully merging this pull request may close these issues.

2 participants