Latest 0.2.2
Homepage https://github.com/charliewilliams/CWNotificationBanner
License MIT
Platforms ios 8.0
Dependencies SwiftyTimer
Frameworks UIKit, Foundation
Authors

You want a nice iOS Push Notification UI to display popover banners? Here it is.

  • Supports queueing messages: new messages are displayed immediately, then NotificationBanner automatically walks backward as the messages expire or are dismissed.
  • Supports cancelling individual message or all of them at once.

import CWNotificationBanner

override func viewDidLoad() {
    super.viewDidLoad()

    // MessageAction to register blocks by key to call when tapping a message banner
    let tapAction:MessageAction = { Void in

    let alert = UIAlertController(title: "Tapped the alert banner", message: "Popups are a terrible user experience, eh?", preferredStyle: .Alert)
    self.showViewController(alert, sender: nil)
    }

    Message.registerAction(tapAction, forKey: "tapAction")
}

override func viewDidAppear(animated: Bool) {
    super.viewDidAppear(animated)

    let message = Message(text: "Hello there")

    NotificationBanner.showMessage(message)
}

override func viewWillDisappear() {
    super.viewWillDisappear()

    NotificationBanner.cancelMessage(message, animated: false)
    NotificationBanner.cancelAllMessages()
}

CWNotificationBanner is a Swift 2.0 re-interpretation of AGPushNote (https://github.com/avielg/AGPushNote).

Future improvements: (pull requests welcome!)

  • Improve documentation
  • Improve example app
  • Implement customizations for the banner display

CI Status
Version
License
Platform

Usage

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

Requirements

SwiftyTimer

Installation

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

pod "CWNotificationBanner"

Author

Charlie Williams, [email protected] / @buildsucceeded
Attribution / Twitter shout-outs / follows very much appreciated.

License

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

Latest podspec

{
    "name": "CWNotificationBanner",
    "version": "0.2.2",
    "summary": "You want a nice iOS Push Notification UI to display popover banners? Here it is.",
    "description": "CWNotificationBanner provides an easy way to mimic the iOS push notification UI while your app is active.",
    "homepage": "https://github.com/charliewilliams/CWNotificationBanner",
    "license": "MIT",
    "authors": {
        "Charlie Williams": "[email protected]"
    },
    "source": {
        "git": "https://github.com/charliewilliams/CWNotificationBanner.git",
        "tag": "0.2.2"
    },
    "social_media_url": "https://twitter.com/buildsucceeded",
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "CWNotificationBanner/Classes/**/*",
    "resource_bundles": {
        "CWNotificationBanner": [
            "CWNotificationBanner/Assets/*.{png,xib}"
        ]
    },
    "frameworks": [
        "UIKit",
        "Foundation"
    ],
    "dependencies": {
        "SwiftyTimer": [
            "~> 1.4"
        ]
    }
}

Pin It on Pinterest

Share This