Swiftpack.co - adamfootdev/BottomSheet as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
Access UISheetPresentationController in SwiftUI on iOS 15 using a simple .bottomSheet modifier.
.package(url: "https://github.com/adamfootdev/BottomSheet.git", from: "0.2.3")


Feature Graphic Platform

BottomSheet makes it easy to take advantage of the new UISheetPresentationController in SwiftUI with a simple .bottomSheet modifier on existing views.

  1. Requirements
  2. Integration
  3. Usage


  • iOS 15+
  • Xcode 13+


Swift Package Manager

BottomSheet can be added to your app via Swift Package Manager in Xcode using the following configuration:

dependencies: [
    .package(url: "https://github.com/adamfootdev/BottomSheet.git", from: "0.1.3")


To get started with BottomSheet, you'll need to import the framework first:

import BottomSheet

Presenting the Sheet

You can then apply the .bottomSheet modifier to any SwiftUI view, ensuring you attach a binding to the isPresented property - just like the standard .sheet modifier:

.bottomSheet(isPresented: $isPresented) {
    Text("Hello, world!")

BottomSheet also supports passing an Optional item to it, displaying the sheet if the item is not nil:

.bottomSheet(item: $item) {
    Text("Hello, world!")

Customizing the Sheet

BottomSheet can be customized in the same way a UISheetPresentationController can be customized in UIKit. This is done by specifying additional properties in the modifier:

    isPresented: $isPresented,
    detents: [.medium(), .large()],
    largestUndimmedDetentIdentifier: .large,
    prefersGrabberVisible: true,
    prefersScrollingExpandsWhenScrolledToEdge: true,
    prefersEdgeAttachedInCompactHeight: false,
    widthFollowsPreferredContentSizeWhenEdgeAttached: false,
    onDismiss: { print("Dismissed") }
) {
    Text("Hello, world!")

For more information on UISheetPresentationController, read Apple's documentation: https://developer.apple.com/documentation/uikit/uisheetpresentationcontroller

Please note BottomSheet is currently missing the ability to be resized programmatically as the delegate doesn't work in iOS 15 beta 1. You may also run into issues when used on an iPad with multi-window support and have multiple instances of the same app side-by-side running.


Stars: 225
Last commit: 1 week ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Submit a free job ad (while I'm testing this). The analytics numbers for this website are here.

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