Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Depends on #2.
The public DrawerKit API has been reduced to three pieces:
DrawerConfiguration
,DrawerController
andPartiallyExpandableDrawer
.A view controller that wishes to be presented as a drawer can simply:
DrawerController
with its desired configuration; andDrawerController
as its transitioning delegate.If it wishes to support partial expansion, on top of enabling the setting in
DrawerConfiguration
, the drawer view controller needs to conform to alsoPartiallyExpandableDrawer
.How does it work?
DrawerController
tracks if it has ever created anyPresentationController
. Since UIKit pretty much guarantees that it asks for a presentation controller before the animators, we can explore this in order to retrieve the presenting VC for the animator dynamically.It also works when the view controller is recycled. Since UIKit would release the presentation controller upon conclusion of a presentation, this means the weak reference in
DrawerController
would be zeroed, and hence a newPresentationController
would be created next time the drawer is presented.Example
https://github.com/Babylonpartners/DrawerKit/pull/3/files#diff-797161087489cdf11d7916a4480c4f93R4
Basic hello world example: