# PopupView **Repository Path**: bruce_01/PopupView ## Basic Information - **Project Name**: PopupView - **Description**: No description available - **Primary Language**: Swift - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-09-13 - **Last Updated**: 2021-09-13 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README

Popup View

Toasts and popups library written with SwiftUI

___

We are a development agency building phenomenal apps.




[![Twitter](https://img.shields.io/badge/Twitter-@exyteHQ-blue.svg?style=flat)](http://twitter.com/exyteHQ) [![Version](https://img.shields.io/cocoapods/v/ExytePopupView.svg?style=flat)](http://cocoapods.org/pods/ExytePopupView) [![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-0473B3.svg?style=flat)](https://github.com/Carthage/Carthage) [![License](https://img.shields.io/cocoapods/l/ExytePopupView.svg?style=flat)](http://cocoapods.org/pods/ExytePopupView) [![Platform](https://img.shields.io/cocoapods/p/ExytePopupView.svg?style=flat)](http://cocoapods.org/pods/ExytePopupView) # Usage 1. Put all your body code into a ZStack 2. Add a binding bool to control popup presentation state 3. Add `.popup` modifier to your ZStack ```swift struct ContentView: View { @State var showingPopup = false var body: some View { ZStack { // your view } .popup(isPresented: $showingPopup, autohideIn: 2) { Text("The popup") .frame(width: 200, height: 60) .background(Color(red: 0.85, green: 0.8, blue: 0.95)) .cornerRadius(30.0) } } } ``` ### Required parameters `isPresented` - binding to determine if the popup should be seen on screen or hidden `view` - view you want to display on your popup ### Available customizations - optional parameters `type` - toast, float or default `position` - top or bottom (for default case it just determines animation direction) `animation` - custom animation for popup sliding onto screen `autohideIn` - time after which popup should disappear `dragToDismiss` - true by default: enable/disable drag to dismiss (upwards for .top popup types, downwards for .bottom and default type) `closeOnTap` - true by default: enable/disable closing on tap on popup `closeOnTapOutside` - false by default: enable/disable closing on tap on outside of popup `dismissCallback` - custom callback to call once the popup is dismissed ### Draggable card With latest addition of `dragToDismiss`, you can use bottom toast to add this popular component to your app (see example project for implementation) ```swift .popup(isPresented: $show, type: .toast, position: .bottom) { // your content } ``` ## Examples To try PopupView examples: - Clone the repo `https://github.com/exyte/PopupView.git` - Open terminal and run `cd /Example/` - Run `pod install` to install all dependencies - Run open `PopupViewExample.xcworkspace/` to open project in the Xcode - Try it! ## Installation ### [CocoaPods](http://cocoapods.org) To install `PopupView`, simply add the following line to your Podfile: ```ruby pod 'ExytePopupView' ``` ### [Carthage](http://github.com/Carthage/Carthage) To integrate `PopupView` into your Xcode project using Carthage, specify it in your `Cartfile` ```ogdl github "Exyte/PopupView" ``` ### [Swift Package Manager](https://swift.org/package-manager/) ```swift dependencies: [ .package(url: "https://github.com/exyte/PopupView.git", from: "1.0.0") ] ``` ### Manually Drop [PopupView.swift](https://github.com/exyte/PopupView/blob/master/Source/PopupView.swift) in your project. ## Requirements * iOS 13+ * Xcode 11+