Latest 0.1.0
Homepage https://github.com/mohammadz74/EasyPopUp
License MIT
Platforms ios 9.0
Dependencies DynamicBlurView
Frameworks UIKit
Authors

EasyPopUp

EasyPopUpEasyPopUp
License

 

Introduction

With EasyPopup you can easily convert your views/UViewController’s to Popups.

 

Installation

EasyPopUp is available through CocoaPods. Simply add the following to your Podfile:

use_frameworks!

target '<Your Target Name>'
pod 'EasyPopUp'

Demo

You can easily find and run the demo app in example folder.

Usage

EasyPopup divided to two classes one for views and the other for ViewControllers.

View Usage

for view usage you should just pass your superView of your view and your view that you want to be your popup.
you can give your custom config file ( will explain deep down below ) for custom transtions,shadows,corners,… .

public init(superView: UIView, viewTopop view: UIView, config: EasyPopupConfig = default)
// example
let popupView = EasyPopup(superView: self.view, viewTopop: viewToPop)

then you can show your popup with:

public func Showpopup(completion: ((Bool) -> Void)? = nil)
// example 
popupView.showPopup { (isfinished) in
          // do after showing popup 
}

you can just show your popup or with completion handler do anything after popup animation is finished.

and for dismissing popup :

public func removePopup(completion: ((Bool) -> Void)? = nil)
// example 
popupView.removePopup { (isfinished) in
          // do after dismissing popup 
}

ViewController Usage

for viewController usage your view controller must conform to EasyPopUpViewControllerDatasource
you should pass your view ( which is in your view controller ) that you want to popup.
note that your view should have constraints in your view controller.

public init(sourceViewController: UIViewController, destinationViewController: UIViewController, config: EasyPopupConfig = default)
}

sourceViewController : the source viewController that you want to appear popup on.
destinationViewController : the popup viewController that you want to show.
config : the EasyPopup config file for giving custom shadow,transitions,cornerRadius,… .

Usage Example:

in your popup viewController class:

class popViewController: UIViewController {
    @IBOutlet weak var popupContentView: UIView!
}
extension popViewController : EasyPopUpViewControllerDatasource {
    var popupView: UIView {
        return popupContentView
    }
}

and in your source viewController:

let popupVC = self.storyboard?.instantiateViewController(withIdentifier: "popViewController") as! popViewController
let easePopUp = EasyViewControllerPopup(sourceViewController: self, destinationViewController: popupVC )

for showing popup use the showVCAsPopup method

easePopUp.showVCAsPopup()

for dismissing simply dismiss the viewController. don’t worry easypopup ovverride the default transition.

If the usage guide wasn’t useful,please run and look the example project.It will boost you 😇

Customization

Easypopup uses configuration for custom transitions,Blurs,cornerRadius and shadows.

you can pass the config popup object:

popUpView.config = popUpConfig // or pass it via initializar  

the config contains these properties:

    public var shadowEnabled : Bool // popup shadow
    public var cornerRadius: CGFloat // the cornerRadius of popup
    public var dimBackground : Bool // dim the backView of popup
    public var blurBackground : Bool // whether contain blur or not
    public var autoDismiss: Bool // the autoDismiss that dimiss popup when clicking on outside of view
    public var animationType: AnimationType // animationType enum
    public var animaionDuration : TimeInterval // animaionDuration
    public var animtionOptions: UIViewAnimationOptions // UIViewAnimationOptions
    public var blurRadius: CGFloat /// Blur Radius you should enable the blurBackground variable to work
    public var blurTrackingMode : TrackingMode /// DynamicBlurView trackingMode

EasyPopup use DynamicBlurView for background blur.
the animationType is the way your popup animates:

public enum AnimationType {
    case scale
    case upToDown
    case downToUp
    case immediate
    case rightToleft
    case leftToright
}

License

EasyPopup is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "EasyPopUp",
    "version": "0.1.0",
    "summary": "Easy way to transform UIViews to popups",
    "description": "TODO: Add long description of the pod here.",
    "homepage": "https://github.com/mohammadz74/EasyPopUp",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Mohammad": "[email protected]"
    },
    "source": {
        "git": "https://github.com/Mohammadz74/EasyPopUp.git",
        "tag": "0.1.0"
    },
    "platforms": {
        "ios": "9.0"
    },
    "swift_version": "4.0",
    "source_files": "EasyPopUp/Classes/**/*",
    "frameworks": "UIKit",
    "dependencies": {
        "DynamicBlurView": [
            "~> 2.0"
        ]
    }
}

Pin It on Pinterest

Share This