-
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
Method to Disable Collapsed / Dismissed Presented View Controller #53
Comments
It feels wrong to me to have a view controller that you can present but cannot dismiss. Nonetheless, if you still want to achieve that effect, then...
...is absolutely the wrong thing to do. Instead, you should add a configuration option similar to More generally, however, if all you want is a 2-state drawer, you might as well start from scratch and use the custom view controller transition API (more specifically, the custom presentation API) to implement it. |
It's been pointed out to me that the search controller in Apple's Maps app has the behaviour you're talking about (not dismissible) so it's a valid user case. We don't have plans to add that feature to |
DrawerKit is currently built for the modal presentation API, which has semantics that doesn't make sense when the drawer is always kept on screen as @wltrup has mentioned. A potential solution is to make a container VC which shares only the partial and fully expansion transitions with the DrawerKit presentation controller. |
@wltrup I know it was by far not the best solution, it was just a temporary hack in the early hours of the morning. I also realized that the presenting view controller can't be interacted with while the drawer is present, which is something I need. I was trying to refactor the drawer in our current project here. Ideally, I'd just like to get the sweet physics / animations of DrawerKit. I'm a bit overwhelmed by all the files included in the pod. Would someone be able to point out which files include the pan gesture and animating code? |
Hi @mattbarker016,
That is a major limitation of The view animation approach is very easy to implement but is not very flexible. The VC containment is flexible but, in a way, it's reinventing the wheel, which is why I opted to implement As for the large number of files, my intention was to have a separate file for each group of related functionality. So, for instance, the bare bones of custom presentation is on I hope this reply helps you to make a decision. If you can wait, there's a good chance I may have a better and more flexible implementation of |
The iOS Maps use case is what I was pursuing when stumbling on DrawerKit. I think being able to interact with the presenter view and not being able to dismiss the presented view would be great additions to the library. To echo what others have said, the animations in this library are fantastic - far better than Pulley (the other alternative). If we could somehow merge the two, we would have the ideal solution! :-) |
Apologies if I missed any references to this but I'm wondering if I can disable the full expansion. Sometimes I only have a few "lines" of elements to present so the full screen isn't really the best look. |
Hello @TJSartain, and thanks for your interest in Unfortunately, you can't disable the full expansion. It's an open issue to support the expansion of drawers that don't have enough content to fill the entire screen but I haven't got around to implementing that yet. An alternative that might work for you, however, is to take advantage of /// Whether the drawer expands to cover the entire screen, the entire screen minus
/// the status bar, or the entire screen minus a custom gap. The default is to cover
/// the full screen.
public var fullExpansionBehaviour: FullExpansionBehaviour If you provide a gap here, the drawer will fully expand only so much. It's a bit of a hack since you have to "manually" set a gap but it should work in most situations like that which you described. |
TL;DR: How can I make the collapse presented view controller persist on screen, and not dismiss / fly off the screen for good?
Fork: https://github.com/mattbarker016/DrawerKit
Description: I replaced or changed nearly all instances of
DrawerState.collapsed
to act like.partiallyExpanded
. This makes the the drawer toggle between two states, keeping a persistent view no matter what (I also had to useconfiguration.lowerMarkGap = 100000000
. Ideally, I'd like to be able to adjust the.collapsed
presented view controller so I can get some of the cool transition and partiallyExpanded physics and functionality, but I haven't found a way yet. Please let me know how I could do this, or if this is a feature to be added!Code Changed: https://github.com/mattbarker016/DrawerKit/commit/53ef319dc54cd25083d5e262be4876767eccce19
The text was updated successfully, but these errors were encountered: