### Draggable Card - Sheet Example Source: https://github.com/exyte/popupview/blob/master/README.md Illustrates how to implement a draggable card-like sheet using PopupView by enabling drag-to-dismiss on a bottom-aligned toast. ```APIDOC ## Draggable Card - Sheet Example ### Description This example demonstrates how to create a sheet-like UI element that can be dragged to dismiss. It's achieved by configuring the popup with `.type(.toast)`, `.position(.bottom)`, and `dragToDismiss(true)`. ### Method SwiftUI Modifier ### Endpoint `.popup(..., customize: { $0.type(.toast).position(.bottom).dragToDismiss(true) }) ### Parameters See 'Popup Customizations' for detailed parameter descriptions. ### Request Example ```swift .popup(isPresented: $show) { // your content } customize: { $0 .type (.toast) .position(.bottom) .dragToDismiss(true) } ``` ### Response #### Success Response (200) None (Modifier-based) #### Response Example None ``` -------------------------------- ### Swift Package Manager Installation Source: https://github.com/exyte/popupview/blob/master/README.md Add the PopupView library to your project using Swift Package Manager by specifying the repository URL in your dependencies. ```swift dependencies: [ .package(url: "https://github.com/exyte/PopupView.git") ] ``` -------------------------------- ### Install PopupView via Swift Package Manager Source: https://context7.com/exyte/popupview/llms.txt Add PopupView as a Swift package dependency in your Package.swift file. Ensure your target supports the minimum OS versions required by the library. ```swift // Package.swift dependencies: [ .package(url: "https://github.com/exyte/PopupView.git", from: "4.0.0") ], targets: [ .target( name: "MyApp", dependencies: ["PopupView"]) ] ``` -------------------------------- ### Custom Background View with Blur Source: https://context7.com/exyte/popupview/llms.txt Customize the popup's background scrim using `backgroundView`. This example applies a blurred material effect, overriding any `backgroundColor` setting. ```swift // Blurred background scrim .popup(isPresented: $showModal) { ModalContent() } customize: { $0 .type(.default) .backgroundView { Color.clear .background(.ultraThinMaterial) .ignoresSafeArea() } .closeOnTapOutside(true) } ``` -------------------------------- ### SwiftUI Popup with @Binding (Will Work) Source: https://github.com/exyte/popupview/blob/master/README.md This example shows the correct way to handle state updates within a popup using @Binding. By passing a binding to the state variable, the popup's content can correctly modify and reflect the state changes. ```swift struct ContentView : View { @State var showPopup = false @State var a = false var body: some View { Button("Button") { showPopup.toggle() } .popup(isPresented: $showPopup) { PopupContent(a: $a) } customize: { $0 .type(.floater()) .closeOnTap(false) .position(.top) } } } struct PopupContent: View { @Binding var a: Bool var body: some View { VStack { Button("Switch a") { a.toggle() } a ? Text("on").foregroundStyle(.green) : Text("off").foregroundStyle(.red) } } } ``` -------------------------------- ### Dismiss Event Callbacks Source: https://context7.com/exyte/popupview/llms.txt Provides callbacks for when the dismiss animation starts (`willDismissCallback`) and ends (`dismissCallback`), including the source of dismissal. ```APIDOC ## `PopupParameters.dismissCallback(_:)` and `PopupParameters.willDismissCallback(_:)` — Dismiss events `willDismissCallback` fires when the dismiss animation starts; `dismissCallback` fires when it ends. Both receive a `DismissSource` value (`.binding`, `.tapInside`, `.tapOutside`, `.drag`, `.autohide`, `.exitCommand`) identifying what triggered the dismissal. ```swift // Example usage: .willDismissCallback { source in // Handle dismissal start } .dismissCallback { source in // Handle dismissal end } ``` ``` -------------------------------- ### SwiftUI Popup with @State (Will Not Work) Source: https://github.com/exyte/popupview/blob/master/README.md This example demonstrates a common pitfall when using @State with popups. SwiftUI's @State updates may not propagate correctly within the popup's content, leading to unexpected behavior. ```swift struct ContentView : View { @State var showPopup = false @State var a = false var body: some View { Button("Button") { showPopup.toggle() } .popup(isPresented: $showPopup) { VStack { Button("Switch a") { a.toggle() } a ? Text("on").foregroundStyle(.green) : Text("off").foregroundStyle(.red) } } customize: { $0 .type(.floater()) .closeOnTap(false) .position(.top) } } } ``` -------------------------------- ### Basic Popup Usage Source: https://github.com/exyte/popupview/blob/master/README.md Demonstrates the basic implementation of PopupView by adding a modifier to a view and controlling its presentation state with a boolean binding. ```APIDOC ## Basic Popup Usage ### Description This shows how to present a popup using a boolean binding and a view builder for the popup content. It also includes an optional customization closure. ### Method SwiftUI Modifier ### Endpoint `.popup(isPresented:content:customize:)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```swift import PopupView struct ContentView: View { @State var showingPopup = false var body: some View { YourView() .popup(isPresented: $showingPopup) { Text("The popup") .frame(width: 200, height: 60) .background(Color(red: 0.85, green: 0.8, blue: 0.95)) .cornerRadius(30.0) } customize: { $0.autohideIn(2) } } } ``` ### Response #### Success Response (200) None (Modifier-based) #### Response Example None ``` -------------------------------- ### Set Popup Display Mode Source: https://context7.com/exyte/popupview/llms.txt Control the rendering layer with `.displayMode()`. Options are `.overlay`, `.sheet`, and `.window` (iOS). `.window` is best for critical alerts. ```swift // Overlay — stays within current view hierarchy, taps pass through clear bg .popup(isPresented: $showFloater) { InlineNotification() } customize: { $0 .type(.floater()) .position(.top) .displayMode(.overlay) .allowTapThroughBG(true) // taps reach views beneath the popup bg } ``` ```swift // Window — best for critical alerts that must appear above everything .popup(isPresented: $showCritical) { CriticalAlertView() } customize: { $0 .type(.default) .displayMode(.window) .backgroundColor(.black.opacity(0.5)) .closeOnTapOutside(false) .dragToDismiss(false) } ``` -------------------------------- ### Set Popup Enter/Exit Animations Source: https://context7.com/exyte/popupview/llms.txt Define slide-in and exit animations using `.appearFrom()` and `.disappearTo()`. Defaults to directions implied by `position`. ```swift // Slides in from bottom, scales out from center .popup(isPresented: $showReward) { RewardPopup() } customize: { $0 .type(.default) .position(.center) .appearFrom(.bottomSlide) .disappearTo(.centerScale) .animation(.spring(response: 0.5, dampingFraction: 0.7)) } ``` -------------------------------- ### Scrim Customization Source: https://context7.com/exyte/popupview/llms.txt Allows setting the background scrim color or providing a custom background view for full control. ```APIDOC ## `PopupParameters.backgroundColor(_:)` and `PopupParameters.backgroundView(_:)` — Scrim customization Sets the color of the dimming overlay behind the popup. For full control, supply a `backgroundView` builder instead (ignores `backgroundColor` when set). ```swift // Example usage: .backgroundView { Color.clear .background(.ultraThinMaterial) .ignoresSafeArea() } ``` ``` -------------------------------- ### Set Popup Position Source: https://context7.com/exyte/popupview/llms.txt Use `.position()` to place the popup in one of nine screen locations. Defaults vary by popup type. ```swift // Notification appearing from top-trailing corner .popup(isPresented: $showBadge) { BadgeView(count: 3) } customize: { $0 .type(.floater(verticalPadding: 8, horizontalPadding: 8)) .position(.topTrailing) .appearFrom(.rightSlide) .disappearTo(.rightSlide) .autohideIn(3) } ``` -------------------------------- ### Update Popup Display Mode (v4) Source: https://github.com/exyte/popupview/blob/master/README.md In version 4, the `isOpaque` parameter is deprecated. Use the `displayMode` enum instead. `.displayMode(.sheet)` is equivalent to the old `.isOpaque(true)`, and `.displayMode(.overlay)` is equivalent to `.isOpaque(false)`. The default is `.window`. ```swift .popup(isPresented: $floats.showingTopFirst) { FloatTopFirst() } customize: { $0 .type(.floater()) .displayMode(.sheet) // <-- here } ``` -------------------------------- ### Popup Customizations Source: https://github.com/exyte/popupview/blob/master/README.md Details the various optional parameters available for customizing the appearance and behavior of the popup. ```APIDOC ## Popup Customizations ### Description Customize the popup's appearance and behavior using the `customize` closure. This allows for fine-grained control over presentation, animation, and interaction. ### Method SwiftUI Modifier - `customize` closure ### Endpoint `.popup(..., customize: { $0.() }) ### Parameters #### Available Customizations (Optional Parameters) - **type**: Defines the popup's presentation style (`default`, `toast`, `floater`, `scroll`). - **floater parameters**: `verticalPadding`, `horizontalPadding`, `useSafeAreaInset` (for `floater` type). - **scroll parameters**: `headerView` (for `scroll` type). - **position**: Sets the popup's position on the screen (e.g., `.topLeading`, `.center`, `.bottomTrailing`). - **appearFrom**: Controls the entry animation direction (e.g., `.topSlide`, `.centerScale`, `.none`). - **disappearTo**: Controls the exit animation direction (similar to `appearFrom`). - **animation**: Apply a custom animation for the popup's appearance. - **autohideIn**: Automatically dismiss the popup after a specified duration. - **dismissibleIn(Double?, Binding?)**: Restricts dismissal for a duration and optionally tracks dismissal status. - **dragToDismiss**: Enables or disables dismissing the popup by dragging. - **closeOnTap**: Enables or disables closing the popup when tapped. - **closeOnTapOutside**: Enables or disables closing the popup when tapping outside its bounds. - **allowTapThroughBG**: Allows taps to pass through the popup background to views below. - **backgroundColor**: Sets a custom background color for the popup's surrounding area. - **backgroundView**: Provides a custom view builder for the popup's background. - **isOpaque**: Determines if the popup is displayed on top of the navigation bar and blocks taps. - **useKeyboardSafeArea**: Adjusts the popup's position to accommodate the keyboard. - **dismissCallback**: A closure to be executed when the popup is dismissed. ### Request Example ```swift .popup(isPresented: $show) { // your content } customize: { $0 .type (.toast) .position(.bottom) .dragToDismiss(true) .autohideIn(3) } ``` ### Response #### Success Response (200) None (Modifier-based) #### Response Example None ``` -------------------------------- ### Basic Popup Presentation Source: https://github.com/exyte/popupview/blob/master/README.md Use the `.popup` modifier to present a view. Control its visibility with a boolean binding. The popup content is defined within the closure. ```swift import PopupView struct ContentView: View { @State var showingPopup = false var body: some View { YourView() .popup(isPresented: $showingPopup) { Text("The popup") .frame(width: 200, height: 60) .background(Color(red: 0.85, green: 0.8, blue: 0.95)) .cornerRadius(30.0) } customize: { $0.autohideIn(2) } } } ``` -------------------------------- ### Toast Popup Customization Source: https://github.com/exyte/popupview/blob/master/README.md Configure a popup to appear as a toast, positioned at the bottom of the screen and filling the screen width without padding. Drag-to-dismiss can be enabled for a sheet-like behavior. ```swift .popup(isPresented: $show) { // your content } customize: { $0 .type (.toast) .position(.bottom) .dragToDismiss(true) } ``` -------------------------------- ### Popup with Item Presentation Source: https://github.com/exyte/popupview/blob/master/README.md Alternatively, present a popup using an optional item binding. The popup is displayed when the item is non-nil and hidden when it's nil. Be aware that the library makes a copy of the item during the dismiss animation. ```swift .popup(item: $item) { // your content } customize: { // customizations } ``` -------------------------------- ### Update Popup Configuration API (v2) Source: https://github.com/exyte/popupview/blob/master/README.md Version 2 changed the popup configuration API. Instead of passing parameters directly to the `.popup` modifier, use the `customize` closure to set properties like `type`, `position`, `animation`, `closeOnTapOutside`, and `backgroundColor`. ```swift .popup(isPresented: $floats.showingTopFirst) { FloatTopFirst() } customize: { $0 .type(.floater()) .position(.top) .animation(.spring()) .closeOnTapOutside(true) .backgroundColor(.black.opacity(0.5)) } ``` -------------------------------- ### Update Popup Animation Direction (v3) Source: https://github.com/exyte/popupview/blob/master/README.md Version 3 introduced new zoom animations and the `disappearTo` parameter. The `AppearFrom` enum cases were renamed to support these new animations. Use `.topSlide` instead of `.top` for the slide-in animation from the top. ```swift .popup(isPresented: $floats.showingTopFirst) { FloatTopFirst() } customize: { $0 .type(.floater()) .appearFrom(.topSlide) // <-- here } ``` -------------------------------- ### Popup with Item Binding Source: https://github.com/exyte/popupview/blob/master/README.md An alternative way to present a popup using an optional item binding. The popup is displayed if the item is non-nil and hidden if it's nil. ```APIDOC ## Popup with Item Binding ### Description This method presents a popup based on the presence of an optional item. If the item is non-nil, the popup is shown; otherwise, it's hidden. Be aware that the library makes a copy of the item during the dismiss animation. ### Method SwiftUI Modifier ### Endpoint `.popup(item:content:customize:)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```swift // Assuming 'item' is an optional variable .popup(item: $item) { // Your popup content } customize: { // Customizations } ``` ### Response #### Success Response (200) None (Modifier-based) #### Response Example None ``` -------------------------------- ### Set Popup Type Source: https://context7.com/exyte/popupview/llms.txt Use `.type()` to define the layout strategy for the popup. Options include `.default`, `.toast`, `.floater`, and `.scroll` (iOS only). ```swift .popup(isPresented: $showBanner) { ToastView() } customize: { $0 .type(.toast) .position(.top) .autohideIn(4) .dragToDismiss(true) } ``` ```swift // Floater — padded notification card .popup(isPresented: $showNotification) { NotificationCard() } customize: { $0 .type(.floater(verticalPadding: 12, horizontalPadding: 12, useSafeAreaInset: true)) .position(.topTrailing) .autohideIn(5) } ``` ```swift // Scroll sheet — draggable bottom sheet with scrollable content (iOS only) .popup(isPresented: $showSheet) { ActivityListView() } customize: { $0 .type(.scroll(headerView: SheetHandle())) .position(.bottom) .dragToDismiss(true) .displayMode(.sheet) } ``` -------------------------------- ### .popup(item:itemView:customize:) Source: https://context7.com/exyte/popupview/llms.txt Attaches a popup that is driven by an optional item binding. The popup appears when the item is non-nil and dismisses when it becomes nil. ```APIDOC ## .popup(item:itemView:customize:) ### Description When popup content depends on a data model, pass an optional `Binding`. The popup appears when the item is non-nil and dismisses when it becomes nil. The library retains a copy of the item during the dismiss animation so the content doesn't flash away. ### Method SwiftUI View Modifier ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```swift .popup(item: $activeAlert) { item in // Popup content view using the item VStack(spacing: 16) { Text(item.title) .font(.title2.bold()) Text(item.message) .font(.body) .multilineTextAlignment(.center) .foregroundColor(.secondary) Button("Claim") { activeAlert = nil } .buttonStyle(.borderedProminent) } .padding(28) .background(Color(.systemBackground).cornerRadius(20)) .shadow(radius: 20) .padding(.horizontal, 32) } customize: { // Customization closure $0 .type(.default) .position(.center) .appearFrom(.centerScale) .disappearTo(.centerScale) .backgroundColor(.black.opacity(0.4)) .closeOnTapOutside(true) .displayMode(.window) } ``` ### Response None (modifies view presentation) ``` -------------------------------- ### Display a Modal Popup with Item Binding Source: https://context7.com/exyte/popupview/llms.txt Use the `.popup(item:itemView:customize:)` modifier with an optional binding to an identifiable item to display dynamic content. The popup appears when the item is non-nil and dismisses when it becomes nil. ```swift import SwiftUI import PopupView struct SomeItem: Equatable, Identifiable { let id = UUID() let title: String let message: String } struct ContentView: View { @State private var activeAlert: SomeItem? var body: some View { Button("Win Prize") { activeAlert = SomeItem(title: "Congratulations!", message: "You've unlocked a 30% discount.") } .popup(item: $activeAlert) { item in VStack(spacing: 16) { Text(item.title) .font(.title2.bold()) Text(item.message) .font(.body) .multilineTextAlignment(.center) .foregroundColor(.secondary) Button("Claim") { activeAlert = nil } .buttonStyle(.borderedProminent) } .padding(28) .background(Color(.systemBackground).cornerRadius(20)) .shadow(radius: 20) .padding(.horizontal, 32) } customize: { $0 .type(.default) .position(.center) .appearFrom(.centerScale) .disappearTo(.centerScale) .backgroundColor(.black.opacity(0.4)) .closeOnTapOutside(true) .displayMode(.window) } } } ``` -------------------------------- ### Transparent Background Tap-Through Source: https://context7.com/exyte/popupview/llms.txt Enables taps on the popup background to pass through to underlying views. Not available with `.sheet` display mode. ```APIDOC ## `PopupParameters.allowTapThroughBG(_:)` — Transparent background tap-through When `true`, taps on the popup's background pass through to views underneath. Not available with `.sheet` display mode. Useful for non-blocking floating indicators. ```swift // Example usage: .allowTapThroughBG(true) ``` ``` -------------------------------- ### Stacking Multiple Popups Source: https://context7.com/exyte/popupview/llms.txt Chain multiple `.popup` modifiers on the same view to display several popups independently. Each popup can have its own presentation type, position, and dismissal behavior. ```swift struct ContentView: View { @State private var showToast = false @State private var showBanner = false @State private var showAlert = false var body: some View { MainContent() .popup(isPresented: $showToast) { SuccessToast() } customize: { $0.type(.floater()).position(.bottom).autohideIn(2) } .popup(isPresented: $showBanner) { InfoBanner() } customize: { $0.type(.floater()).position(.top).autohideIn(4) } .popup(isPresented: $showAlert) { ConfirmationAlert(onConfirm: { showAlert = false }) } customize: { $0 .type(.default) .backgroundColor(.black.opacity(0.4)) .closeOnTapOutside(false) .displayMode(.window) } } } ``` -------------------------------- ### Keyboard Avoidance Source: https://context7.com/exyte/popupview/llms.txt Configures the popup to shift upward with the keyboard or adjust its scroll area height. ```APIDOC ## `PopupParameters.useKeyboardSafeArea(_:)` — Keyboard avoidance When `true`, the popup shifts upward by the keyboard height when the software keyboard appears. For `.scroll` type popups the scroll area height is constrained instead, keeping the popup frame anchored at the bottom. ```swift // Example usage: .useKeyboardSafeArea(true) ``` ``` -------------------------------- ### Handling Dismiss Events with Callbacks Source: https://context7.com/exyte/popupview/llms.txt Implement `willDismissCallback` and `dismissCallback` to react to dismissal events. Both callbacks receive a `DismissSource` enum indicating the dismissal trigger. ```swift .popup(isPresented: $showOffer) { OfferCard() } customize: { $0 .type(.default) .autohideIn(10) .willDismissCallback { source in if source == .autohide { Analytics.track("offer_ignored") } } .dismissCallback { source in switch source { case .tapInside: Analytics.track("offer_accepted") case .tapOutside: Analytics.track("offer_dismissed") default: break } } } ``` -------------------------------- ### Display a Toast Popup with Boolean Binding Source: https://context7.com/exyte/popupview/llms.txt Use the `.popup(isPresented:view:customize:)` modifier with an `@State` Bool binding to control popup visibility. Configure appearance and behavior within the `customize` closure. ```swift import SwiftUI import PopupView struct ContentView: View { @State private var showToast = false var body: some View { Button("Show Toast") { showToast = true } .popup(isPresented: $showToast) { HStack(spacing: 12) { Image(systemName: "checkmark.circle.fill") .foregroundColor(.green) Text("File saved successfully") .foregroundColor(.white) } .padding(.horizontal, 20) .padding(.vertical, 14) .background(Color.black.opacity(0.85).cornerRadius(12)) } customize: { $0 .type(.floater(verticalPadding: 16, horizontalPadding: 16, useSafeAreaInset: true)) .position(.bottom) .animation(.spring(response: 0.4, dampingFraction: 0.75)) .autohideIn(3) .closeOnTap(true) .closeOnTapOutside(false) .displayMode(.window) // renders above navbar and sheets } } } ``` -------------------------------- ### Transparent Background Tap-Through Source: https://context7.com/exyte/popupview/llms.txt Enable `allowTapThroughBG(true)` to allow taps on the popup's background to interact with underlying views. This is useful for non-blocking elements like floating badges. ```swift // Floating network-status badge — underlying UI stays interactive .popup(isPresented: $isOffline) { HStack { Image(systemName: "wifi.slash") Text("No connection") } .padding(12) .background(Color.yellow.cornerRadius(10)) } customize: { $0 .type(.floater(verticalPadding: 60)) .position(.bottom) .allowTapThroughBG(true) .closeOnTap(false) .dragToDismiss(false) .displayMode(.overlay) } ``` -------------------------------- ### Keyboard Safe Area Adjustment Source: https://context7.com/exyte/popupview/llms.txt Use `useKeyboardSafeArea(true)` to make the popup shift upwards when the keyboard appears. For scrollable popups, this constrains the scroll area height instead. ```swift .popup(isPresented: $showInput) { InputSheetBottom(isShowing: $showInput) } customize: { $0 .type(.toast) .position(.bottom) .closeOnTap(false) .dragToDismiss(true) .useKeyboardSafeArea(true) // popup slides above keyboard .displayMode(.window) } ``` -------------------------------- ### .popup(isPresented:view:customize:) Source: https://context7.com/exyte/popupview/llms.txt Attaches a popup to any view using a boolean binding. The customize closure allows for detailed configuration of the popup's appearance and behavior. ```APIDOC ## .popup(isPresented:view:customize:) ### Description Attaches a popup to any view using an `@State` Bool binding. The `customize` closure receives a `PopupParameters` value and returns a modified copy; all parameters are optional and chainable. ### Method SwiftUI View Modifier ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```swift .popup(isPresented: $showToast) { // Popup content view HStack(spacing: 12) { Image(systemName: "checkmark.circle.fill") .foregroundColor(.green) Text("File saved successfully") .foregroundColor(.white) } .padding(.horizontal, 20) .padding(.vertical, 14) .background(Color.black.opacity(0.85).cornerRadius(12)) } customize: { // Customization closure $0 .type(.floater(verticalPadding: 16, horizontalPadding: 16, useSafeAreaInset: true)) .position(.bottom) .animation(.spring(response: 0.4, dampingFraction: 0.75)) .autohideIn(3) .closeOnTap(true) .closeOnTapOutside(false) .displayMode(.window) } ``` ### Response None (modifies view presentation) ``` -------------------------------- ### Enable Drag to Dismiss with Custom Distance Source: https://context7.com/exyte/popupview/llms.txt Configure drag-to-dismiss behavior for popups. `dragToDismiss(true)` enables the gesture, and `dragToDismissDistance(_:)` sets a custom threshold. ```swift // Draggable bottom sheet with 80 pt threshold .popup(isPresented: $showSheet) { SheetContent() } customize: { $0 .type(.toast) .position(.bottom) .dragToDismiss(true) .dragToDismissDistance(80) .closeOnTap(false) } ``` -------------------------------- ### Dismiss Popup from Content Source: https://context7.com/exyte/popupview/llms.txt Use the `@Environment(\.popupDismiss)` value within popup content to programmatically close the popup. This is useful for actions like claiming a reward or dismissing a notification. ```swift struct RewardPopupContent: View { @Environment(\.popupDismiss) var dismiss var body: some View { VStack(spacing: 20) { Image(systemName: "gift.fill") .font(.system(size: 60)) .foregroundColor(.purple) Text("You've earned a reward!") .font(.title3.bold()) Button("Claim Now") { dismiss?() // perform reward logic here } .buttonStyle(.borderedProminent) Button("Later") { dismiss?() } .foregroundColor(.secondary) } .padding(32) .background(Color.white.cornerRadius(20)) .padding(.horizontal, 24) } } // Attach with item binding .popup(item: $rewardItem) { _ in RewardPopupContent() } customize: { $0 .type(.default) .closeOnTapOutside(false) .backgroundColor(.black.opacity(0.4)) .displayMode(.window) } ``` -------------------------------- ### Set Automatic Popup Dismissal Source: https://context7.com/exyte/popupview/llms.txt Use `.autohideIn()` to schedule automatic dismissal after a specified duration. The timer pauses during user drag gestures. ```swift .popup(isPresented: $showConfirmation) { SuccessBanner(message: "Payment complete") } customize: { $0 .type(.floater()) .position(.bottom) .autohideIn(2.5) .dragToDismiss(true) // drag also dismisses early .closeOnTap(true) } ``` -------------------------------- ### Drag Gesture Dismissal Source: https://context7.com/exyte/popupview/llms.txt Enables dismissal by dragging the popup. Allows overriding the default drag threshold. ```APIDOC ## `PopupParameters.dragToDismiss(_:)` and `PopupParameters.dragToDismissDistance(_:)` — Drag gesture Enables dismissal by dragging the popup in the direction opposite to its origin. The optional `dragToDismissDistance` overrides the default threshold of one-third of the popup dimension. ```swift // Example usage: .dragToDismiss(true) .dragToDismissDistance(80) ``` ``` -------------------------------- ### Timed Dismiss Lock with Binding Source: https://context7.com/exyte/popupview/llms.txt Use `dismissibleIn` to set a timed lock on dismiss interactions. The provided binding is set to true after the lock expires, enabling UI elements like a button. ```swift struct TermsPopup: View { @Binding var isPresented: Bool @Binding var canDismiss: Bool var body: some View { VStack(spacing: 16) { Text("Terms & Conditions") .font(.headline) ScrollView { Text(termsText) } .frame(maxHeight: 200) Button("Accept") { isPresented = false } .disabled(!canDismiss) .opacity(canDismiss ? 1 : 0.4) } .padding(24) .background(Color.white.cornerRadius(16)) .padding(.horizontal, 20) } } struct ContentView: View { @State private var showTerms = false @State private var dismissEnabled = false var body: some View { Button("Show Terms") { showTerms = true } .popup(isPresented: $showTerms) { TermsPopup(isPresented: $showTerms, canDismiss: $dismissEnabled) } customize: { $0 .type(.default) .closeOnTap(false) .closeOnTapOutside(false) .dragToDismiss(false) .dismissibleIn(5, $dismissEnabled) // lock for 5 seconds .backgroundColor(.black.opacity(0.4)) } } } ``` -------------------------------- ### Timed Dismiss Lock Source: https://context7.com/exyte/popupview/llms.txt Prevents all dismiss interactions for a specified duration. Optionally updates a binding to enable dismissal after the lock expires. ```APIDOC ## `PopupParameters.dismissibleIn(_:_:)` — Timed dismiss lock Prevents all dismiss interactions (tap, tap-outside, drag) for the specified duration. An optional `Binding` is set to `true` once the lock expires, useful for enabling a button only after the user has had time to read the content. ```swift // Example usage: .dismissibleIn(5, $dismissEnabled) // lock for 5 seconds ``` ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.