测试已测试 | ✗ |
Lang语言 | SwiftSwift |
许可证 | MIT |
发布最新发布 | 2016年11月 |
SPM支持 SPM | ✗ |
由 Charlie Williams 维护。
您需要一个好看的 iOS 推送通知 UI 来显示弹窗吗?这里就是。
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 是对 AGPushNote(《https://github.com/avielg/AGPushNote》)的 Swift 2.0 再解释。
未来的改进
要运行示例项目,先克隆仓库,然后在 Example 目录下运行 pod install
。
SwiftyTimer
CWNotificationBanner 可通过 CocoaPods 获取。要安装它,只需将以下行添加到您的 Podfile 中
pod "CWNotificationBanner"
Charlie Williams, [email protected] / @buildsucceeded
CWNotificationBanner 在 MIT 许可下可用。有关更多信息,请参阅 LICENSE 文件。