Swiftpack.co - Package - shortcut/drawer-ios

Drawer

A 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.

Requirements

Works on iOS 11+

SwiftPM

  1. Add the following to your Package.swift:
    .package(url: "https://github.com/shortcut/drawer-ios.git", .upToNextMajor(from: "1.0")),
    
  2. Next, add Drawer to your App targets dependencies like so:
    .target(name: "App", dependencies: ["Drawer"]),
    
  3. Then open your project in Xcode 11+.

Usage

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)

License

This code is distributed under the terms and conditions of the MIT license.

Github

link
Stars: 0

Dependencies

Used By

Total: 0

Releases

"And so, it begins." - 2020-03-16 15:40:47

First release of a draggable drawer component