Swiftpack.co - gaetanomatonti/BottomSheet as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by gaetanomatonti.
gaetanomatonti/BottomSheet 0.4.1
A BottomSheet component made with UIKit. Completely written in Swift 🧡
⭐️ 89
🕓 1 year ago
iOS
.package(url: "https://github.com/gaetanomatonti/BottomSheet.git", from: "0.4.1")

BottomSheet

A Bottom Sheet component made in UIKit.

Installation

Swift Package Manager

Xcode Project

To add a package dependency to your Xcode project, select File > Swift Packages > Add Package Dependency and enter the repository URL:

https://github.com/gaetanomatonti/BottomSheet

Swift Package

Edit your Package.swift file and add the repository URL to the dependencies.

dependencies: [
    .package(url: "https://github.com/gaetanomatonti/BottomSheet", .upToNextMajor(from: "0.4.0"))
]

Usage

Presentation

Inside your view controller store a new instance of SheetTransitioningDelegate. When presenting a new view controller you should set its modalPresentationStyle to .custom and its transitioningDelegate to the SheetTransitioningDelegate you stored.

let sheetTransitioningDelegate = SheetTransitioningDelegate()

func presentViewController() {
  let viewController = UIViewController()
  viewController.modalPresentationStyle = .custom
  viewController.transitioningDelegate = sheetTransitioningDelegate
  present(viewController, animated: true)
}

Dismissal

The sheet can be dismissed interactively by the user by dragging the sheet towards the bottom of the screen or by tapping on the area outside of the sheet. It can also be dismissed programmatically just like any other view controller.

func dismissSheet() {
  dismiss(animated: true)
}

GitHub

link
Stars: 89
Last commit: 1 year ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

[Minor] Bugfixes
1 year ago

Description

This release fixes a bug where dismissing a sheet presented with the SheetPresentationController wouldn't work.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics