ReactiveX / RxSwift

Reactive Programming in Swift
MIT License
24.38k stars 4.17k forks source link

CollectionView #2276

Closed Odyflame closed 3 years ago

Odyflame commented 3 years ago

Short description of the issue:

I'm practicing RxSwift and doing some task with searchBar and CollectionView. when i run the app, collectionview show giphy files. but when i input some text in searchBar, collectionView doesn't reload any data. so there's empty cell when searchBar has text. when i change collectionview with tableview, it works! i think it is an issue and i post here..

  code goes here

  let _ = gifSearchBar.rx.text.orEmpty
            .throttle(.milliseconds(500), scheduler: MainScheduler.instance)
            .flatMapLatest { (query) -> Observable<[GIFViewModel]> in

                guard let model = self.gifDataViewModel else { return .just([]) }
                if query.isEmpty {
                    return model.fetchGifViewModels().catchErrorJustReturn([])
                }
                print("search..")
                return model.searchGifViewModels(keyword: query)
            }.bind(to: gifCollectionView.rx.items(
                    cellIdentifier: SearchCollectionViewCell.reuseIdentifier,
                    cellType: SearchCollectionViewCell.self)) { row, gif, cell in

                print("cell..")

                cell.configure(gif: gif)
            }.disposed(by: disposeBag)

RxSwift/RxCocoa/RxBlocking/RxTest version/commit

version or commit here

Platform/Environment

How easy is to reproduce? (chances of successful reproduce after running the self contained code)

Xcode version:

  Xcode version goes here: 12.3

:warning: Fields below are optional for general issues or in case those questions aren't related to your issue, but filling them out will increase the chances of getting your issue resolved. :warning:

Installation method:

I have multiple versions of Xcode installed: (so we can know if this is a potential cause of your issue)

Level of RxSwift knowledge: (this is so we can understand your level of knowledge and formulate the response in an appropriate manner)

freak4pc commented 3 years ago

Hi,

this doesn't look like an issue with the project itself but more of a "how do I do XXX" question. Please ask these kinds of questions in our slack channel http://slack.rxswift.org/ or some other more appropriate communication channel.

We are asking this because:

Thank you for understanding.