https://github.com/nicol3a/nbbottomsheet
An iOS library that presents a bottom sheet using Auto Layout.
https://github.com/nicol3a/nbbottomsheet
bottom-sheet carthage cocoapods ios popup swift
Last synced: 9 months ago
JSON representation
An iOS library that presents a bottom sheet using Auto Layout.
- Host: GitHub
- URL: https://github.com/nicol3a/nbbottomsheet
- Owner: nicol3a
- License: mit
- Created: 2018-11-10T00:10:09.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2022-05-10T21:06:21.000Z (over 3 years ago)
- Last Synced: 2025-03-28T11:51:10.438Z (10 months ago)
- Topics: bottom-sheet, carthage, cocoapods, ios, popup, swift
- Language: Swift
- Size: 1.59 MB
- Stars: 68
- Watchers: 5
- Forks: 13
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# NBBottomSheet
[](https://github.com/Carthage/Carthage)
[](http://cocoapods.org/pods/NBBottomSheet)
[](https://developer.apple.com/swift/)
[](http://www.apple.com/ios/)
[](https://github.com/nicol3a/NBBottomSheet/blob/master/LICENSE)
**NBBottomSheet** is an open-source iOS library that allows you to present a `UIViewController` in a bottom sheet.

## Requirements
* iOS 9.0+
* Xcode 11+
* Swift 5.0
## Installation
### CocoaPods
To integrate NBBottomSheet into your Xcode project using [CocoaPods](http://cocoapods.org), specify it in your `Podfile`:
```ruby
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
use_frameworks!
target 'YOUR_TARGET_NAME' do
pod 'NBBottomSheet', '~> 1.2'
end
```
Then, run the following command:
```bash
$ pod install
```
### Carthage
To integrate NBBottomSheet into your Xcode project using [Carthage](https://github.com/Carthage/Carthage), specify it in your `Cartfile`:
```ogdl
github "nicol3a/NBBottomSheet" ~> 1.1
```
Then, run the following command:
```bash
$ carthage update
```
Drag the built `NBBottomSheet.framework` from the Carthage build folder into the “Embedded Binaries” section in the "General" panel of the application target.
### Manually
Add NBBottomSheet as a git [submodule](http://git-scm.com/docs/git-submodule) by running the following command:
```bash
$ git submodule add -b master https://github.com/nicol3a/NBBottomSheet.git
```
Drag the `NBBottomSheet.xcodeproj` file into your project and add the `NBBottomSheet.framework` in the "Embedded Binaries" section in the "General" panel of the application target.
## Usage
Initialize an instance of [`NBBottomSheetController`](https://github.com/nicol3a/NBBottomSheet/blob/master/NBBottomSheet/NBBottomSheet/Sources/NBBottomSheetController.swift):
```swift
let bottomSheetController = NBBottomSheetController()
```
To display a view controller in a bottom sheet, add the following code where you want to display the bottom sheet, passing the view controller to present and the container view controller:
```swift
let viewController = AlertViewController()
bottomSheetController.present(viewController, on: self)
```
> **Note:** Be sure to keep a strong reference to your instance of [`NBBottomSheetController`](https://github.com/nicol3a/NBBottomSheet/blob/master/NBBottomSheet/NBBottomSheet/Sources/NBBottomSheetController.swift) for the duration of its use.
If you don’t want to use [`NBBottomSheetController`](https://github.com/nicol3a/NBBottomSheet/blob/master/NBBottomSheet/NBBottomSheet/Sources/NBBottomSheetController.swift)’s default configuration, you can specify a [`NBBottomSheetConfiguration`](https://github.com/nicol3a/NBBottomSheet/blob/master/NBBottomSheet/NBBottomSheet/Sources/NBBottomSheetConfiguration.swift) instance on initialization of [`NBBottomSheetController`](https://github.com/nicol3a/NBBottomSheet/blob/master/NBBottomSheet/NBBottomSheet/Sources/NBBottomSheetController.swift).
```swift
let configuration = NBBottomSheetConfiguration(animationDuration: 0.4, sheetSize: .fixed(300))
let bottomSheetController = NBBottomSheetController(configuration: configuration)
```
## License
NBBottomSheet is available under the MIT license. See the [`LICENSE`](https://github.com/nicol3a/NBBottomSheet/blob/master/LICENSE) file for more information.
## Acknowledgements
- Created with ❤️ by [Nicolas Bichon](https://twitter.com/nicol3a)