PopupWindow is a simple Popup using another UIWindow in Swift

Overview

PopupWindow

Version License Carthage compatible Platform

image

PopupWindow is a simple Popup using another UIWindow

Feature

  • PopupWindow can be displayed at the top or bottom of the screen.
  • Popup can set margins, cornerRadius, blur, etc.
  • When displaying blur, you can't touch the below contents.
  • By erasing blur, you can touch the below contents.
  • Popup are displayed on another window, so you can leave Popup even when screen transitions.
TopToast BottomToast TopCard BottomCard Example
demo_01 demo_02 demo_03 demo_04 demo_05

Installation

CocoaPods

Add PopupWindow to your Podfile:

pod 'PopupWindow'

Carthage

Add PopupWindow to your Cartfile:

github "shin8484/PopupWindow"

Usage

When displaying popup in another window, please call first PopupWindowManager changeKeyWindow(rootViewController: UIViewController)

PopupWindowManager.shared.changeKeyWindow(rootViewController: UIViewController())

Create and show show

Create a PopupItem in the ViewController where you want to display the popup and call the method of BasePopupViewController

let popupOption = PopupOption(shapeType: .roundedCornerTop(cornerSize: 8), viewType: .toast, direction: .bottom)
let popupItem = PopupItem(view: loginView,
                          height: Const.firstViewFrame.height,
                          maxWidth: 500,
                          popupOption: popupOption)

First popup implementation is included in BasePopupViewController's loadView, viewDidAppear. If you want to create the next popup, please call showPopupView().

class SampleViewController: BasePopupViewController {
    override open func loadView() {
        super.loadView()
        setupPopupContainerView()
    }

    override open func viewDidAppear(_ animated: Bool) {
        super.viewDidAppear(animated)
        makePopupView(with: item)
        showPopupView(duration: item.duration, curve: .easeInOut, delayFactor: 0.0)
    }
}

Transform & Replace

Replace the display contents, and perform deformation to the specified size. By using PopupItem, you can specify content contents and size.

transformPopupView(duration: Const.transformDuration, curve: .easeInOut, popupItem: popupItem) { [weak self] _ in
    guard let me = self else { return }
    me.replacePopupView(with: popupItem)
    me.dismissPopupView(duration: 3.3, curve: .easeInOut, delayFactor: 0.9, direction: .top) { _ in }
}

Dismiss

Specify hide animation direction with PopupViewDirection

dismissPopupView(duration: 3.3, curve: .easeInOut, delayFactor: 0.9, direction: .bottom) { _ in
    PopupWindowManager.shared.changeKeyWindow(rootViewController: nil)
}

PopupItem

PopupItem and PopupOption are struct to set up a popup, View, size, direction, whether it is rounded, margin, blurred or not, duration, maxWidth, type

public struct PopupItem {
    public let view: UIView
    public let height: CGFloat
    public let maxWidth: CGFloat
    public let landscapeSize: CGSize?
    public let popupOption: PopupOption
}
public struct PopupOption {
    public let shapeType: ShapeType
    public let viewType: ViewType
    public let direction: PopupViewDirection
    public let margin: CGFloat
    public let hasBlur: Bool
    public let duration: TimeInterval
    public let canTapDismiss: Bool
}

Landscape

maxWidth

By setting maxWidth with popupitem's initializer, you can set the maximum width of the popup in landscape mode.

image

landscapeSize

You can set popup size at landscape. The size changes only when landscape size is set, and the default is nil. Using landscapeSize and SizeClass, you can customize PopupVIew that has the widest width like GIF below when rotating.

demo_06

Requirements

  • iOS 10.0+
  • Xcode 9.1+
  • Swift 3.0.1+

LICENSE

Under the MIT license. See LICENSE file for details.

You might also like...
WKWebView handling popup windows

WKWebViewWithPopUp WKWebView handling pop-up windows Property If there is a pop-up window, use the pop-up window. If there is no pop-up window, use th

A framework for presenting bars and view controllers as popup, much like the look and feel of Apple Music App.
A framework for presenting bars and view controllers as popup, much like the look and feel of Apple Music App.

PBPopupController PBPopupController is a framework for presenting bars and view controllers as popup, much like the look and feel of Apple Music App.

A simple way to show toast in SwiftUI.
A simple way to show toast in SwiftUI.

A simple way to show toast in SwiftUI Documentation • Example • Change Log Overview ToastUI provides you a simple way to present toast, head-up displa

Simple selection dialog
Simple selection dialog

SelectionDialog Simple selection dialog inspired from ios-custom-alertview Preview Requirements iOS 8.0+ Swift 3 Xcode 8.0 Installation CocoaPods use_

Swift wrapper for custom ViewController presentations on iOS
Swift wrapper for custom ViewController presentations on iOS

Presentr is a simple customizable wrapper for the Custom View Controller Presentation API introduced in iOS 8. About iOS let's you modally present any

Popover is a balloon library like Facebook app. It is written in pure swift.
Popover is a balloon library like Facebook app. It is written in pure swift.

Popover Description and appetize.io`s DEMO Usage To run the example project, clone the repo, and run pod install from the Example directory first. Sim

UIWindow subclass to enable behavior like adaptive round-corners & detecting when Control Center is opened.
UIWindow subclass to enable behavior like adaptive round-corners & detecting when Control Center is opened.

UIWindow subclass to enable behavior like adaptive round-corners & detecting when Control Center is opened.

A Swift Popup Module help you popup your custom view easily
A Swift Popup Module help you popup your custom view easily

JFPopup JFPopup is a Swift Module help you popup your custom view easily. Support 3 way to popup, Drawer, Dialog and BottomSheet. Example To run the e

A view that takes a set of images, make transition from one to another by using flipping effects.
A view that takes a set of images, make transition from one to another by using flipping effects.

CDFlipView A view that takes a set of images, make transition from one to another by using flipping effects. Demo Live Demo: https://appetize.io/app/w

LocalAuth - Another Fusion library to implement the local authentication using Biometry

FusionLocalAuth Another Fusion library to implement the local authentication usi

Another network wrapper for URLSession. Built to be simple, small and easy to create tests at the network layer of your application.
Another network wrapper for URLSession. Built to be simple, small and easy to create tests at the network layer of your application.

Another network wrapper for URLSession. Built to be simple, small and easy to create tests at the network layer of your application. Install Carthage

A simple, customizable popup dialog for iOS written in Swift. Replaces UIAlertController alert style.
A simple, customizable popup dialog for iOS written in Swift. Replaces UIAlertController alert style.

Introduction Popup Dialog is a simple, customizable popup dialog written in Swift. Features Easy to use API with hardly any boilerplate code Convenien

Simple Swift class for iOS that shows nice popup windows with animation.
Simple Swift class for iOS that shows nice popup windows with animation.

NMPopUpView Simple class for iOS that shows nice popup windows, written in Swift. The project is build with Swift 4.0, so you need Xcode 9.0 or higher

A simple, customizable popup dialog for iOS written in Swift. Replaces UIAlertController alert style.
A simple, customizable popup dialog for iOS written in Swift. Replaces UIAlertController alert style.

Introduction Popup Dialog is a simple, customizable popup dialog written in Swift. Features Easy to use API with hardly any boilerplate code Convenien

A simple custom popup dialog view for iOS written in Swift. Replaces UIAlertController alert style.
A simple custom popup dialog view for iOS written in Swift. Replaces UIAlertController alert style.

A simple custom popup dialog view for iOS written in Swift. Replaces UIAlertController alert style.

SSToastMessage is written purely in SwiftUI. It will add toast, alert, and floating message view over the top of any view. It is intended to be simple, lightweight, and easy to use. It will be a popup with a single line of code.
SSToastMessage is written purely in SwiftUI. It will add toast, alert, and floating message view over the top of any view. It is intended to be simple, lightweight, and easy to use. It will be a popup with a single line of code.

SSToastMessage SSToastMessage is written in SwiftUI. It will add toast, alert, and floating message view over the top of any view. It is intended to b

The library allows to create simple popup menus

react-native-popup-menu This library allows to create simple popup menus Installation "react-native-popup-menu": "sergeymild/react-native-popup-menu"

PTPopupWebView is a simple and useful WebView for iOS, which can be popup and has many of the customized item.
PTPopupWebView is a simple and useful WebView for iOS, which can be popup and has many of the customized item.

PTPopupWebView PTPopupWebView is a simple and useful WebView for iOS, which can be popup and has many of the customized item. Requirement iOS 8.0 Inst

IAMPopup is a simple class for expressing custom popup in various forms.
IAMPopup is a simple class for expressing custom popup in various forms.

IAMPopup Introduction IAMPopup is a simple class for expressing custom popup in various forms. This includes where to display the popup and space to d

Comments
  • Unidentified view on top of popup view if rendered after camera image picker dismissal

    Unidentified view on top of popup view if rendered after camera image picker dismissal

    I tried showing login screen popup provided in the demo after a the dismissal of camera imagepicker view. It shows 2 unidentified views on top of the popup view causing to obstruct interaction with the popup view. This happens only if i tried to show the popup after camera view dismissal

    Device: iPhone XS iOS: 13.5.1

    func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        let imagePickerVC = UIImagePickerController()
        imagePickerVC.delegate = self
        magePickerVC.sourceType = .camera
        imagePickerVC.videoMaximumDuration = 10
        imagePickerVC.mediaTypes = [String(kUTTypeMovie), String(kUTTypeImage)]
        present(imagePickerVC, animated: true)
    }
    
    func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {
        dismiss(animated: true) {
            PopupWindowManager.shared.changeKeyWindow(rootViewController: LoginPopupViewController())
        }
    }
    
    Screenshot 2020-06-27 at 00 36 31
    opened by cha777 1
  • Fatal Error

    Fatal Error

    There is a fatal error in PopupViewContainable.swift using Xcode 11.3: PopupViewContainable.swift:12:5: error: 'weak' cannot be applied to a property declaration in a protocol weak var containerView: UIView! { get }

    The error can be fixed by removing the "weak" in the var declaration. I'm not sure if a property needs to be declared as "weak" instead.

    opened by EricSpera 0
  • BasePopupViewController missing from Pod download

    BasePopupViewController missing from Pod download

    Hi,

    When I try and use the info from the sample app, I noticed that your pod file contains "BasePopupViewController" but this isn't there when I download the latest pod file

    opened by kyramckenna 0
  • Can't use with Cocoapods

    Can't use with Cocoapods

    When performing pod install the error appears:

    [!] CocoaPods could not find compatible versions for pod "PopupWindow": In Podfile: PopupWindow

    Specs satisfying the PopupWindow dependency were found, but they required a higher minimum deployment target.

    Which version should I use?

    opened by haroldogtf 2
Owner
shinji hayashi
shinji hayashi
Simple Swift class for iOS that shows nice popup windows with animation.

NMPopUpView Simple class for iOS that shows nice popup windows, written in Swift. The project is build with Swift 4.0, so you need Xcode 9.0 or higher

Nikos Maounis 194 Jun 5, 2022
A simple, customizable popup dialog for iOS written in Swift. Replaces UIAlertController alert style.

Introduction Popup Dialog is a simple, customizable popup dialog written in Swift. Features Easy to use API with hardly any boilerplate code Convenien

Orderella Ltd. 3.8k Dec 20, 2022
SSToastMessage is written purely in SwiftUI. It will add toast, alert, and floating message view over the top of any view. It is intended to be simple, lightweight, and easy to use. It will be a popup with a single line of code.

SSToastMessage SSToastMessage is written in SwiftUI. It will add toast, alert, and floating message view over the top of any view. It is intended to b

Simform Solutions 223 Dec 2, 2022
The library allows to create simple popup menus

react-native-popup-menu This library allows to create simple popup menus Installation "react-native-popup-menu": "sergeymild/react-native-popup-menu"

SergeyMild 0 Aug 20, 2022
IAMPopup is a simple class for expressing custom popup in various forms.

IAMPopup Introduction IAMPopup is a simple class for expressing custom popup in various forms. This includes where to display the popup and space to d

Hosung Kang 18 Dec 29, 2022
Simple way to present custom views as a popup in iOS and tvOS.

PopupKit PopupKit is a simple and flexible iOS framework for presenting any custom view as a popup. It includes a variety of options for controlling h

Pointwelve 59 Mar 1, 2022
STPopup provides STPopupController, which works just like UINavigationController in popup style, for both iPhone and iPad. It's written in Objective-C and compatible with Swift.

STPopup STPopup provides STPopupController, which works just like UINavigationController in popup style, for both iPhone and iPad. It's written in Obj

Kevin Lin 2.6k Jan 6, 2023
PopupController is a controller for showing temporary popup view.

PopupController PopupController is a controller for showing temporary popup view. Demo Try PopupController on Appetize.io Installation CocoaPods pod '

daisuke sato 338 Dec 14, 2022
A lightweight library for popup view

SHPopup SHPop is lightweight library used for popup view Sample One Sample Two Sample Three Features SHPopup supports a popup inside another popup wit

Shezad Ahamed 37 Oct 2, 2022
⛩ Presenting custom views as a popup in iOS.

FFPopup is a lightweight library for presenting custom views as a popup. Bounce from Top & Bounce to Bottom Bounce from Top & Bounce to Top Bounce in

JonyFang 828 Jan 5, 2023