Skip to content

This is a small View modifier that adds detents for native .sheet representations that appeared in iOS 16

Notifications You must be signed in to change notification settings

bartleby/SheetDetentsModifier

Repository files navigation

SheetDetentsModifier

This is a small View modifier that adds detents for .sheet representations that appeared in iOS 16

It works starting with iOS 15 ⚠️

Install

SwiftPM

https://github.com/bartleby/SheetDetentsModifier.git

Examples

struct ContentView: View {
    @State var showSheet: Bool = false
    var body: some View {
        VStack {
            Button("Show") {
                showSheet.toggle()
            }
        }
        .sheet(isPresented: $showSheet) {
            VStack {
                Button("Hide") {
                    showSheet.toggle()
                }
            }
            .presentationDetents([.medium, .large])
            .ignoresSafeArea() // To remove the white strip on the iPhone 10 
        }
    }
}

Make a star ❤️‍🔥

About

This is a small View modifier that adds detents for native .sheet representations that appeared in iOS 16

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages