FlexSheet is a flexible and customizable bottom sheet library for SwiftUI that provides both fixed and dynamic height bottom sheets with smooth animations and gesture interactions.
Flexible Bottom Sheet | Fixed Bottom Sheet |
---|---|
![]() |
![]() |
Features multiple snap points (90%, 50%, 25%) with smooth gesture interactions | Maintains constant height with spring animations |
- 🎯 Fixed height bottom sheets
- 📏 Flexible height bottom sheets with three snap points
- 💫 Smooth spring animations
- 🎨 Customizable appearance
- 🔄 Gesture-based interactions
- ♿️ Accessibility support
- 📱 iOS 15.0+ support
Add the following to your Package.swift
file:
https://github.com/hooni0918/FlexSheet.git
Or add it through Xcode:
- File > Add Packages
- Enter package URL:
https://github.com/hooni0918/FlexSheet.git
- Select version: 1.2.21 or higher
A simple bottom sheet with a constant height (default 40% of screen height)
import SwiftUI
import FlexSheet
struct ContentView: View {
var body: some View {
ZStack {
// Using default fixed style
FixedBottomSheet(style: .defaultFixed) {
Text("Fixed Bottom Sheet")
}
}
}
}
A bottom sheet with three snap points (90%, 50%, 25%) that can be dragged between positions.
import SwiftUI
import FlexSheet
struct ContentView: View {
@State private var sheetStyle: BottomSheetStyle = .minimal
var body: some View {
ZStack {
// Using default flexible style
FlexibleBottomSheet(
currentStyle: $sheetStyle,
style: .defaultFlex
) {
Text("Flexible Bottom Sheet")
}
}
}
}
FlexSheet provides three predefined styles for common use cases:
// Default fixed style - Standard fixed height sheet (40% of screen)
.defaultFixed
// Default flexible style - Basic animations and gestures
.defaultFlex
// Interactive flexible style - More responsive animations
.interactiveFlex
You can create custom styles for more control:
// Custom fixed style
let customFixedStyle = FlexSheetStyle(
animation: .spring(response: 0.3, dampingFraction: 0.7),
dragSensitivity: 500,
allowHide: false,
fixedHeight: UIScreen.main.bounds.height * 0.3
)
// Custom flexible style
let customFlexStyle = FlexSheetStyle(
animation: .spring(response: 0.4, dampingFraction: 0.9),
dragSensitivity: 400,
allowHide: true,
sheetSize: .half
)
Available heights for flexible bottom sheets:
.full
- 90% of screen height.half
- 50% of screen height.minimal
- 25% of screen height.notShow
- Completely hidde
- iOS 15.0+
- Swift 6.0+
- Xcode 15.0+
FlexSheet is available under the MIT license. See the LICENSE file for more info.
Ji-hoon Lee (이지훈)
If you have any questions or need help, please open an issue on GitHub.