### Attach PartialSheet to root and present sheet Source: https://github.com/andreamiotto/partialsheet/wiki/2.-How-to-use Two-step setup for PartialSheet: first attach the sheet to the root view, then use the partialSheet modifier on any view in the hierarchy. ```swift rootView.attachPartialSheetToRoot() ``` ```swift view .partialSheet(isPresented: $isPresented) { Text("Content of the Sheet") } ``` -------------------------------- ### PSIpadMacStyle initializer Source: https://github.com/andreamiotto/partialsheet/wiki/3.-Custom-Style Initializer for the iPad and Mac style struct, requiring a background color and close button style. ```Swift public init(backgroundColor: Color, // The background color of the Sheet closeButtonStyle: PSIpadMacCloseButtonStyle // The style of close button ) ``` -------------------------------- ### PSIphoneStyle initializer Source: https://github.com/andreamiotto/partialsheet/wiki/3.-Custom-Style Initializer for the iPhone style struct, requiring background, handlebar style, cover style, and corner radius. ```Swift public init(background: PSIphoneBackground, // The background of the Sheet handleBarStyle: PSHandleBarStyle, // The style of the handlebar cover: PSCoverStyle, // The cover style cornerRadius: CGFloat // The corner radius of the sheet ) ``` -------------------------------- ### Attach PartialSheet to Root View Source: https://github.com/andreamiotto/partialsheet/blob/master/README.md Attach the PartialSheet instance to your root view to enable the sheet presentation. This is the first step in using the library. ```Swift rootView.attachPartialSheetToRoot() ``` -------------------------------- ### PSSlideAnimation initializer Source: https://github.com/andreamiotto/partialsheet/wiki/3.-Custom-Style Initializer for PSSlideAnimation, allowing custom slide-in and slide-out animations. If nil, the default animation is used. ```Swift public init(slideIn: Animation? = nil, slideOut: Animation? = nil) ``` -------------------------------- ### partialSheet method signature Source: https://github.com/andreamiotto/partialsheet/wiki/3.-Custom-Style The main method to present a PartialSheet. It takes a binding for presentation, a type (default dynamic), styles for iPhone and iPad/Mac, an optional slide animation, and a content view builder. ```Swift func partialSheet(isPresented: Binding, type: PSType = PSType.dynamic, iPhoneStyle: PSIphoneStyle = .defaultStyle(), iPadMacStyle: PSIpadMacStyle = .defaultStyle(), slideAnimation: PSSlideAnimation? = nil, @ViewBuilder content: @escaping () -> Content) -> some View ``` -------------------------------- ### Use PSButton to present PartialSheet Source: https://github.com/andreamiotto/partialsheet/blob/master/README.md Use the PSButton to present the sheet without rage tapping. The isPresenting binding controls the presentation state. ```Swift PSButton( isPresenting: $isSheetPresented, label: { Text("Display the Partial Sheet") }) ``` -------------------------------- ### Default slide animation Source: https://github.com/andreamiotto/partialsheet/wiki/3.-Custom-Style The default slide animation used when no custom animation is provided: an interpolating spring with stiffness 300, damping 30, and initial velocity 10. ```Swift private(set) var defaultSlideAnimation: Animation = { .interpolatingSpring(stiffness: 300.0, damping: 30.0, initialVelocity: 10.0) }() ``` -------------------------------- ### PSCoverStyle enum Source: https://github.com/andreamiotto/partialsheet/wiki/3.-Custom-Style Defines the cover style: enabled with a solid color or disabled to hide the cover. ```Swift public enum PSCoverStyle { case enabled(Color) // Enable the cover layer between the sheet and its parent view, with a solid color. case disabled // Don't display any cover } ``` -------------------------------- ### PSIphoneBackground enum Source: https://github.com/andreamiotto/partialsheet/wiki/3.-Custom-Style Defines the background options for the iPhone sheet: solid color or material blur. ```Swift public enum PSIphoneBackground { case solid(Color) // Solid color for the background case blur(Material) // A material blur effect for the background } ``` -------------------------------- ### PSHandleBarStyle enum Source: https://github.com/andreamiotto/partialsheet/wiki/3.-Custom-Style Defines the handlebar style: solid color or none to hide it. ```Swift public enum PSHandleBarStyle { case solid(Color) // Solid color for the handlebar case none // None, in case you don't want the handlebar } ``` -------------------------------- ### PSIpadMacCloseButtonStyle enum Source: https://github.com/andreamiotto/partialsheet/wiki/3.-Custom-Style Defines the close button style for iPad and Mac: an icon with image and color, or none to hide it. ```Swift public enum PSIpadMacCloseButtonStyle { case icon(image: Image, color: Color) // Enable the code icon with your image and a specific color case none // Hide the close button } ``` -------------------------------- ### PSType enum Source: https://github.com/andreamiotto/partialsheet/wiki/3.-Custom-Style Defines the two sheet types: dynamic (resizes to content) and scrollView (requires a height and indicator flag). ```Swift public enum PSType { case `dynamic` case scrollView(height: CGFloat, showsIndicators: Bool) } ``` -------------------------------- ### Present PartialSheet with partialSheet modifier Source: https://github.com/andreamiotto/partialsheet/blob/master/README.md Use the partialSheet modifier on any view in the hierarchy to present the sheet. The isPresented binding controls the presentation state. ```Swift view .partialSheet(isPresented: $isPresented) { Text("Content of the Sheet") } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.