Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/OfTheWolf/UBottomSheet
iPhone Maps App bottom sheet - A Protocol Oriented Approach
https://github.com/OfTheWolf/UBottomSheet
apple-maps bottom-sheet bottomsheet bottomsheetbehavior ios iphone swift swift4
Last synced: 13 days ago
JSON representation
iPhone Maps App bottom sheet - A Protocol Oriented Approach
- Host: GitHub
- URL: https://github.com/OfTheWolf/UBottomSheet
- Owner: OfTheWolf
- License: mit
- Created: 2018-08-13T16:52:06.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2024-04-03T15:38:08.000Z (7 months ago)
- Last Synced: 2024-07-04T10:15:05.478Z (4 months ago)
- Topics: apple-maps, bottom-sheet, bottomsheet, bottomsheetbehavior, ios, iphone, swift, swift4
- Language: Swift
- Homepage:
- Size: 26.5 MB
- Stars: 625
- Watchers: 7
- Forks: 66
- Open Issues: 18
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-ios - UBottomSheet
README
| | 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](https://github.com/OfTheWolf/UBottomSheet/blob/master/records/record1.gif)|![Tag](https://github.com/OfTheWolf/UBottomSheet/blob/master/records/record2.gif)|![Tag](https://github.com/OfTheWolf/UBottomSheet/blob/master/records/record3.gif)|![Tag](https://github.com/OfTheWolf/UBottomSheet/blob/master/records/record4.gif)|## 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.
```swift
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.
```swift
// 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](https://cocoapods.org) and [Swift Package Manager](https://developer.apple.com/documentation/swift_packages).
#### CocoaPods
Add the following line to your Podfile:
```ruby
pod 'UBottomSheet'
```#### SPM
Add this url in XCode > File > Swift Packages > Add Package Dependency:
```
https://github.com/OfTheWolf/UBottomSheet
```## See Also
[TwitterProfile](https://github.com/OfTheWolf/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.