A SwiftUI Partial Sheet fully customizable with dynamic height

Overview

PartialSheet

A custom SwiftUI modifier to present a Partial Modal Sheet based on his content size.

Version 2.0 has been released, there are a lot of breaking changes, make sure to read the guide before update!

Index

iPhone Preview

iPad Preview

Mac Preview

Features

Availables

  • Slidable and dismissable with drag gesture
  • Variable height based on his content
  • Customizable colors
  • Keyboard compatibility
  • Landscape compatibility
  • iOS compatibility
  • iPad compatibility
  • Mac compatibility

Nice to have

  • ScrollView and List compatibility: as soon as Apple adds some API to handle better ScrollViews

Version 2

The new version brings a lot of breaking changes and a lot of improvments:

  • The Partial Sheet can now be called from any view in the navigation stack
  • The Partial Sheet can now be called from any item inside a List
  • The Partial Sheet is now handled as an environment object making easy to display and close it.

Installation

Requirements

  • iOS 13.0+ / macOS 10.15+
  • Xcode 11.2+
  • Swift 5+

Via Swift Package Manager

In Xcode 11 or grater, in you project, select: File > Swift Packages > Add Pacakage Dependency.

In the search bar type PartialSheet and when you find the package, with the next button you can proceed with the installation.

If you can't find anything in the panel of the Swift Packages you probably haven't added yet your github account. You can do that under the Preferences panel of your Xcode, in the Accounts section.

How to Use

You can read more on the wiki - full guide.

To use the Partial Sheet you need to follow just three simple steps

  1. Add a Partial Sheet Manager instance as an environment object to your Root View in you SceneDelegate
// 1.1 Create the manager
let sheetManager: PartialSheetManager = PartialSheetManager()
let contentView = ContentView()
    // 1.2 Add the manager as environmentObject
    .environmentObject(sheetManager)

//Common SwiftUI code to add the rootView in your rootViewController
if let windowScene = scene as? UIWindowScene {
    let window = UIWindow(windowScene: windowScene)
    window.rootViewController = UIHostingController(
        rootView: contentView
    )
    self.window = window
    window.makeKeyAndVisible()
}
  1. Add the Partial View to your Root View, and if you want give it a style. In your RootView file at the end of the builder add the following modifier:
struct ContentView: View {

    var body: some View {
       ...
       .addPartialSheet(style: <PartialSheetStyle>)
    }
}
  1. In anyone of your views add a reference to the environment object and than just call the showPartialSheet (_ onDismiss: (() -> Void)? = nil, @ViewBuilder content: @escaping () -> T) where T: View func whenever you want like this:
@EnvironmentObject var partialSheetManager: PartialSheetManager

...

Button(action: {
    self.partialSheetManager.showPartialSheet({
        print("Partial sheet dismissed")
    }) {
         Text("This is a Partial Sheet")
    }
}, label: {
    Text("Show sheet")
})

You can also show the Partial Sheet using a view modifier:

@State var isSheetShown = false

...

Button(action: {
    self.isSheetShown = true
}, label: {
    Text("Display the ViewModifier sheet")
})
.partialSheet(isPresented: $isSheetShown) {
    Text("This is a Partial Sheet")
}

If you want a starting point copy in your SceneDelegate and in your ContentView files the following code:

  1. SceneDelegate:
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
    let sheetManager: PartialSheetManager = PartialSheetManager()
    let contentView = ContentView()
        .environmentObject(sheetManager)
    if let windowScene = scene as? UIWindowScene {
        let window = UIWindow(windowScene: windowScene)
        window.rootViewController = UIHostingController(
            rootView: contentView
        )
        self.window = window
        window.makeKeyAndVisible()
    }
}
  1. ContentView:
import SwiftUI
import PartialSheet

struct ContentView: View {

    @EnvironmentObject var partialSheet : PartialSheetManager

    var body: some View {
        NavigationView {
            VStack(alignment: .center) {
                Spacer()
                    Button(action: {
                        self.partialSheet.showPartialSheet({
                            print("dismissed")
                        }) {
                            Text("Partial Sheet")
                        }
                    }, label: {
                        Text("Show Partial Sheet")
                    })
                Spacer()
            }
            .navigationBarTitle("Partial Sheet")
        }
        .navigationViewStyle(StackNavigationViewStyle())
        .addPartialSheet()
    }
}


struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        ContentView()
    }
}

Remember to always add import PartialSheet in every file you want to use the PartialSheet.

In the Example directory you can find more examples with more complex structures.

Using Pickers

When using pickers it is needed to register an onTapGesture. This some how makes the picker being able to reconize the drag before the dragGesture on the sheet.

