How to observe a change in viewModel in order to reload collectionView using RxSwift?

879 views Asked by At

I have the following code to configure my collectionView:

viewModel?
    .observableExercises
    .bindTo(
        exercisesCollectionView
            .rx
            .items(cellIdentifier: "My identifier",
                   cellType: ExerciseCollectionViewCell.self)) {
                    index, exercise, cell in
                    cell.exercise = exercise
    }
    .addDisposableTo(disposeBag)

It all works fine at first, but later when my viewModel.observableExercises gets updated I would like to have the exercisesCollectionView reload its data. How should I do it?

0

There are 0 answers