BottomSheet is an implementation of custom modal presentation style for thumb-friendly interactive views anchored to the bottom of the screen.
- Custom
UIViewControllerTransitioningDelegatefor dismissable modal bottom sheets -
BottomSheetViewfor displaying complementary content as a standard bottom sheet view - Expanding bottom sheets with multiple states to transition between
- Support for automatic view height based on Auto Layout constraints
- Beatiful spring animation
BottomSheet is available through Carthage. Append this line to your Cartfile:
github "finn-no/BottomSheet"BottomSheet is also available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'FINNBottomSheet'To integrate using Apple's Swift package manager, add the following as a dependency to your Package.swift:
.package(url: "https://github.com/finn-no/BottomSheet.git", .upToNextMajor(from: "1.0.0"))View controller -based presentation:
let transitioningDelegate = BottomSheetTransitioningDelegate(
targetHeights: [.bottomSheetAutomatic, UIScreen.main.bounds.size.height - 200],
startTargetIndex: 0
)
let viewController = UIViewController()
viewController.transitioningDelegate = transitioningDelegate
viewController.modalPresentationStyle = .custom
present(viewController, animated: true)View -based presentation:
let contentView = UIView()
contentView.backgroundColor = .red
let bottomSheetView = BottomSheetView(
contentView: contentView,
targetHeights: [100, 500]
)
// Can be presented in any UIView subclass
bottomSheetView.present(in: viewController.view, targetIndex: 0) 
