Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/armondschneider/drawerkit
DrawerKit is a lightweight and customizable Swift package that provides smooth, animated bottom drawers for iOS applications. It simplifies the process of adding a modern drawer interface with a few lines of code.
https://github.com/armondschneider/drawerkit
ios swift-framework swiftui
Last synced: 3 months ago
JSON representation
DrawerKit is a lightweight and customizable Swift package that provides smooth, animated bottom drawers for iOS applications. It simplifies the process of adding a modern drawer interface with a few lines of code.
- Host: GitHub
- URL: https://github.com/armondschneider/drawerkit
- Owner: armondschneider
- License: mit
- Created: 2024-10-21T18:22:55.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2024-10-27T22:22:55.000Z (3 months ago)
- Last Synced: 2024-10-28T02:16:57.582Z (3 months ago)
- Topics: ios, swift-framework, swiftui
- Language: Swift
- Homepage:
- Size: 41 KB
- Stars: 6
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# DrawerKit
**DrawerKit** is a lightweight and customizable Swift package that provides smooth, animated bottom drawers for iOS applications. It simplifies the process of adding a modern drawer interface with a few lines of code.
## Features
- **Smooth slide-up animation**
- **Swipe to dismiss with spring effect**
- **Customizable height and content**
- **Supports safe area insets for iPhones with home indicators**## Installation
### Swift Package Manager
To install DrawerKit, follow these steps:
1. In Xcode, go to **File > Add Packages...**
2. Enter the GitHub URL for the DrawerKit repository:
3. Select the version and add it to your project.## Usage
### Basic Example
Here’s how you can use `DrawerView` in your SwiftUI project:
```swift
import SwiftUI
import DrawerKitstruct ContentView: View {
@State private var showDrawer = falsevar body: some View {
ZStack {
Color.gray.opacity(0.3)
.ignoresSafeArea()Button("Toggle Drawer") {
withAnimation {
showDrawer.toggle()
}
}
.font(.headline)
.foregroundColor(.white)
.padding()
.background(Color.blue)
.cornerRadius(12)DrawerView(isPresented: $showDrawer, heightRatio: 0.4) {
VStack {
Text("Drawer Content")
.font(.title)
.padding(.bottom, 10)
Button("Close Drawer") {
withAnimation {
showDrawer = false
}
}
}
}
}
}
}