Multiplatform (iOS, macOS) SwiftUI bottom sheet drawer. Expandable bottomsheet. Slide out bottom menu

Overview

Multiplatform (iOS, macOS) SwiftUI bottom sheet drawer

Features

  • It does not re-render the background content while manipulating with the sheet
  • iOS and macOS support
  • dark and light scheme support
  • Observing sheet positions on change if you need to react on it
  • Responsive for any size change It's important for macOS while window size changing
  • Customize component with your own specs

Creation

Put the component into an absolute coordinate space like ZStack or GeometryReader and just pass a content that's it to start with sheet drawer.

        ZStack {
            BottomSheet(content: Color.clear.background(.thinMaterial))
        }

Builder

You can use builder methods to change some specs

  • hideDragButton - Hide drag button
  • withoutAnimation - Turn off animation
        ZStack {
            BottomSheet(content: Color.clear.background(.thinMaterial))
            .hideDragButton()
            .withoutAnimation()
        }

Optional

  • shift - Visible height of the sheet drawer

  • topIndentation - Space from the very top to the max height drawer can reach

  • draggerHeight - Space sensitive for dragging

  • dragThresholdToAct - Dragging length after which trigger move to the next level depending on the direction of moving

Observing sheet positions

Observe sheet positions on change if you need to react on it in the external context of the component. For example to update layout of the drawer content according a new size of the height. Position BottomSheetPosition is passed with height of the sheet. height - is enum associated with value of type CGFloat

    @State private var position: BottomSheetPosition
    
        BottomSheet(
            content: SheetContentView(position: $position)
        )
        .onPositionChanged{
            position = $0
        }
Position Description
up(CGFloat) At the top
middle(CGFloat) At the middle
down(CGFloat) At the bottom

SwiftUI example of using package

Follow the link to get the example exposed in the video:

click to watch expected UI behavior for the example

click to watch expected UI behavior for the example

Documentation(API)

  • You need to have Xcode 13 installed in order to have access to Documentation Compiler (DocC)
  • Go to Product > Build Documentation or ⌃⇧⌘ D
You might also like...
A Google like action sheet for iOS written in Swift.
A Google like action sheet for iOS written in Swift.

MaterialActionSheetController Lightweight and totally customizable. Create and present it the way you do with UIAlertController. Screenshots Demo | De

This is a small View modifier that adds detents for native .sheet representations that appeared in iOS 16

SheetDetentsModifier This is a small View modifier that adds detents for .sheet representations that appeared in iOS 16 It works starting with iOS 15

A Swift library to provide a bouncy action sheet
A Swift library to provide a bouncy action sheet

Hokusai is a Swift library that provides a bouncy action sheet. It will give the users a fancy experience without taking pains coding the cool animati

Fully customizable and extensible action sheet controller written in Swift
Fully customizable and extensible action sheet controller written in Swift

XLActionController By XMARTLABS. XLActionController is an extensible library to quickly create any custom action sheet controller. Examples The action

Dice roller, character sheet/ creator, and monster/item info app on the iphone12

DnD-LordDogMaw This file will be the start of a side project in the hopes of creating an iphone12 app for Dungeons and Dragons! This app will have 3 m

Action sheet allows including your custom views and buttons.
Action sheet allows including your custom views and buttons.

CustomizableActionSheet Action sheet allows including your custom views and buttons. Installation CocoaPods Edit your Podfile: pod 'CustomizableAction

Present a sheet ViewController easily and control ViewController height with pangesture
Present a sheet ViewController easily and control ViewController height with pangesture

PanControllerHeight is designed to present a sheet ViewController easily and control ViewController height with pangesture.

Share-sheet-example - A sample project that reproduces an issue with Share Sheets

Hello, DTS! This project demonstrates the issue I'm having with the Share Sheet.

SplitSheet - A lightweight, fully interactive split-screen sheet.
SplitSheet - A lightweight, fully interactive split-screen sheet.

SplitSheet A lightweight, fully interactive split-screen sheet. Powered by UIScrollView for super-smooth gestures. Show/hide either programmatically o

Comments
  • Example link

    Example link

    Hi,

    Seems like a great custom sheet, however I can't figure out how you intended it to work without an example. Can you share an example maybe?

    The Readme says there is a link somewhere, but I can't find it.

    opened by edimoldovan 0
Owner
Igor
Software engineer
Igor
BottomSheet makes it easy to add custom bottom sheets to your SwiftUI apps.

BottomSheet About BottomSheet BottomSheet makes it easy to add custom bottom sheets to your SwiftUI apps. The result can look like this...or completel

Daniel Saidi 174 Jan 2, 2023
SwiftUI Draggable Bottom Sheet

SwiftUI Draggable Bottom Sheet

paigeshin 2 Mar 3, 2022
Custom-action-sheet- - Custom action sheet with swift

Custom-action-sheet- Usage let alertController: UIAlertControllerDimmed = UIAler

Girisankar G 0 Jan 19, 2022
BottomSheet Component 🧪🧪🧪

BCSComponent This Source code provide a bottom sheet which allow you custom own cell,you able to show it on the bottom sheet Get started First thing f

Kien Pham 3 Dec 1, 2022
Customizable Dynamic Bottom Sheet Library for iOS

DynamicBottomSheet Powerd by Witi Corp., Seoul, South Korea. Fully Customizable Dynamic Bottom Sheet Library for iOS. This library doesn't support sto

Witi Official 10 May 7, 2022
Bottom Sheet component is widely used in Joom application

Bottom Sheet Bottom Sheet component is widely used in Joom application Installation Swift Package Manager Swift Package Manager is a tool for managing

Joom 101 Dec 29, 2022
BottomSheetDemo - Bottom sheet modal view controller with swift

当我们想弹出一个预览视图,bottom sheet modal view controller 非常实用。在 iOS 中,长按拖拽手势可以让 controlle

null 8 Oct 29, 2022
DGBottomSheet - The lightest swift bottom sheet library

DGBottomSheet Requirements Installation Usage DGBottomSheet The lightest swift b

donggyu 9 Aug 6, 2022
An iOS library for SwiftUI to create draggable sheet experiences similar to iOS applications like Maps and Stocks.

An iOS library for SwiftUI to create draggable sheet experiences similar to iOS applications like Maps and Stocks.

Wouter 63 Jan 5, 2023
A SwiftUI Partial Sheet fully customizable with dynamic height

A SwiftUI Partial Sheet fully customizable with dynamic height

Andrea Miotto 1.4k Jan 5, 2023