struct PickerSheetView: View {
    var strengths = ["Mild", "Medium", "Mature"]
    @State private var selectedStrength = 0

    var body: some View {
        VStack {
            VStack {
                Text("Settings Panel").font(.headline)
                Picker(selection: $selectedStrength, label: EmptyView()) {
                    ForEach(0 ..< strengths.count) {
                        Text(self.strengths[$0])
                    }
                }.onTapGesture {
                    // Fixes issue with scroll
                }
            }
            .padding()
            .frame(height: 250)
        }
    }
}
Comments
  • Button is not working inside ScrollView

    Button is not working inside ScrollView

    I have content for SheetView inside a ScrollView. And under ScrollView there are few UI elements and one button. So when the view loaded the first time the button is not working. But after doing the scroll event the button starts working. Here is my code,

    //Main ContentView `var body: some View {

        HStack {
            Spacer()
            Button(action: {
                self.partialSheetManager.showPartialSheet({
                     print("normal sheet dismissed")
                }) {
                     SheetView()
                }
            }, label: {
                Text("Display the Partial Sheet")
            })
        }
    }`
    

    //SheetView

    `struct SheetView: View { var body: some View { VStack {

            ScrollView {
                Text("Hello")
                
                Button(action: {
                    print("Button is tapping")
                }) {
                    Text("Tap Here")
                }
            }
        }
    }
    

    }`

    bug help wanted 
    opened by hyder50 21
  • Animation is applied on sheet view and is propagated down to the content

    Animation is applied on sheet view and is propagated down to the content

    There is this set on the sheet view: .animation(self.dragState.isDragging ? nil : .interpolatingSpring(stiffness: 300.0, damping: 30.0, initialVelocity: 10.0)) which applies animation to the content of the sheet. In my case, I have views which are hidden and shown depending on the state in the sheet content and now they are automatically animated.

    Per Apple's documentation on animation(_:): Use this modifier on leaf views rather than container views. The animation applies to all child views within this view; calling animation(_:) on a container view can lead to unbounded scope.

    Basically, setting this on the the container (sheet view) is an anti-pattern. I think, explicit property animation should be used instead, this way no matter what the content is provided to the PartialSheet, it will not be affected.

    bug help wanted 
    opened by NeverwinterMoon 13
  • Text Field not editable and Switch not working

    Text Field not editable and Switch not working

    I'm seeing an odd behavior on the sample app with the Normal example. I can't edit the Textfield and I can't select the Toggle. I've tested it on a device and several iOS Simulators. Because I can't select the toggle, the drawer doesn't slide up like the sample video.

    It does work fine on the macOS side however.

    I'm using XCode 12.3 on macOS Big Sur with M1.

    opened by nneuberger1 10
  • `.partialSheet` view modifier does not present the PartialSheet if being called rapidly

    `.partialSheet` view modifier does not present the PartialSheet if being called rapidly

    First of all, thank you for making such a great library! I would like to report a bug and get any idea of how to fix.

    Issue

    When using .partialSheet view modifier, if I tap the button to open, then tap outside to close the PartialSheet rapidly, it will not open anymore at some point.

    • Video of the behavior (I tapped the button rapidly)

    https://user-images.githubusercontent.com/8290104/110073982-bf821480-7dc3-11eb-9819-560ca24ef1e0.mp4

    Code to reproduce

    import PartialSheet
    import SwiftUI
    
    @main
    struct myApp: App {
        var body: some Scene {
            let contentView = ContentView()
                .environmentObject(PartialSheetManager())
    
            WindowGroup {
                contentView
            }
        }
    }
    
    
    struct ContentView: View {
        @EnvironmentObject var partialSheetManager: PartialSheetManager
        @State var isPresented: Bool = false
    
        var body: some View {
            VStack {
                Button(action: {
                    isPresented = true
                }, label: {
                    Text("Button")
                })
                .padding()
                Spacer()
            }
            .addPartialSheet()
            .partialSheet(isPresented: $isPresented) {
                Text("PartialSheet")
            }
        }
    }
    

    Cause

    In PartialSheetViewModifier.swift I found that both savedValue and value in update function would always become true at a certain point. Therefore the PartialSheet view does not get updated and not presented.

        // hack around .onChange not being available in iOS13
        class Model {
            private var savedValue: Bool?
            func update(value: Bool) -> Bool {
                print("savedValue: \(savedValue), newValue: \(value)")
                guard value != savedValue else { return false }
                savedValue = value
                return true
            }
        }
    

    Log

    savedValue: nil, newValue: false
    savedValue: Optional(false), newValue: false
    savedValue: Optional(false), newValue: false
    savedValue: Optional(false), newValue: false
    savedValue: Optional(false), newValue: false
    savedValue: Optional(false), newValue: false
    savedValue: Optional(false), newValue: false
    savedValue: Optional(false), newValue: false
    savedValue: Optional(false), newValue: false
    savedValue: Optional(false), newValue: false
    savedValue: Optional(false), newValue: true
    --- From here no matter how many times I press the button, both values are always `true`. ---
    savedValue: Optional(true), newValue: true
    savedValue: Optional(true), newValue: true
    savedValue: Optional(true), newValue: true
    savedValue: Optional(true), newValue: true
    savedValue: Optional(true), newValue: true
    savedValue: Optional(true), newValue: true
    savedValue: Optional(true), newValue: true
    savedValue: Optional(true), newValue: true
    savedValue: Optional(true), newValue: true
    savedValue: Optional(true), newValue: true
    savedValue: Optional(true), newValue: true
    savedValue: Optional(true), newValue: true
    savedValue: Optional(true), newValue: true
    savedValue: Optional(true), newValue: true
    

    What I tried

    I tried changing the body of PartialSheetAddView struct to observe isPresented value with native .onChange for iOS 14 but it won't fix.

        var body: some View {
            if #available(iOS 14, *) {
                return AnyView(base
                    .onChange(of: isPresented) { value in
                    DispatchQueue.main.async(execute: updateContent)
                })
            } else {
                if model.update(value: isPresented) {
                    DispatchQueue.main.async(execute: updateContent)
                }
                return AnyView(base)
            }
        }
        
    

    Workaround

    Presenting PartialSheet with showPartialSheet() method seems to work fine.

    opened by chuymaster 8
  • No way to initialise PartialSheet using binding starting 2.0

    No way to initialise PartialSheet using binding starting 2.0

    I have looked at the library before, but have never used it. Now I've decided to use it and, as I understand, starting from 2.0, it's not possible to initialise PartialSheet using a binding, and is possible only using a user action (pressing a button and calling the sheet action there). If this is indeed so, I think it's a bit of a downgrade and is not in line with the SwiftUI approach.

    I use global state for my navigation, so before, I could configure the state (in case of deep linking, for instance) and this way navigate to any of the views, including an opened sheet. Now it looks like I can't do that.

    enhancement help wanted 
    opened by NeverwinterMoon 8
  • Crash when PartialSheet used on a view presented as

    Crash when PartialSheet used on a view presented as "sheet"

    Issue: We have hit a crash when using PartialSheet in a screen presented as a sheet.

    Evinronment: We do setup PartialSheet according to documentation - registering instance of PartialSheetManager as an environment object on a RootView in SceneDelegate. It does work as intended for the tabs and for the pushed screens. But when we try to use it in a sheet we got a lot of crashes at a different times. E.g. app may crash after dismissing a sheet or after multiple taps on a TextEditor view, even if partial sheet wasn't presented at all.

    let contentView = RootScreen(dependencies: environment.container)
        .environmentObject(PartialSheetManager())
    
    if let windowScene = scene as? UIWindowScene {
        let window = UIWindow(windowScene: windowScene)
        window.rootViewController = UIHostingController(rootView: contentView)
        self.window = window
        window.makeKeyAndVisible()
    }
    

    The crash happens because at some point when SwiftUI rebuilds body of a screen there is no PartialSheetManager available in environment anymore. PartialSheet crash

    Workaround: After ~3 hours of trial-and-error we finally were able to find a working solution: re-adding shared instance of PartialSheetManager on every view via a custom modifier:

    extension View {
        @ViewBuilder func addPartialSheetManager() -> some View {
            // Executes closure if object is not `nil`.
            modifier(for: SceneDelegate.current?.partialSheetManager) { view, manager in
                view.environmentObject(manager)
            }
        }
    }
    

    And then in the view presented as a sheet:

    struct SheetScreen: View {
        @State private var isPartialSheetShown = false
    
        var body: some View {
            ZStack {
                VStack {
                    // SCREEN CONTENT
                }
                .addPartialSheet()
                .partialSheet(isPresented: $isPartialSheetShown) {
                    // PARTIAL SHEET CONTENT
                }
            }
            .addPartialSheetManager()
        }
    }
    

    Conclusion: Not sure if this is the issue with PartialSheet library or with SwiftUI itself. It would be great to get some insight from the creator of this amazing library. 🤓🙇‍♂️

    Thank you.

    help wanted 
    opened by SergejLogis 7
  • Enhancement: is it possible to put the partial sheet on the top of the Tab View?

    Enhancement: is it possible to put the partial sheet on the top of the Tab View?

    The partial sheet looks great. I was wondering whether it is possible to put it on the top of the Tab View. The built-in sheet is covering the Tab View when opening.

    The partial sheet on the top of the Tab View enhancement 
    opened by phuhuynh2411 7
  • NavigationView can't be embedded inside PartialSheet

    NavigationView can't be embedded inside PartialSheet

    In the standard Apple sheet, one can have a NavigationView inside the sheet, the same should be possible with PartialSheet.

    In the code example below, you can see the behavior difference, in particular, in PartialSheet all actions become non-responsive when the NavigationView is open.

    import SwiftUI
    import PartialSheet
    
    struct ExperimentAppleSheet: View {
        
        @State var isModalSheetShown: Bool = false
        @State var isPage1Active: Bool = false
        
        var body: some View {
            VStack {
                
                Button(action: {
                    self.isModalSheetShown.toggle()
                }) {
                    Text("Open sheet")
                }
            }
            .sheet(isPresented: self.$isModalSheetShown) {
                NavigationView {
                    VStack {
                        Text("Modal")
                        NavigationLink(destination: Text("page 1"), isActive: self.$isPage1Active, label: {
                            Button(action: {
                                self.isPage1Active.toggle()
                            }) {
                                Text("Go to next page")
                            }
                        })
                    }
                    .navigationBarItems(trailing: Button("Done",
                                                         action: {
                                                            self.isModalSheetShown.toggle()
                    }))
                }
            }
        }
    }
    
    struct ExperimentPartialSheet: View {
        
        @State var isPage1Active: Bool = false
        @EnvironmentObject var partialSheetManager: PartialSheetManager
        
        var body: some View {
            VStack {
                
                Button(action: {
                    self.partialSheetManager.showPartialSheet({
                        print("Partial sheet opened")
                    }) {
                        NavigationView {
                            VStack {
                                Text("Modal")
                                NavigationLink(destination: Text("page 1"), isActive: self.$isPage1Active, label: {
                                    Button(action: {
                                        self.isPage1Active.toggle()
                                    }) {
                                        Text("Go to next page")
                                    }
                                })
                            }
                            .navigationBarItems(trailing: Button("Done",
                                                                 action: {
                                                                    self.partialSheetManager.closePartialSheet()
                            }))
                        }
                    }
                }) {
                    Text("Open sheet")
                }
            }
            .addPartialSheet(style: PartialSheetStyle(background: .solid(Color.white),
                                                      handlerBarColor: Color(UIColor.systemGray2),
                                                      enableCover: true,
                                                      coverColor: Color.black.opacity(0.4),
                                                      blurEffectStyle: nil,
                                                      cornerRadius: 10))
        }
    }
    
    
    struct Experiment_Previews: PreviewProvider {
        static var previews: some View {
            ExperimentAppleSheet()
    //        ExperimentPartialSheet().environmentObject(PartialSheetManager()) // uncomment and comment line above to switch
        }
    }
    
    bug help wanted 
    opened by spiez 6
  • Crash When PartialSheet Appears Again?

    Crash When PartialSheet Appears Again?

    PartialSheet is awesome and your work on 2.0 has been terrific! Thank you for what you are doing!

    I have a bug in my prototype app. I do not know if it is caused by PartialSheet. I'm not as familiar with Xcode as I would like to be, and so you may want to ask me for more information.

    Here is the setup:

    • I have a SwiftUI view called ViewA() that has a form. In that form is a view called MapVIew() that contains an MKMapView via UIViewRepresentable. MapView() has several params, one of which is a Bool for editing. MapView() within the form on ViewA() is not editable.
    • When the user taps on the MapView() in the form on ViewA(), a NavigationLInk pushes a new view, ViewB(), that contains a new instance of MapView() with the MKMapView, but this time it is editable.
    • In ViewB(), the user can center the user location, bring up a settings PartialSheet, and drop a pin by long-pressing on the MKMapView contained within MapView().
    • Within the settings PartialSheet, the user can change the map type (Standard, Satellite, Hybrid) and drop a pin exactly on the user's current location.
    • If the user taps on a dropped pin, detail about that pin is shown on another PartialSheet, including the reverse geocoded street address, the latitude, and the longitude. This PartialSheet also contains a button to remove the pin.
    • Only 1 dropped pin is shown at a time on the map. If the user drops another pin at the user location or long-presses on another location in the MKMapView, any pin that already exists is removed.
    • Both PartialSheets are closed by calling .closePartialSheet() on the PartialSheetManager environment object.
    • The MapView() instance on ViewA() and the MapView() instance on ViewB() show the same MKMapView data, including user location and a dropped pin, if it exists. The only differences which MapView() is editable and the sizes of the MapView() instances are different in ViewA() vs. ViewB().

    A description of the problem:

    • As long as I stay on ViewB(), I can bring up the settings PartialSheet and drop pins on the user location as much as I would like. I can also drop as many pins as needed (one at a time) at other locations on the MKMapView and bring up the pin detail PartialSheet for each one without any problems.
    • However, if I back out ViewB() to the parent ViewA() with the form, tap on the MapView() in the form to go back to ViewB(), and then either 1) bring up the settings PartialSheet, or 2) show pin detail by tapping on the pin, the app crashes with Thread 1: EXC_BREAKPOINT (code=1, subcode=0x1da55a12c).
    • Clarification: The crash occurs only after a PartialSheet is opened and closed on ViewB(), returning to ViewA(), going back to ViewB() and opening a PartialSheet.
    • In both crashes, the PartialSheet does not show before the crash.
    • This crash did not occur when I was using v1.0.3 of PartialSheet. It only appeared after I started using v2.1. (That doesn't mean I did not create a problem in my code when converting it to accommodate PartialSheet changes from 1.0.3 to 2.1.)
    • The code to bring up the settings PartialSheet and the pin detail PartialSheet are in two different files. The settings PartialSheet code is in ViewB() and the pin detail PartialSheet is in MapView().
    • When I print stack traces for both crashes, it appears to be caused by the same code location in SwiftUI. (SwiftUI 0x00000001da5600f0 3652361F-29A7-3130-AB4A-72A5F7BB506B + 5628144) The stack traces are pasted below.

    Would it be possible that PartialSheet has a common bug that causes both crashes? What other information do you need from me?

    Thank you very much for your help.

    Jim


    Crash with bringing up Map Settings PartialSheet

    ▿ 33 elements

    0 : "0 ??? 0x000000011622466c 0x0 + 4666312300" 1 : "1 Cardigan 0x0000000104d69390 main + 0" 2 : "2 SwiftUI 0x00000001da5600f0 3652361F-29A7-3130-AB4A-72A5F7BB506B + 5628144" 3 : "3 SwiftUI 0x00000001da4152a0 3652361F-29A7-3130-AB4A-72A5F7BB506B + 4272800" 4 : "4 SwiftUI 0x00000001da5600f0 3652361F-29A7-3130-AB4A-72A5F7BB506B + 5628144" 5 : "5 SwiftUI 0x00000001da4152a0 3652361F-29A7-3130-AB4A-72A5F7BB506B + 4272800" 6 : "6 SwiftUI 0x00000001da55ff6c 3652361F-29A7-3130-AB4A-72A5F7BB506B + 5627756" 7 : "7 SwiftUI 0x00000001da52baf8 3652361F-29A7-3130-AB4A-72A5F7BB506B + 5413624" 8 : "8 SwiftUI 0x00000001da52aca0 3652361F-29A7-3130-AB4A-72A5F7BB506B + 5409952" 9 : "9 SwiftUI 0x00000001da0bdea4 3652361F-29A7-3130-AB4A-72A5F7BB506B + 769700" 10 : "10 SwiftUI 0x00000001da0be9f4 3652361F-29A7-3130-AB4A-72A5F7BB506B + 772596" 11 : "11 AttributeGraph 0x00000001ce264ef4 5CAF326B-142F-3CAC-AE1C-7B4271D0A801 + 114420" 12 : "12 AttributeGraph 0x00000001ce24c88c 5CAF326B-142F-3CAC-AE1C-7B4271D0A801 + 14476" 13 : "13 AttributeGraph 0x00000001ce24cd48 5CAF326B-142F-3CAC-AE1C-7B4271D0A801 + 15688" 14 : "14 AttributeGraph 0x00000001ce251cb0 5CAF326B-142F-3CAC-AE1C-7B4271D0A801 + 36016" 15 : "15 SwiftUI 0x00000001da1cad3c 3652361F-29A7-3130-AB4A-72A5F7BB506B + 1871164" 16 : "16 SwiftUI 0x00000001da1caaf0 3652361F-29A7-3130-AB4A-72A5F7BB506B + 1870576" 17 : "17 SwiftUI 0x00000001da1ca768 3652361F-29A7-3130-AB4A-72A5F7BB506B + 1869672" 18 : "18 SwiftUI 0x00000001da1ca8e0 3652361F-29A7-3130-AB4A-72A5F7BB506B + 1870048" 19 : "19 SwiftUI 0x00000001da4814b4 3652361F-29A7-3130-AB4A-72A5F7BB506B + 4715700" 20 : "20 SwiftUI 0x00000001da1ca8a8 3652361F-29A7-3130-AB4A-72A5F7BB506B + 1869992" 21 : "21 SwiftUI 0x00000001da1e6678 3652361F-29A7-3130-AB4A-72A5F7BB506B + 1984120" 22 : "22 SwiftUI 0x00000001da05ccdc 3652361F-29A7-3130-AB4A-72A5F7BB506B + 371932" 23 : "23 SwiftUI 0x00000001da05cc4c 3652361F-29A7-3130-AB4A-72A5F7BB506B + 371788" 24 : "24 SwiftUI 0x00000001da05cd7c 3652361F-29A7-3130-AB4A-72A5F7BB506B + 372092" 25 : "25 CoreFoundation 0x00000001a1fbec54 9624AAFD-5437-3772-A507-0F357875808D + 707668" 26 : "26 CoreFoundation 0x00000001a1fb98e4 9624AAFD-5437-3772-A507-0F357875808D + 686308" 27 : "27 CoreFoundation 0x00000001a1fb9d84 9624AAFD-5437-3772-A507-0F357875808D + 687492" 28 : "28 CoreFoundation 0x00000001a1fb9660 CFRunLoopRunSpecific + 480" 29 : "29 GraphicsServices 0x00000001ac3ca604 GSEventRunModal + 164" 30 : "30 UIKitCore 0x00000001a618e15c UIApplicationMain + 1944" 31 : "31 Cardigan 0x0000000104d693e0 main + 80" 32 : "32 libdyld.dylib 0x00000001a1e351ec 95B366E7-F5BD-3308-9416-24B35999029B + 4588"

    Crash with bringing up Pin Detail Settings PartialSheet

    ▿ 31 elements 0 : "0 ??? 0x000000011509866c 0x0 + 4647913068" 1 : "1 Cardigan 0x000000010245d390 main + 0" 2 : "2 SwiftUI 0x00000001da5600f0 3652361F-29A7-3130-AB4A-72A5F7BB506B + 5628144" 3 : "3 SwiftUI 0x00000001da4152a0 3652361F-29A7-3130-AB4A-72A5F7BB506B + 4272800" 4 : "4 SwiftUI 0x00000001da55ff6c 3652361F-29A7-3130-AB4A-72A5F7BB506B + 5627756" 5 : "5 SwiftUI 0x00000001da52baf8 3652361F-29A7-3130-AB4A-72A5F7BB506B + 5413624" 6 : "6 SwiftUI 0x00000001da52aca0 3652361F-29A7-3130-AB4A-72A5F7BB506B + 5409952" 7 : "7 SwiftUI 0x00000001da0bdea4 3652361F-29A7-3130-AB4A-72A5F7BB506B + 769700" 8 : "8 SwiftUI 0x00000001da0be9f4 3652361F-29A7-3130-AB4A-72A5F7BB506B + 772596" 9 : "9 AttributeGraph 0x00000001ce264ef4 5CAF326B-142F-3CAC-AE1C-7B4271D0A801 + 114420" 10 : "10 AttributeGraph 0x00000001ce24c88c 5CAF326B-142F-3CAC-AE1C-7B4271D0A801 + 14476" 11 : "11 AttributeGraph 0x00000001ce24cd48 5CAF326B-142F-3CAC-AE1C-7B4271D0A801 + 15688" 12 : "12 AttributeGraph 0x00000001ce251cb0 5CAF326B-142F-3CAC-AE1C-7B4271D0A801 + 36016" 13 : "13 SwiftUI 0x00000001da1cad3c 3652361F-29A7-3130-AB4A-72A5F7BB506B + 1871164" 14 : "14 SwiftUI 0x00000001da1caaf0 3652361F-29A7-3130-AB4A-72A5F7BB506B + 1870576" 15 : "15 SwiftUI 0x00000001da1ca768 3652361F-29A7-3130-AB4A-72A5F7BB506B + 1869672" 16 : "16 SwiftUI 0x00000001da1ca8e0 3652361F-29A7-3130-AB4A-72A5F7BB506B + 1870048" 17 : "17 SwiftUI 0x00000001da4814b4 3652361F-29A7-3130-AB4A-72A5F7BB506B + 4715700" 18 : "18 SwiftUI 0x00000001da1ca8a8 3652361F-29A7-3130-AB4A-72A5F7BB506B + 1869992" 19 : "19 SwiftUI 0x00000001da1e6678 3652361F-29A7-3130-AB4A-72A5F7BB506B + 1984120" 20 : "20 SwiftUI 0x00000001da05ccdc 3652361F-29A7-3130-AB4A-72A5F7BB506B + 371932" 21 : "21 SwiftUI 0x00000001da05cc4c 3652361F-29A7-3130-AB4A-72A5F7BB506B + 371788" 22 : "22 SwiftUI 0x00000001da05cd7c 3652361F-29A7-3130-AB4A-72A5F7BB506B + 372092" 23 : "23 CoreFoundation 0x00000001a1fbec54 9624AAFD-5437-3772-A507-0F357875808D + 707668" 24 : "24 CoreFoundation 0x00000001a1fb98e4 9624AAFD-5437-3772-A507-0F357875808D + 686308" 25 : "25 CoreFoundation 0x00000001a1fb9d84 9624AAFD-5437-3772-A507-0F357875808D + 687492" 26 : "26 CoreFoundation 0x00000001a1fb9660 CFRunLoopRunSpecific + 480" 27 : "27 GraphicsServices 0x00000001ac3ca604 GSEventRunModal + 164" 28 : "28 UIKitCore 0x00000001a618e15c UIApplicationMain + 1944" 29 : "29 Cardigan 0x000000010245d3e0 main + 80" 30 : "30 libdyld.dylib 0x00000001a1e351ec 95B366E7-F5BD-3308-9416-24B35999029B + 4588"

    bug 
    opened by jhparshall 6
  • Multiple quick clicks, empty sheet

    Multiple quick clicks, empty sheet

    When the button is in the same position as the cover, an empty sheet may appear if you click it a few times quickly

    Like the picture below: image

    How to fix it?

    opened by fatcarter 5
  • Add an option to not use an X button for iPad/Mac

    Add an option to not use an X button for iPad/Mac

    It would be great to have an option to specify to not have the "X" button on iPad for my custom sheet. Perhaps a new Bool parameter to the PartialSheetStyle init() functions?

    opened by joulupukki 5
  • Can't scroll with WKWebView inside the PartialSheet

    Can't scroll with WKWebView inside the PartialSheet

    I add a representative WKWebView inside your PartialSheet and I can't do a scroll at the webview. I use PartialSheet 2.1.14. If this one already fixed at latest release, please inform it.

    opened by ikki08 0
  • Fix bug where using a segmented picker within a PartialSheet leads to unresponsive picker.

    Fix bug where using a segmented picker within a PartialSheet leads to unresponsive picker.

    Fix bug where using a segmented picker within a PartialSheet leads to unresponsive picker.

    Remove call to onTapGesture method in iPhoneSheet builder. As pointed out by @ajevans99, SwiftUI seems to have trouble handling segmented pickers correctly if an onTapGesture method is added to the view that contains the picker. In this case of the iPhone sheet buider, the onTapGesture method call can safely be deleted since it was hardcoded to execute an empty closure. Removing the call should therefore not have any effect except for solving the mentioned bug.

    opened by JuliusHuizing 1
  • PartialSheet auto close when openURL in sheet content with `@Environment(\.scenePhase)`

    PartialSheet auto close when openURL in sheet content with `@Environment(\.scenePhase)`

    When I add @Environment(\.scenePhase) var scenePhase,partialSheet will auto close and never show again

    import SwiftUI
    import PartialSheet
    
    @main
    struct nnonoApp: App {
        @State private var isPresented = false
        @Environment(\.openURL) private var openURL
        @Environment(\.scenePhase) var scenePhase // <-
        
        var body: some Scene {
            WindowGroup {
                ZStack {
                    Rectangle().onTapGesture {
                        isPresented = true
                    }.partialSheet(isPresented: $isPresented) {
                        Button {
                            openURL(URL(string: "https://github.com")!)
                        } label: {
                            Label("Get Help", systemImage: "person.fill.questionmark")
                        }
                        
                    }
                }.attachPartialSheetToRoot()
            }
        }
    }
    

    https://user-images.githubusercontent.com/16934707/179238498-38f0f43b-cef7-47f7-8b90-2dec6d2f6036.mp4

    opened by Notsfsssf 0
  • The `DragGesture.onEnded(_:)` not be called up.

    The `DragGesture.onEnded(_:)` not be called up.

    Description

    If user used more than one finger, The DragGesture.onEnded(_:) will not be called up.

    Environment

    Xcode Version 14.0 beta (14A5228q) iPhone 12 Pro Max 15.5 (19F77)

    Screen recording

    https://user-images.githubusercontent.com/18307084/177292288-3f8d3ee9-9ea0-447c-86cd-80b5d0a44f78.MOV

    opened by LimChihi 0
Releases(3.1.0)
Customizable Dynamic Bottom Sheet Library for iOS

DynamicBottomSheet Powerd by Witi Corp., Seoul, South Korea. Fully Customizable Dynamic Bottom Sheet Library for iOS. This library doesn't support sto

Witi Official 10 May 7, 2022
Fully customizable and extensible action sheet controller written in Swift

XLActionController By XMARTLABS. XLActionController is an extensible library to quickly create any custom action sheet controller. Examples The action

xmartlabs 3.3k Dec 31, 2022
Custom-action-sheet- - Custom action sheet with swift

Custom-action-sheet- Usage let alertController: UIAlertControllerDimmed = UIAler

Girisankar G 0 Jan 19, 2022
SplitSheet - A lightweight, fully interactive split-screen sheet.

SplitSheet A lightweight, fully interactive split-screen sheet. Powered by UIScrollView for super-smooth gestures. Show/hide either programmatically o

Andrew Zheng 154 Dec 15, 2022
A fully customizable popup style menu for iOS 😎

Guide Check out the documentation and guides for details on how to use. (Available languages:) English 简体中文 What's a better way to know what PopMenu o

Cali Castle 1.5k Dec 30, 2022
SwiftUI Draggable Bottom Sheet

SwiftUI Draggable Bottom Sheet

paigeshin 2 Mar 3, 2022
An iOS library for SwiftUI to create draggable sheet experiences similar to iOS applications like Maps and Stocks.

An iOS library for SwiftUI to create draggable sheet experiences similar to iOS applications like Maps and Stocks.

Wouter 63 Jan 5, 2023
Multiplatform (iOS, macOS) SwiftUI bottom sheet drawer. Expandable bottomsheet. Slide out bottom menu

Multiplatform (iOS, macOS) SwiftUI bottom sheet drawer Features It does not re-render the background content while manipulating with the sheet iOS and

Igor 8 Nov 18, 2022
A Swift library to provide a bouncy action sheet

Hokusai is a Swift library that provides a bouncy action sheet. It will give the users a fancy experience without taking pains coding the cool animati

Yuta Akizuki 430 Nov 20, 2022
Dice roller, character sheet/ creator, and monster/item info app on the iphone12

DnD-LordDogMaw This file will be the start of a side project in the hopes of creating an iphone12 app for Dungeons and Dragons! This app will have 3 m

Paige Guajardo 2 Sep 17, 2021
Action sheet allows including your custom views and buttons.

CustomizableActionSheet Action sheet allows including your custom views and buttons. Installation CocoaPods Edit your Podfile: pod 'CustomizableAction

Ryuta Kibe 191 Nov 26, 2021
A Google like action sheet for iOS written in Swift.

MaterialActionSheetController Lightweight and totally customizable. Create and present it the way you do with UIAlertController. Screenshots Demo | De

Thanh-Nhon NGUYEN 103 Jun 29, 2022
Bottom Sheet component is widely used in Joom application

Bottom Sheet Bottom Sheet component is widely used in Joom application Installation Swift Package Manager Swift Package Manager is a tool for managing

Joom 101 Dec 29, 2022
BottomSheetDemo - Bottom sheet modal view controller with swift

当我们想弹出一个预览视图,bottom sheet modal view controller 非常实用。在 iOS 中,长按拖拽手势可以让 controlle

null 8 Oct 29, 2022
DGBottomSheet - The lightest swift bottom sheet library

DGBottomSheet Requirements Installation Usage DGBottomSheet The lightest swift b

donggyu 9 Aug 6, 2022
Share-sheet-example - A sample project that reproduces an issue with Share Sheets

Hello, DTS! This project demonstrates the issue I'm having with the Share Sheet.

Marcos Tanaka 0 Feb 11, 2022
This is a small View modifier that adds detents for native .sheet representations that appeared in iOS 16

SheetDetentsModifier This is a small View modifier that adds detents for .sheet representations that appeared in iOS 16 It works starting with iOS 15

Alex Artemev 19 Oct 9, 2022
PageSheet - Customizable sheets using UISheetPresentationController in SwiftUI

PageSheet Customizable sheet presentations in SwiftUI. Using UISheetPresentation

Eric Lewis 50 Oct 7, 2022
Highly customizable alertview and alert/notification/success/error/alarm popup written in Swift

CDAlertView is highly customizable alert popup written in Swift. Usage is similar to UIAlertController. Screenshots Animations Usage Basic usage witho

Candost Dagdeviren 1.1k Dec 30, 2022