-
Notifications
You must be signed in to change notification settings - Fork 44
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
Use a container VC to make sure UIKit owned insets do not go wild. #48
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. Minor changes suggested.
@@ -21,11 +21,11 @@ private extension PresenterViewController { | |||
// what you need to configure differently. They're all listed here just so you | |||
// can see what can be configured. The values listed are the default ones, | |||
// except where indicated otherwise. | |||
configuration.totalDurationInSeconds = 3 // default is 0.4 | |||
configuration.totalDurationInSeconds = 0.4//3 // default is 0.4 |
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.
I'd suggest to remove the //3
part.
configuration.durationIsProportionalToDistanceTraveled = false | ||
// default is UISpringTimingParameters() | ||
configuration.timingCurveProvider = UISpringTimingParameters(dampingRatio: 0.8) | ||
configuration.fullExpansionBehaviour = .leavesCustomGap(gap: 100) // default is .coversFullScreen | ||
configuration.fullExpansionBehaviour = .coversFullScreen//.leavesCustomGap(gap: 100) // default is .coversFullScreen |
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.
I'd suggest to remove the //.leavesCustomGap(gap: 100)
part.
4264092
to
0b34c0d
Compare
0b34c0d
to
cb357d7
Compare
Fixes #31.
TL;DR
If the drawer content is laid out against (1) safe area top or (2) top layout guide, these are now in effect throughout the entire presentation time, regardless of the drawer being fully expanded or not.
Details
The safe area mechanism (and its earlier variant
(top|bottom)LayoutGuide
) appears to be dependent on the view origin. If the view does not lie at (0, 0) of the screen, UIKit would not consider the view overlapping with top system bars, thus having a safe area top inset of zero (or top layout guide length).Jeez. ZERO.
Fortunately, child VCs inherit safe area insets (and layout guides) from their parent VCs. So a full-screen transparent container VC is added. This container VC manages the presented drawer, so that the drawer now gets system layout insets at all phases of presentation. 💁♂️
Note
This PR makes the drawer content in the Demo app layouts against the top layout guide.
GIF