This is iOS Maps like anchored bottom sheet with configurable anchors and reusable
BottomSheetView, that can be used inside provided modal controller or without it.
BottomSheetView supports all kinds of
UIScrollView and it's ancestors as a container view.
BottomSheetViewController is intended to be used as a modal presented controller.
BottomSheetView you should use
BottomSheetViewConfiguration struct like this:
let config = BottomSheetViewConfiguration( contentView: UIView(), parentViewController: self, defaultPosition: .middle(), positions: [.top(), .middle(), .bottom()], isSlidingToAppear: false, isPullIndicatorNeeded: true, closeButtonIcon: UIImage(named: "closeIcon"), isDismissAllowed: false, cornerRadius: 16 )
Each anchor has associated value, which will override default height for this anchor. By content mode is not yet implemented, feel free to open a pull request.
Once configuration is done, you should create
BottomSheetView like this:
let bottomSheetView = BottomSheetView(configuration: configuration)
If you want to use this view for some complex UI cases,
BottomSheetView will handle the pan gesture and will notify
heightDidChange(to height: CGFloat) method
If you want to implement general pop-up behaviour, you should use
BottomSheetViewController. Create and present it like so:
let bottomSheetViewController = BottomSheetViewController(bottomSheetView: bottomSheetView) bottomSheetViewController.delegate = self bottomSheetViewController.present(from: self)
AnchoredBottomSheet is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'AnchoredBottomSheet', '~> 1.6.2'
Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.
You can install Carthage with Homebrew using the following command:
$ brew update $ brew install carthage
To integrate AnchoredBottomSheet into your Xcode project using Carthage, specify it in your
github "havebeenfitz/anchoredbottomsheet" "1.6.2"
carthage update to build the framework and drag the built
SnapKit.framework into your Xcode project.
Swift Package Manager is a tool for managing the distribution of Swift code. It’s integrated with the Swift build system to automate the process of downloading, compiling, and linking dependencies.
Xcode 11+ is required to build AnchoredBottomSheet using Swift Package Manager.
To integrate AnchoredBottomSheet into your Xcode project using Swift Package Manager, add it to the dependencies value of your
dependencies: [ .package( url: "https://github.com/havebeenfitz/anchoredbottomsheet.git", .upToNextMajor(from: "1.6.2") ) ]
If you prefer not to use either of the aforementioned dependency managers, you can integrate AnchoredBottomSheet into your project manually.
Xcode 12+, iOS deployment target ≥ 12
havebeenfitz, [email protected]
AnchoredBottomSheet is available under the MIT license. See the LICENSE file for more info.
|Last commit: 3 weeks ago|
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics