Coder Social home page Coder Social logo

ubottomsheet's Introduction

Next Level

Language Version Platform License

Features
๐Ÿ“ Apple Maps bottom sheet behaviour
โš“ Supports panning with UIScrollView and UIView
๐ŸŒ’ Allows adding dimmable background view
๐Ÿ“ฑ Set sheet content as UIViewController or UINavigationController
๐Ÿ“– Navigation inside sheet with UINavigationController
๐ŸŒˆ Add one to many sheet stop positions
๐ŸŽฏ Change sheet position programmatically
๐ŸŒ€ Present as many sheet as you want
๐Ÿš€ Move multiple sheets simultaneously or seperately
๐Ÿน Rubber banding
๐Ÿ‘‹ Dismiss at bottom

Demos

Apple Maps & Childs Navigation In Sheet Pull To Dismiss Multiple Sheet Positions
Tag Tag Tag Tag

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Bottom sheet child view controllers must conform to the Draggable protocol.

class MapsDemoBottomSheetController: UIViewController, Draggable{
    @IBOutlet weak var tableView: UITableView!
      
    override func viewDidLoad() {
        super.viewDidLoad()
        if #available(iOS 11.0, *) {
            tableView.contentInsetAdjustmentBehavior = .never
        } else {
            automaticallyAdjustsScrollViewInsets = false
        }
        tableView.delegate = self
        tableView.dataSource = self
    }
    
    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
        
        //adds pan gesture recognizer to draggableView()
        sheetCoordinator?.startTracking(item: self) 
    }

//  MARK: Draggable protocol implementations

    var sheetCoordinator: UBottomSheetCoordinator? 

    func draggableView() -> UIScrollView? {
        return tableView
    }
}

Create a UBottomSheetCoordinator from the main view controller. Use the UBottomSheetCoordinator to add and configure the sheet.

// parentViewController: main view controller that presents the bottom sheet
let sheetCoordinator = UBottomSheetCoordinator(parent: parentViewController)

let vc = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "MapsDemoBottomSheetController") as! MapsDemoBottomSheetController

vc.sheetCoordinator = sheetCoordinator

sheetCoordinator.addSheet(vc, to: parentViewController)

Requirements

ios9.0+, Xcode10+

Installation

UBottomSheet is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'UBottomSheet'

See Also

TwitterProfile Nested scroll view behaviour of Twitter Profile screen.

Author

uฤŸur, [email protected]

License

UBottomSheet is available under the MIT license. See the LICENSE file for more info.

ubottomsheet's People

Contributors

ofthewolf avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.