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

Popover presented from a button in nav bar messes with geometry of content view (iPad) #8

Closed
markkrenek opened this issue Feb 12, 2022 · 3 comments

Comments

@markkrenek
Copy link

I'm using a popover presented from a button in a nav bar. It works fine, but there's an issue on iPad. After the popover is presented, if you resize the app, the content view no longer resizes accordingly. I made a few simple changes to the example app that demonstrates this. Here is a screenshot and movie that shows the issue. Also attached is a modified RootView.swift with my changes. They are marked with "// MAK".

Simulator Screen Shot - iPad

Simulator.Screen.Recording.-.iPad.mov

RootView.txt

@edudnyk
Copy link
Owner

edudnyk commented Feb 13, 2022

Hey @markkrenek, thanks for well-described bug report.

I was able to reproduce the issue, however, I believe this is the system SwiftUI issue. You can see on the screenshot below that it's not just ContentView that is incorrectly resized, it's the whole UIHostingView and its view controller. Which makes me think that SwiftUI.NavigationView somehow incorrectly handles window scene resizing in this case. You can submit bug report to apple and let's see what they answer.

Screenshot 2022-02-13 at 09 42 41

@edudnyk
Copy link
Owner

edudnyk commented Feb 13, 2022

After further investigation, it appears that the issue is with the view controller being added as a child of the navigation controller.

Please find a fix in version 2.0.1.

@markkrenek
Copy link
Author

Excellent! This indeed solves the issue. I've tried multiple libs like this but all get it wrong when presenting from a nav bar. Detached view controller complaints from the runtime. My main goal was to use a popover and have it convert to a half size sheet in compact environments - the standard popover always uses a fullscreen sheet in this case. Being able to set adaptiveSheetProperties for the popover is perfect. Thanks for the solution.

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

No branches or pull requests

2 participants