A customizable DrawerView similar to the one in Maps.
The project contains an example of the DrawerView, with a simple UITableViewController inside of it and a custom Header. To run the example project clone the repo and add the BottomDrawerView Swift Package.
Inside your ViewController create your DrawerView object. I prefer to use a lazy loaded drawer so that I can configure it right inside.
private lazy var bottomDrawer: DrawerView = {
let drawer = DrawerView(...)
...
return drawer
}()You can either initialize it using a UIView or a UIViewController, and customize various properties.
let drawer = DrawerView(containing: yourViewControllerOrView, inside: self, headerViewHeight: 60)
// Each position represents the precentage of the screen that it will occupy
drawer.supportedPositions = [DVPosition(0.2), DVPosition(0.8)]
// This only affects the topLeft and topRight corners
drawer.cornerRadius = 24
// Only for the header
drawer.tapToExpand = trueThen in the viewDidLoad() add it to your viewController as a subview, simple as that!
view.addSubview(bottomDrawer)It is available through CocoaPods, a dependecy manager for Cocoa projects. To add BottomDrawerView to your project specify it in your Podfile:
pod 'BottomDrawerView'It is also available using Swift Package Manager.
- support for
UIVisualEffectView