BottomSheet-SwiftUI

master

BottomSheet view in SwiftUI
shirokova/bottomsheet-swiftui

BottomSheet-SwiftUI

BottomSheet view in SwiftUI

Based on: https://gist.github.com/mecid/78eab34d05498d6c60ae0f162bfd81ee

Usage

import SwiftUI
import BottomSheet_SwiftUI

struct ContentView: View {
    @State private var bottomSheetOpened = false
    var body: some View {
        GeometryReader { geometry in
            Color.green
                .edgesIgnoringSafeArea(.all)
            BottomSheet(
                isOpen: self.$bottomSheetOpened,
                config: BottomSheetConfig(maxHeight: geometry.size.height * 0.9)
            ) {
                Color.white
            }
        }.edgesIgnoringSafeArea(.all)
    }
}

Default config values

minHeightRatio: 0.2,
maxHeight: 300,
radius: 20,
indicatorSize: width: 100, height: 5,
snapRatio: 0.1,
indicatorColor: black,
indicatorBackgroundColor: white

Installation

Swift Package Manager

BottomSheet-SwiftUI is SwiftPM-compatible. To install, add this package to your Package.swift or your Xcode project.

Description

  • Swift Tools 5.2.0
View More Packages from this Author

Dependencies

  • None
Last updated: Fri Oct 18 2024 19:30:07 GMT-0900 (Hawaii-Aleutian Daylight Time)