I have an observable sequence which represent my displayed sessions as follow :
private let displayedSessions =
PublishSubject<[ProgramDaySessionsModels.ViewModels.Session]>()
And here is my ViewModel:
struct ViewModels {
struct Session{
let id : Int?
let title : String?
let location : String?
var isAddedToCalendar : Bool?
var isAddedToFavorite : Bool?
let time : String?
}
}
The displayed sessions is being binded to a table view:
func setupCellBinding(){
displayedSessions
.asObservable()
.bind(to:
tableView
.rx
.items(cellIdentifier:
R.reuseIdentifier.programDaySessionCell.identifier,
cellType: ProgramDaySessionCell.self)
){
( row, element, cell ) in
cell.setup(withViewModel: element)
}
.disposed(by: disposeBag)
}
Now after i call the setup method in the cell, i want to subscribe to an image tap inside my cell, regardless what is the subscription logic will be ....
I want after that to update my displayed viewModel , for example i want to change the property isAddedToCalendar to false/true when the subscription logic end...
My question is , How to update or change a value stored in the Subject without calling onNext operator