我有这段代码:
let appActiveNotifications: [Observable<NSNotification>] = [
NSNotificationCenter.defaultCenter().rx_notification(UIApplicationWillEnterForegroundNotification),
NSNotificationCenter.defaultCenter().rx_notification(Constants.AppRuntimeCallIncomingNotification)
]
appActiveNotifications.merge()
.takeUntil(self.rx_deallocated)
.subscribeNext() { [weak self] _ in
// notification handling
}
.addDisposableTo(disposeBag)
它应该监听任何一个指定的通知并在任何一个被触发时进行处理。
但是,这不会编译。我收到以下错误:
Value of type '[Observable<NSNotification>]' has no member 'merge'
那我应该如何将这两个信号合并为一个呢?