测试已测试 | ✗ |
语言语言 | SwiftSwift |
许可证 | MIT |
发布最新发布 | 2017年3月 |
SwiftSwift 版本 | 3.0 |
SPM支持 SPM | ✗ |
由 kunass2 维护。
要运行示例项目,请克隆仓库,然后首先从 Example 目录运行 `pod install`。
ForegroundNotification 通过 CocoaPods 提供。要安装它,只需在 Podfile 中添加以下行:
pod "BSForegroundNotification"
如果您在 podfile 中使用了 `use_framework`,只需这样做:
import ForegroundNotification
当您需要使用它时,对每个文件进行操作。
您还可以使用
@import ForegroundNotification
在 桥接头文件 中,以避免为每个需要的文件导入框架。
let notification = ForegroundNotification(userInfo: userInfo) //remote
let notification = ForegroundNotification(localNotification: localNotification) //local
let notification = ForegroundNotification(titleLabel: "title", subtitleLabel: "subtitle", categoryIdentifier: "category") //custom initializer
ForegroundNotification.timeToDismissNotification = 4
ForegroundNotification.systemSoundID: SystemSoundID = 1001
BSForegroundNotificationDelegate
的代理请注意,ForegroundNotificationDelegate
继承自 UIApplicationsDelegate
notification.delegate = self
ForegroundNotificationDelegate
的可选方法@objc public protocol ForegroundNotificationDelegate: class, UIApplicationDelegate {
optional func foregroundRemoteNotificationWasTouched(with userInfo: [AnyHashable: Any])
optional func foregroundLocalNotificationWasTouched(with localNotification: UILocalNotification)
}
notification.presentNotification()
ForegroundNotificationDelegate
类中的一个方法func application(application: UIApplication, handleActionWithIdentifier identifier: String?, forRemoteNotification userInfo: [AnyHashable: Any], completionHandler: () -> Void)
func application(application: UIApplication, handleActionWithIdentifier identifier: String?, forRemoteNotification userInfo: [AnyHashable: Any], withResponseInfo responseInfo: [AnyHashable: Any], completionHandler: () -> Void)
func application(application: UIApplication, handleActionWithIdentifier identifier: String?, forLocalNotification notification: UILocalNotification, completionHandler: () -> Void)
func application(application: UIApplication, handleActionWithIdentifier identifier: String?, forLocalNotification notification: UILocalNotification, withResponseInfo responseInfo: [AnyHashable: Any], completionHandler: () -> Void)
Bartłomiej Semańczyk,[email protected]
BSForegroundNotification
可在 MIT 许可证下使用。更多信息请参阅 LICENSE 文件。