Latest 1.5.1
Homepage https://github.com/RicardoKoch/SmartPopup
License MIT
Platforms ios 7.0, requires ARC
Authors

[![CI Status](http://img.shields.io/travis/Ricardo Koch/SmartPopup.svg?style=flat)](https://travis-ci.org/Ricardo Koch/SmartPopup)
Version
License
Platform

Usage

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

SmartPopup is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "SmartPopup"

Author

Ricardo Koch, [email protected]

License

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

Description

Cocoapods component for easy creating and management of UI dialogs for iOS

How to Use

Just access SmartPopup singleton from anywhere to show amazing animated popups.

SmartPopup.instance().showWithTitle("Welcome", message: "Welcome to Smart Popups!", buttons: nil)

If you want to define buttons for your model.

var btn1 = SmartPopupButton(text: "Close Me", andBlock: {
    (instance:String!) -> Void in
    //Button click callback (instance: id of the popup)
})

Or you can simply create them inline with the popup.

SmartPopup.instance().showWithType(SmartPopupTypeImage, image: UIImage(named: "questionIcon"), title: "Question", message: "Do you want to save?", buttons:
    [
        SmartPopupButton(text: "Yes", andBlock: {
            (instance:String!) -> Void in 
        }),
        SmartPopupButton(text: "No", andBlock: {
            (instance:String!) -> Void in
        })
    ]
)

You have five types of popups to play with: plain, with image, with image view, with activity indicator and a custom popup with xib.

Custom Popups

Custom popups can have any interface you want. They can be completly customized because they are built using the IB and a View class. The SmartPopup singleton will just manage the presentation of thoses popups for you.
To create a custom SmartPopup user interface you must first create a Xib file and design anything you want. Then create a View class and implement the following protocol:

SmartPopupViewProtocol

This protocol must be implemented so the SmartPopup component understand your view as a custom popup.
This is a sample implementation you can follow:

//#Method used to instantiate the view and sent as parameter to the SmartPopup singleton
class func createFromXib() -> SmartPopupViewProtocol! {

    let array = NSBundle.mainBundle().loadNibNamed("XibNameHere", owner: self, options: nil)

    if array?.count > 0 {
        if let dialog = array![0] as? SmartPopupViewProtocol {
            return dialog
        }
    }
    return nil
}

//#Called to pass arguments to customize the behavior of the class and UI
func setArgs(args: [AnyObject]!) {

    if args != nil && args.count > 0 {
        if let arg = args[0] as? String {
            self.title = arg
        }
    }
}

//#Used when the popup is going to be shown.
func willShowWithId(identifier: String!) {
    self.popupId = identifier
}

//#Used when the UI components are going to be presented in the screen. This is when you should configure views, create or customize.
func config() {
}

Latest podspec

{
    "name": "SmartPopup",
    "version": "1.5.1",
    "summary": "SmartPopup allows easy creation and management of pretty UI dialogs for iOS",
    "description": "Cocoapods component for easy creation and management of animated and engaging UI dialogs for iOS. Easily create animated and modern dialogs with very little code. Customize completly the dialog UI with Xibs and reuse it throughout your app.",
    "homepage": "https://github.com/RicardoKoch/SmartPopup",
    "license": "MIT",
    "authors": {
        "Ricardo Koch": "[email protected]"
    },
    "source": {
        "git": "https://github.com/RicardoKoch/SmartPopup.git",
        "tag": "1.5.1"
    },
    "platforms": {
        "ios": "7.0"
    },
    "requires_arc": true,
    "source_files": "Pod/Classes/**/*"
}

Pin It on Pinterest

Share This