Drawer is an iOS drop-in class that displays a draggable/resizeable drawer component similar to the search bar in Apple Maps and Google Maps.
Works on iOS 11+
- Add the following to your
.package(url: "https://github.com/shortcut/drawer-ios.git", .upToNextMajor(from: "1.0")),
- Next, add
Drawerto your App targets dependencies like so:
.target(name: "App", dependencies: ["Drawer"]),
- Then open your project in Xcode 11+.
To you have a view controller that you want to be displayed as a drawer occupying half of the screen it only a few lines of code is needed.
let myViewController = MyViewController() let config = DrawerConfiguration( snapPoints: [ .top, .fraction(value: 0.5), .dismiss], defaultSnapPoint: .fraction(value: 0.5), shouldAllowTouchPassthrough: true, shouldDismissOnOutsideTap: true) let drawerViewController = DrawerViewController(viewController: myViewController, configuration: config) present(drawerViewController, animated: true)
This code is distributed under the terms and conditions of the MIT license.