Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

iPhone Maps App bottom sheet - A Protocol Oriented Approach

License

NotificationsYou must be signed in to change notification settings

OfTheWolf/UBottomSheet

Repository files navigation

Next Level

LanguageVersionPlatformLicense

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 & ChildsNavigation In SheetPull To DismissMultiple Sheet Positions
TagTagTagTag

Example

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

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

classMapsDemoBottomSheetController:UIViewController,Draggable{@IBOutlet weakvartableView:UITableView!overridefunc viewDidLoad(){        super.viewDidLoad()if #available(iOS11.0,*){            tableView.contentInsetAdjustmentBehavior=.never}else{            automaticallyAdjustsScrollViewInsets=false}        tableView.delegate=self        tableView.dataSource=self}overridefunc viewWillAppear(_ animated:Bool){        super.viewWillAppear(animated)                //adds pan gesture recognizer to draggableView()        sheetCoordinator?.startTracking(item:self)}//  MARK: Draggable protocol implementationsvarsheetCoordinator: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.letsheetCoordinator=UBottomSheetCoordinator(parent: parentViewController)letvc=UIStoryboard(name:"Main", bundle:nil).instantiateViewController(withIdentifier:"MapsDemoBottomSheetController")as!MapsDemoBottomSheetControllervc.sheetCoordinator= sheetCoordinatorsheetCoordinator.addSheet(vc, to: parentViewController)

Requirements

ios9.0+, Xcode10+

Installation

UBottomSheet is available throughCocoaPods andSwift 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.


[8]ページ先頭

©2009-2025 Movatter.jp