Skip to content
 
 

Repository files navigation

RxUserNotifications

CI Status Version License Platform

Example

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

Requirements

Xcode 10, Swift 4.2

Installation

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

pod 'RxUserNotifications'

Usage

Simply subscribe to willPresentNotification or didReceiveResponse like below:

let center = UNUserNotificationCenter.current()

// Presenting notification when app is in foreground.

center.rx.willPresentNotification
	.subscribe(onNext: { (notification: UNNotification, completion: UNUserNotificationCenter.WillPresentNotificationCompletionHandler) in
		// Do something
		completion([.badge, .alert, .sound])
	})
	.disposed(by: disposeBag)

// Receiving user response

center.rx.didReceiveResponse
	.subscribe(onNext: { (response: UNNotificationResponse, completion: UNUserNotificationCenter.DidReceiveResponseCompletionHandler) in
		// Do something
		completion()
	})
	.disposed(by: disposeBag)

Author

lobocode, pawelrup@lobocode.pl

License

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

About

Reactive extension for UserNotifications.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages