Latest 0.2.0
Homepage https://github.com/daisuke310vvv/PopupController
License MIT
Platforms ios 8.0, requires ARC
Authors

CI Status
Version
License
Platform

PopupController is a controller for showing temporary popup view.

PopupControllerPopupControllerPopupController

Demo

Try PopupController on Appetize.io

PopupController

Installation

CocoaPods

pod 'PopupController'

Carthage

Future

Usage

Before use,
Every ViewController which is added on the PopupController must conform to PopupContentViewController protocol.

class AnyPopupViewController: UIViewController, PopupContentViewController {

    // Do something...

    private var popupSize: CGSize // define the size for showing popup view size.

    // PopupContentViewController Protocol
    func sizeForPopup(popupController: PopupController, size: CGSize, showingKeyboard: Bool) -> CGSize {
        return popupSize
    }
}

Then, show popup

PopupController
    .create(self)
    .show(AnyPopupViewController())

With some custom.

PopupController
    .create(self)
    .customize(
        [
            .Animation(.FadeIn), 
            .Layout(.Top), 
            .BackgroundStyle(.BlackFilter(alpha: 0.7))
        ]
    )
    .show(AnyPopupViewController())

With Handler

PopupController
    .create(self)
    .customize(
        [
            .Scrollable(false), 
            .DismissWhenTaps(true)
        ]
    )
    .didShowHandler { popup in
        // Do something
    }
    .didCloseHandler { _ in
        // Do something
    }
    .show(AnyPopupViewController())

If you use PopupController instance, do like this below

let popup = PopupController
    .create(self)
    .customize(
        [
            .Animation(.SlideUp)
        ]
    )
    .didShowHandler { popup in
        // Do something
    }
    .didCloseHandler { _ in
       // Do something
    }

popup.show() // show popup
popup.dismiss() // dismiss popup

Customization

public enum PopupCustomOption {
    case Layout(PopupController.PopupLayout)
    case Animation(PopupController.PopupAnimation)
    case BackgroundStyle(PopupController.PopupBackgroundStyle)
    case Scrollable(Bool)
    case DismissWhenTaps(Bool)
    case MovesAlongWithKeyboard(Bool)
}

License

PopupController is available under the MIT lincense. See the LINCENSE file for more info.

Latest podspec

{
    "name": "PopupController",
    "version": "0.2.0",
    "summary": "PopupController is a controller for showing temporary popup view.",
    "homepage": "https://github.com/daisuke310vvv/PopupController",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Daisuke Sato": "[email protected]"
    },
    "social_media_url": "http://twitter.com/st_dsk",
    "platforms": {
        "ios": "8.0"
    },
    "requires_arc": true,
    "source": {
        "git": "https://github.com/daisuke310vvv/PopupController.git",
        "tag": "0.2.0"
    },
    "source_files": "Classes/*.swift"
}

Pin It on Pinterest

Share This