Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/maustinstar/swiftui-drawer
A SwiftUI bottom-up controller, like in the Maps app. Drag to expand or minimize.
https://github.com/maustinstar/swiftui-drawer
ios macos swift5 swiftui ui ui-components ux
Last synced: 5 days ago
JSON representation
A SwiftUI bottom-up controller, like in the Maps app. Drag to expand or minimize.
- Host: GitHub
- URL: https://github.com/maustinstar/swiftui-drawer
- Owner: maustinstar
- License: mit
- Created: 2020-07-14T20:21:18.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-03-21T19:26:29.000Z (almost 3 years ago)
- Last Synced: 2024-10-11T21:43:35.774Z (2 months ago)
- Topics: ios, macos, swift5, swiftui, ui, ui-components, ux
- Language: Swift
- Homepage:
- Size: 3.3 MB
- Stars: 927
- Watchers: 12
- Forks: 36
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
- awesome-swiftui-libraries - SwiftUI Drawer - A SwiftUI bottom-up (Sheet / Content)
README
# SwiftUI Drawer
A SwiftUI bottom-up controller, like in the Maps app. Drag to expand or minimize.
## Contents
- [Add the Package](#package)
- [Basic Usage](#basic-usage)
- [Examples](#examples)
- [Credits](#credits)## Package
### For Xcode Projects
File > Swift Packages > Add Package Dependency: https://github.com/maustinstar/swiftui-drawer
### For Swift Packages
Add a dependency in your your `Package.swift`
```swift
.package(url: "https://github.com/maustinstar/swiftui-drawer.git", from: "0.1.0"),
```## Basic Usage
Embed your view content in a `ZStack` with the Drawer as the last element. The `heights` parameter defines a list of resting heights for the drawer.
```swift
ZStack {ScrollView {
//...
}
Drawer(heights: [100, 340]) {
Color.blue
}.edgesIgnoringSafeArea(.vertical)
}
```**See the full [Reference Guide](https://github.com/maustinstar/swiftui-drawer/blob/master/Docs/Reference.md).**
## Examples
A multi-height drawer with haptic impact.
```swift
Drawer {
ZStack {
RoundedRectangle(cornerRadius: 12)
.foregroundColor(.white)
.shadow(radius: 100)
VStack(alignment: .center) {
Spacer().frame(height: 4.0)
RoundedRectangle(cornerRadius: 3.0)
.foregroundColor(.gray)
.frame(width: 30.0, height: 6.0)
Spacer()
}
}
}.edgesIgnoringSafeArea(.vertical)
.rest(at: .constant([100, 340, UIScreen.main.bounds.height - 40]))
.impact(.light)
```
**See more [Examples](https://github.com/maustinstar/swiftui-drawer/blob/master/Docs/Examples.md)**## 🚀 Looking for more fun SwiftUI Packages?
**Take your SwiftUI apps to the next level with these Packages!**
## Credits
* [**Michael Verges**](https://github.com/maustinstar) - *Initial work* - [email protected]