Latest 1.0.4
Homepage https://github.com/startupthekid/DropdownAlert
License MIT
Platforms ios 8.0
Dependencies pop
Authors

Version
License
Platform

A clean, customizable Swift alternative to RKDropdownAlert.

Overview

RKDropdownAlert is great. It’s simple and easy to use. The developer is a great guy.
But…there are some problems.

First, it’s written in Objective-C and any Swift developer will tell you the same thing:

ew

Second, it’s not responsive. To be truly responsive, any view library should be written using AutoLayout.

Finally, there’s a huge caveat:

WAIT! Don’t use pods if you want to customize or use the quick and easy [RKDropdownAlert show]

Developers have come to expect the convenience of Cocoapods and if you can’t both customize the dropdown and download it from Cocoapods, what’s the point?

That’s where DropdownAlert comes in. Weighing in at just under 300 lines, DropdownAlert is sleek, fully customizable, responsive, Swift 2.3 compatible, and powered by Facebook’s pop animation library, allowing for awesome custom animations.

Usage

DropdownAlert comes with 3 animation types, Basic, Spring, and Custom:


/**
Animation types the dropdown can be presented with.

- Basic:  Basic, simple animation.
- Spring: Spring animation.
- Custom: Custom animation.
*/
public enum AnimationType {
    case Basic(timingFunction: CAMediaTimingFunction)
    case Spring(bounce: CGFloat, speed: CGFloat)
    case Custom(POPPropertyAnimation)
}

Simply call like so:

DropdownAlert.showWithAnimation(.Basic(timingFunction: CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseIn)), title: "Login Failed", message: "Incorrect username/password", duration: 2)

animation-demo

You can stack as many animations as you want:

stacked-animations

Customization

Unlike RKDropdownAlert, DropdownAlert is fully customizable in conjunction with Cocoapods. The following class level properties are customizable:

class var defaultBackgroundColor: UIColor
class var defaultTextColor: UIColor 
class var defaultTitle: String
class var defaultMessage: String
class var defaultAnimationDuration: Double
class var defaultDuration: Double
class var defaultHeight: CGFloat
class var defaultTitleFont: UIFont
class var defaultMessageFont: UIFont
class var defaultFontSize: CGFloat

And because DropdownAlert internally uses Autolayout, the size of the alert will be always be greater than or equal to the default height + content overflow size, meaning your message can be as long as you want!

To customize a particular attribute:

DropdownAlert.defaultHeight = 110
DropdownAlert.defaultBackgroundColor = UIColor.blueColor()

Support

Feel free to open an issue or issue a PR! Check out the contribution guide for more info.

Example

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

Installation

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

pod "DropdownAlert"

Author

Brendan Conron, [email protected]

Twitter

License

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

Latest podspec

{
    "name": "DropdownAlert",
    "version": "1.0.4",
    "summary": "Customizable, simple, dropdown alert written in Swift.",
    "description": "DropdownAlert offers a simple, easy-to-use alternative to RKDropdownAlert, written entirely in Swift. DropdownAlert is responsive and powered by Facebook's pop animation engine.",
    "homepage": "https://github.com/startupthekid/DropdownAlert",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Brendan Conron": "[email protected]"
    },
    "source": {
        "git": "https://github.com/startupthekid/DropdownAlert.git",
        "tag": "1.0.4"
    },
    "social_media_url": "https://twitter.com/startupthekid",
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "DropdownAlert/Classes/*",
    "resource_bundles": {
        "DropdownAlert": [
            "DropdownAlert/Assets/*.*"
        ]
    },
    "dependencies": {
        "pop": []
    }
}

Pin It on Pinterest

Share This