var notificationIDPublisher = PublishSubject<Void>()
public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let model = notificationItems[indexPath.row]
let cell: NotificationCell = tableView.dequeueReusableCell(for: indexPath)
readID = model.id
notificationIDPublisher.onNext(())
cell.readIndicatorImageView.isHidden = boolvalue
cell.configure(with: model)
return cell
}
fileprivate func bindCellEvents() {
let unreadNotificationsss = notificationIDPublisher.asDriver(onErrorDriveWith: .empty())
viewModel.bindCellEvents(readNotificationID: readnotificationID, unreadView: unreadNotificationsss)
}
我希望notificationIDPublisher.onNext(())
自动调用unreadNotificationsss
,它在tableView委托内部不起作用,但是当我在tableView外部调用它时,我能够实现这一点。