SkillAgentSearch skills...

UBottomSheet

iPhone Maps App bottom sheet - A Protocol Oriented Approach

Install / Use

/learn @OfTheWolf/UBottomSheet
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

<p align="center"><img src="https://github.com/OfTheWolf/UBottomSheet/blob/master/Logo.png" alt="Next Level" style="max-width:100%;"></p> <p align="center"> <a href="https://cocoapods.org/pods/UBottomSheet"><img alt="Language" src="https://img.shields.io/badge/language-swift%205-brightgreen"/></a> <a href="https://cocoapods.org/pods/UBottomSheet"><img alt="Version" src="https://img.shields.io/cocoapods/v/UBottomSheet.svg?style=flat"/></a> <a href="https://cocoapods.org/pods/UBottomSheet"><img alt="Platform" src="https://img.shields.io/cocoapods/p/UBottomSheet.svg?style=flat"/></a> <a href="https://cocoapods.org/pods/UBottomSheet"><img alt="License" src="https://img.shields.io/cocoapods/l/UBottomSheet.svg?style=flat"/></a> </p>

| | 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 or more 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
// call this within viewWillLayoutSubViews to make sure view frame has measured correctly. see example projects. 
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 and Swift Package Manager.

CocoaPods

Add the following line to your Podfile:

pod 'UBottomSheet'

SPM

Add this url in XCode > File > Swift Packages > Add Package Dependency:

https://github.com/OfTheWolf/UBottomSheet

See Also

TwitterProfile Nested scroll view behaviour of Twitter Profile screen.

Author

uğur, uguboz@gmail.com

License

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

Related Skills

View on GitHub
GitHub Stars731
CategoryDevelopment
Updated3d ago
Forks71

Languages

Swift

Security Score

100/100

Audited on Mar 27, 2026

No findings