TestsTested | ✗ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Nov 2016 |
SPMSupports SPM | ✗ |
Maintained by Charlie Williams.
You want a nice iOS Push Notification UI to display popover banners? Here it is.
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:
To run the example project, clone the repo, and run pod install
from the Example directory first.
SwiftyTimer
CWNotificationBanner is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "CWNotificationBanner"
Charlie Williams, [email protected] / @buildsucceeded
CWNotificationBanner is available under the MIT license. See the LICENSE file for more info.