Skip to content
This repository has been archived by the owner on Apr 11, 2024. It is now read-only.

Adopt theme in newly created windows automatically #81

Merged
merged 5 commits into from Jun 29, 2020

Conversation

levinli303
Copy link
Member

We observe UIWindowDidBecomeVisibleNotification notification, and apply theme to the window, since it is possible to just create a UIWindow and make it key/visible without using UIScene API.

The example app is also updated with multi-window support on iPad.

@levinli303
Copy link
Member Author

Let's break down the task into pieces. This PR is ready now. @zhuorantan @li-bei do you have the bandwidth to review this PR?

Copy link
Collaborator

@zhuorantan zhuorantan left a comment

Choose a reason for hiding this comment

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

LGTM. Good job

window?.makeKeyAndVisible()

return true
}

class func createNewWindow(with window: UIWindow) -> UIWindow {
Copy link
Contributor

Choose a reason for hiding this comment

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

Question: should we use static? Which should we prefer?

Copy link
Member Author

Choose a reason for hiding this comment

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

makes little difference here, but probably static is preferred because static func cannot be overridden in subclass whereas class func can

Copy link
Collaborator

Choose a reason for hiding this comment

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

IMO, it would be better to choose static over class whenever possible. I think Swift prefers static. There might be a best practice for this.

Copy link
Member Author

Choose a reason for hiding this comment

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

let's go ahead with static here.

use static func wherever possible
@levinli303 levinli303 merged commit 55e5594 into master Jun 29, 2020
@levinli303 levinli303 deleted the new-window-support branch June 29, 2020 01:43
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants