https://github.com/swiftuiux/swiftui-bottomsheet-drawer
sliding panel, expandable bottom sheet, resizable drawer, adaptive bottom sheet, collapsible panel, modal swiftui sheet, sliding sheet, swift botom sheet, ios bottom sheet BottomSheet macos Custom modal popup menu bottomsheet, bottom sheet with scrollview, bottom sheet for map, ios, macos, watchos, visionos
https://github.com/swiftuiux/swiftui-bottomsheet-drawer
bottom ios
Last synced: 7 months ago
JSON representation
sliding panel, expandable bottom sheet, resizable drawer, adaptive bottom sheet, collapsible panel, modal swiftui sheet, sliding sheet, swift botom sheet, ios bottom sheet BottomSheet macos Custom modal popup menu bottomsheet, bottom sheet with scrollview, bottom sheet for map, ios, macos, watchos, visionos
- Host: GitHub
- URL: https://github.com/swiftuiux/swiftui-bottomsheet-drawer
- Owner: swiftuiux
- License: mit
- Created: 2022-07-22T14:54:49.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-09-20T08:16:16.000Z (9 months ago)
- Last Synced: 2024-11-28T18:41:37.655Z (7 months ago)
- Topics: bottom, ios
- Language: Swift
- Homepage:
- Size: 24.9 MB
- Stars: 28
- Watchers: 1
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Multiplatform (iOS, macOS) SwiftUI bottom sheet drawer
[](https://swiftpackageindex.com/swiftuiux/swiftui-bottomsheet-drawer)
## Features
- [x] It does not re-render the background content while manipulating with the sheet
- [x] iOS and macOS support
- [x] **dark** and **light** scheme support
- [x] Observing sheet positions on change if you need to react on it
- [x] Responsive for any size change It's important for macOS while window size changing
- [x] 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.
```swift
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```swift
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*```swift
@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
[](https://youtu.be/jLu7gbzGXTo)
[](https://youtu.be/jLu7gbzGXTo)
## 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**