-
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
Support modal presentation on top of the drawer. #56
Conversation
@@ -22,6 +22,10 @@ class PresentedViewController: UIViewController { | |||
} | |||
} | |||
} | |||
|
|||
@IBAction func unwindFromModal(with segue: UIStoryboardSegue) { | |||
print("Unwound from the modal.") |
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.
Is this going to be removed at some point?
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.
No. It is the Storyboard unwind point for dismissing the modal in the demo.
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 meant the print statement.
containerViewHeight: containerViewHeight, | ||
configuration: configuration, | ||
clampToNearest: true) | ||
break |
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 don't understand why you're no longer setting lastDrawerState
here.
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.
It is not necessary to update it during the course of the pan.
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.
lastDrawerState
is not really consumed by anything until this PR, by the way.
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 think it might be, for the benefit of along-side animations performed by the presenting and/or presented view controllers.
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.
After looking into this, changed
is actually updating the targetDrawerState
(renamed from lastDrawerState
).
drawerPartialHeight: drawerPartialHeight, | ||
containerViewHeight: containerViewHeight, | ||
configuration: configuration, | ||
clampToNearest: true) | ||
currentDrawerY += panGesture.translation(in: view).y |
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.
Or here.
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.
Ditto.
@@ -48,9 +40,6 @@ extension PresentationController { | |||
configuration: configuration) | |||
animateTransition(to: endingState) | |||
|
|||
case .cancelled: | |||
animateTransition(to: lastDrawerState) |
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.
And, likewise, I don't understand the reason for removing this.
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.
cancelled
is treated as completed
now, and picks the next state based on current drawer state plus velocity.
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.
So, if the user starts dragging the drawer up then changes his mind, the drawer continues up anyway? That doesn't sound right to me.
Support modal presentation over the drawer.
The presented view controller must however use
overFullscreen
for the drawer content to be placed correctly. This is due to the defaultfullScreen
presentation style not asking DrawerKit for the correct frame before the dismissal animation begins. This causes the drawer being visible in the incorrect position until the dismissal animation completes.Update the demo app to showcase the support.