Swiftpack.co - Package - finn-no/BottomSheet

CircleCI Carthage compatible CocoaPods compatible Swift Package Manager compatible

BottomSheet is an implementation of custom modal presentation style for thumb-friendly interactive views anchored to the bottom of the screen.

  • ☑ Custom UIViewControllerTransitioningDelegate for dismissable modal bottom sheets
  • BottomSheetView for 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

Demo

Installation

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"))

Usage

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) 

Github

link
Stars: 45

Dependencies

Used By

Total: 0

Releases

4.2.0 - 2020-01-15 08:28:13

Draggable height as configuration option #23

4.1.0 - 2020-01-14 14:57:15

Make it possible to stretch content view on resize #22

4.0.2 - 2020-01-14 10:36:22

Remove content view constraints on dismiss #21

4.0.1 - 2020-01-13 13:10:56

Override navigation controller init #20

4.0.0 - 2020-01-13 09:56:36

Introduce dismissal delegate #19

3.2.0 - 2020-01-07 10:16:56

Make transitioning delegate and bottom sheet view more customisable #18

3.1.1 - 2019-12-20 14:19:42

Update podspec

3.1.0 - 2019-12-20 14:18:58

Add a helper class to work with navigation controllers #17

3.0.0 - 2019-12-19 12:04:22

Initialize BottomSheetView with contentHeights #14

2.3.0 - 2019-12-04 10:05:54

Support navigation controllers #13

2.2.0 - 2019-12-02 11:02:05

#9 Fix present without animation #10 Dismiss presented view controller when tapping dimmed background #11 Add initial velocity to spring animation #12 Make sure interactive presentation works properly

2.1.0 - 2019-11-27 09:12:33

Animate to currentTargetOffset in reset method #8

2.0.1 - 2019-11-26 15:41:13

Add rubber band effect to the bottom target #7

2.0.0 - 2019-11-26 13:35:26

  • Improve threshold and offset calculations #5
  • Replace translationState function with array of models #6

1.0.0 - 2019-11-19 14:05:07

Initial release 🎉