All Projects → danielsaidi → BottomSheet

danielsaidi / BottomSheet

Licence: MIT License
BottomSheet lets you add custom bottom sheets to your SwiftUI apps.

Programming Languages

swift
15916 projects
ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to BottomSheet

MultiModal
Use multiple .sheet, .alert, etc. modifiers in the same SwiftUI View
Stars: ✭ 49 (-55.86%)
Mutual labels:  sheet, swiftui
React Native Bottom Sheet
A performant interactive bottom sheet with fully configurable options 🚀
Stars: ✭ 2,695 (+2327.93%)
Mutual labels:  bottomsheet, sheet
Stickytabbarviewcontroller
Sticky and Collapsible View on top of tab bar
Stars: ✭ 82 (-26.13%)
Mutual labels:  ui-components, bottomsheet
react-spring-bottom-sheet
Accessible ♿️, Delightful ✨, & Fast 🚀
Stars: ✭ 604 (+444.14%)
Mutual labels:  bottomsheet, sheet
BottomSheet
A sliding Sheet from the bottom of the Screen with 3 States build with SwiftUI.
Stars: ✭ 597 (+437.84%)
Mutual labels:  bottomsheet, swiftui
SwimplyPlayIndicator
Animated PlayIndicator written in SwiftUI. Inspired by Apple's Music Player.
Stars: ✭ 52 (-53.15%)
Mutual labels:  ui-components, swiftui
SwiftUI-Color-Kit
SwiftUI Color Pickers, Gradient Pickers And All The Utilities Needed To Make Your Own!
Stars: ✭ 120 (+8.11%)
Mutual labels:  ui-components, swiftui
DynamicOverlay
A SwiftUI library that makes easier to develop overlay based interfaces, such as the one presented in the Apple Maps app.
Stars: ✭ 90 (-18.92%)
Mutual labels:  sheet, swiftui
ios-swift-chat-ui-kit
Ready-to-use Chat UI Components for Swift (iOS)
Stars: ✭ 42 (-62.16%)
Mutual labels:  ui-components
bui
‹b› Web components for creating applications – built by Blackstone Publishing using lit-html and lit-element
Stars: ✭ 29 (-73.87%)
Mutual labels:  ui-components
CherryLib
Win32/MFC UI Control, Live Update, Utility Library
Stars: ✭ 19 (-82.88%)
Mutual labels:  ui-components
ui
💁‍♀️ Inclusive Vue Components
Stars: ✭ 27 (-75.68%)
Mutual labels:  ui-components
GITGET
GitHub의 Contributions를 iOS의 Widget으로 보여주는 App
Stars: ✭ 101 (-9.01%)
Mutual labels:  swiftui
MyFavoriteB
macOS上的B站民间客户端
Stars: ✭ 33 (-70.27%)
Mutual labels:  swiftui
CCheckbox-iOS
CCheckbox is a custom UIView which represents custom checkbox component with custom images
Stars: ✭ 28 (-74.77%)
Mutual labels:  ui-components
RichText
Easily show RichText(html) in SwiftUI
Stars: ✭ 25 (-77.48%)
Mutual labels:  swiftui
Laden
SwiftUI loading indicator view
Stars: ✭ 23 (-79.28%)
Mutual labels:  swiftui
Actions
⚙️ Supercharge your shortcuts
Stars: ✭ 640 (+476.58%)
Mutual labels:  swiftui
NativeMarkKit
NativeMark is a flavor of Markdown designed to be rendered by native apps.
Stars: ✭ 36 (-67.57%)
Mutual labels:  swiftui
mocka
Mocka — A Mock Server Made for Developers by Developers, made in Swift ❤️
Stars: ✭ 56 (-49.55%)
Mutual labels:  swiftui

BottomSheet


Version Platform Swift 5.3 MIT License Twitter: @danielsaidi

About BottomSheet

BottomSheet makes it easy to add custom bottom sheets to your SwiftUI apps.

The result can look like this...or completely different:

These sheets have a default style, but can be customized to fit your specific app.

Installation

Swift Package Manager

https://github.com/danielsaidi/BottomSheet.git

CocoaPods

pod DSBottomSheet

How does it work

BottomSheet contains a BottomSheet SwiftUI view, that can be created with an isExpanded binding, a minHeight and maxHeight and a style.

let sheet = BottomSheet(
    isExpanded: $isSheetExpanded,
    minHeight: .points(100),
    maxHeight: .available,
    style: .standard
)

Once you have a sheet view, you can add it to any view, using the bottomSheet modifier:

List(items) { item
   HStack { item.name }
}.bottomSheet(sheet)

The sheet will be added above the view and docked to the bottom. The sheet can now be either swiped up or expanded and collapsed by tapping the handle.

Heights

BottomSheet is created with a minHeight and maxHeight, which are BottomSheetHeight enums with these cases:

  • available - the total available height
  • percentage - a percentage of the total available height
  • points - a fixed number of points

You can set these to control how tall your sheet can become and how much it can collapse. You can change these properties at any time.

Styling

BottomSheet is created with a style, which is a BottomSheetStyle with these properties:

  • color - the color of the sheet
  • cornerRadius - the corner radius of the sheet
  • modifier - the modifier to apply to the sheet
  • snapRatio - the percent of the max height, after which the sheet slides to the full height
  • handleStyle - the bottom sheet's handle style

You can define your own bottom sheet and ottom sheet handle styles and apply them when creating a sheet.

Important

This library uses resource-based colors, which aren't available to SwiftUI previews outside of this library.

Make sure to always use the .preview style when previewing a sheet.

Demo app

This repo contains a basic demo app that demonstrates how to use the bottom sheet.

Just open the Demo project and run the app.

Acknowledgements

This library is based on this amazing gist by @mecid. It would not have been made without him, so big thanks for putting that gist out into the world.

Contact me

Feel free to reach out if you have questions or if you want to contribute in any way:

License

BottomSheet is available under the MIT license. See LICENSE file for more info.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].