Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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.

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 DrawerKit

struct ContentView: View {
@State private var showDrawer = false

var 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
}
}
}
}
}
}
}