-
Notifications
You must be signed in to change notification settings - Fork 57
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
🐛 Present view on keyWindow over iOS 17 #46
🐛 Present view on keyWindow over iOS 17 #46
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your contribution, Jiyeon!
I'll release a new version after I apply the suggestions on the comments I left.
guard let presentingViewController = uiView.viewController else { | ||
self.resetItemBinding() | ||
|
||
if #available(iOS 17.0, *) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great! I think it would be nice to use your suggestion even on iOS 16 and earlier.
This guarantees that presentingViewController
doesn't have a presentedViewController
, which means the modal presentation ofSafariViewController
will not be blocked by any other presentedViewController
.
self.resetItemBinding() | ||
|
||
if #available(iOS 17.0, *) { | ||
if var topController = UIApplication.shared.windows.filter(\.isKeyWindow).first?.rootViewController { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An UIWindow
instance is must be grabbed via uiView.window
.
UIApplication.shared.windows
is deprecated in iOS 15, and this will make an issue when there are two or more UIWindowScene
s.
Relates to #41 |
df7db51
into
stleamist:bug/ios-17-key-press-responder-issue
I had a issue that when the view doesn't have the uiViewController, it just reset the binding item. And weirdly, this happens only in iOS 17.
So I present the view on the key window (not uiView.viewController), when in iOS 17.