// View controller call
viewModel.bindNotificationReadEvents(readNotificationID: readNotificationIDPublisher.asDriver(onErrorDriveWith: .empty()))
viewModel.reloadDataSourceForNotificationReadEvent.drive(reloadDataSourceForNotificationReadEventBinder).disposed(by: rx.disposeBag)
// View model
var reloadDataSourceForNotificationReadEvent: Driver<[NotificationItem]> = .empty()
fileprivate let dataSourceRelay = BehaviorRelay<[NotificationItem]>(value: [])
public func bindNotificationReadEvents(readNotificationID: Driver<String>) {
readNotificationID.drive(onNext: { [weak self] notificationID in
// read notification IDs on User Defaults
UserDefaults.main?.unreadNotificationIDs.append(notificationID)
// Update data source relay
self?.reloadDataSourceForNotificationReadEvent = readNotificationID.withLatestFrom(self?.dataSourceRelay.asDriver() ?? .empty())
}).disposed(by: rx.disposeBag)
}
when this method is called from the viewcontroller in the viewmodel it just skips both the lines and nothing executes when i checked it while debugging neither is the userdefaults updated nor is data source relay can someone please help me out.