A SwiftUI bottom-up controller, like in the Maps app. Drag to expand or minimize.
File > Swift Packages > Add Package Dependency: https://github.com/maustinstar/swiftui-drawer
Add a dependency in your your Package.swift
.package(url: "https://github.com/maustinstar/swiftui-drawer.git", from: "0.1.0"),
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.
ZStack {
ScrollView {
//...
}
Drawer(heights: [100, 340]) {
Color.blue
}.edgesIgnoringSafeArea(.vertical)
}
See the full Reference Guide.
A multi-height drawer with haptic impact.
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
Take your SwiftUI apps to the next level with these Packages!
- Michael Verges - Initial work - mverges3@gatech.edu