Latest 0.2.0
Homepage https://github.com/cre8it/EVWDropDownNotification
License MIT
Platforms ios 8.0
Frameworks UIKit
Authors

A simple but yet powerful Swift Dropdown Notification for iOS inspired by AlvaroFranco but rewritten in Swift 2.2 and extended to offer much more customisation

Version
License
Platform

Example 1

Features

  • [x] Written in Swift 2.2
  • [x] Customisable Button Alignment (Top, Bottom)
  • [x] Customisable Button Parameters (e.g. Corner Radius, Border Color & Width)
  • [x] Customisable Button Dipslay (only Top, only Bottom, Both)
  • [x] Customisable Icon
  • [x] Customisable Independent Text Color & Size for Title and Subtitle
  • [x] Customisable Background Color or Blur Effect
  • [x] Customisable TapToDismiss Delegate
  • [x] Customisable Animation

Example

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

Requirements

Requires iOS SDK version > 8.0

Installation

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

pod "EVWDropDownNotification"

Usage

First import the "EVWDropDownNotification" module:

import EVWDropDownNotification

Then extend your ViewController with the "EVWDropDownNotificationDelegate" and initialise a class variable of type "EVWDropDownNotification":

class ViewController: UIViewController, EVWDropDownNotificationDelegate {

let notification = EVWDropDownNotification()
...

Implement the 3 Delegate Methods:


func dropdownNotificationBottomButtonTapped() {
  //Do something
  ...
  //Dismiss the notification view
  notification.dismissWithGravityAnimation(true)
}

func dropdownNotificationTopButtonTapped() {
  //Do something
  ...
  //Dismiss the notification view
  notification.dismissWithGravityAnimation(true)
}

func dropdownNotificationDismissedWithTap() {
  //Do something
  ...
  // !!!!! NO NEED TO DISMISS THE NOTIFICATION VIEW !!!!!
}

In your ViewDidLoad set the Properties for the Notification (see below for all available properties):

  notification.delegate = self
  notification.image = UIImage(named: "notification")
  notification.bottomButtonText = "Accept"
  notification.topButtonText = "Cancel"
  notification.dismissOnTap = false
  notification.buttonVerticalAligment = .Bottom
  notification.titleText = "Title Here"
  notification.subtitleText = "Message Here" 

Once all properties set, call the following function to display the Notfication:

 /*
 * NOTE: always provide the ViewController (self.view.Superview) as first parameter
 */
 notification.presentInView(self.view.superview!, withGravityAnimation: true)

Properties

The following public properties are available, please note that some are required and some other are optional because default values have been set:

Required

The only two mandatory properties are the Title and Subtitle of the Notification

  /*
  * Title Attributes
  */

  public var titleText:String?

  /*
  * Subtitle Attributes
  */

  public var subtitleText:String?

Optional

All properties below are optional. !! Note that Buttons will only be displayed if the buttonText is provided !!

  /*
  * Padding between elements
  */

  public var paddingBetweenElements:CGFloat = 10

  /*
  * Background Color If set, it overwrites the blur effect
  */

  public var backgroundColor:UIColor?

  /*
  * Title Properties
  */

  public var titleLabelFontSize:CGFloat = 19
  public var titleLabelColor:UIColor = UIColor.blackColor()

  /*
  * Subtitle Propperties
  */

  public var subTitleLabelFontSize:CGFloat = 14
  public var subTitleLabelColor:UIColor = UIColor.blackColor()

  /*
  * General Button Properties
  */

  public var buttonFontSize:CGFloat = 13
  public var buttonCornerRadius:CGFloat = 10
  public var buttonBorderWidth:CGFloat = 1
  public var buttonBorderColor:UIColor = UIColor.blackColor()
  public var buttonWidth:CGFloat = 75
  public var buttonHeight:CGFloat = 30
  public var buttonVerticalAligment:ButtonPosition = .Bottom

  /*
  * Top Button Properties
  */

  public var topButtonTextColor:UIColor = UIColor.blackColor()
  public var topButtonBackgroundColor:UIColor = UIColor.clearColor()

  /*
  * Bottom Button Properties
  */

  public var bottomButtonTextColor:UIColor = UIColor.blackColor()
  public var bottomButtonBackgroundColor:UIColor = UIColor.clearColor()

  /*
  * Icon Properties -> Size is squared
  */

  public var imageSquaredSize:CGFloat = 40
  public var image:UIImage?

  /*
  * Dismiss On Tap
  */

  public var dismissOnTap:Bool = false

Author

CRE8IT GmbH, Switzerland

License

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

Latest podspec

{
    "name": "EVWDropDownNotification",
    "version": "0.2.0",
    "summary": "A simple but yet powerfull DropDown Notification for iOS",
    "description": "A simple but yet powerfull DropDown Notification View for iOS written in Swift. The notification is fully configurable through exposed properties (e.g. Button Alignment, Text Color, Button Radius etc) and offers 3 delegate methods for events",
    "homepage": "https://github.com/cre8it/EVWDropDownNotification",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "CRE8IT GmbH": "[email protected]"
    },
    "source": {
        "git": "https://github.com/cre8it/EVWDropDownNotification.git",
        "tag": "0.2.0"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "EVWDropDownNotification/Classes/**/*",
    "frameworks": "UIKit"
}

Pin It on Pinterest

Share This