Just inherited this code base and I'm not quite familiar with RxSwift. I've done some reading but cannot find a solution to my problem.
We have a variable declared. This saves information from a network call, and then is being used to load information to a collection view. Therefore the collection view is showing multiple similar items
var allPhotos = BehaviorRelay<[Photo]>.init(value: [])
How do I convert it to a set to remove duplicates?
Try this:
let filteredPhotos = allPhotos.asObservable().map { Array(Set($0)) }
PS: Make sure Photo conforms to Hashable