AGPushNote alternative for Swift? [closed]

南笙酒味 提交于 2019-12-13 02:07:16

问题


Just as the title says, do you know any alternative of AGPushNote for Swift ?

In order to better understand what I was searching for when I found out on SO about this, I would like to .. "detect" when push notifications are incoming and app is active so I can prevent the notifications from showing up and do some of my own stuff instead.


回答1:


I just published a pod that does exactly that.

Example usage:

import CWNotificationBanner

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

    let message = Message(text: "You have an alert")
    NotificationBanner.showMessage(message)

    let message = Message("You have an alert", displayDuration: 2)
    NotificationBanner.showMessage(message)

}

override func viewWillDisappear() {
    super.viewWillDisappear()

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

Feel free to check out & contribute if you like!



来源:https://stackoverflow.com/questions/33470729/agpushnote-alternative-for-swift

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!