Closed dillidon closed 6 years ago
Instead of
private func indexPathFor(cell: UICollectionViewCell) -> Int { return indexPath(for: cell)?.item ?? -1 } public var views: [UIView] { let items = visibleCells return items.sorted(by: { indexPathFor(cell: $1) > indexPathFor(cell: $0) }) }
better to use:
public var views: [UIView] { return indexPathsForVisibleItems.sorted().compactMap { cellForItem(at: $0) } }
Good catch, I'll implement it shortly. Or do you want to send a PR @dillidon?
Implemented
Thanks @dillidon !
Instead of
better to use: