UICollectionView - scrollToBottom

Updated
Mar 7, 2021 1:31 PM
Created
Mar 7, 2021 1:29 PM
Tags
Keywords

// NOTE: It's possible for small content size this wouldn't work - https://github.com/MessageKit/MessageKit/issues/725
    public func scrollToLastItem(at pos: UICollectionView.ScrollPosition = .bottom, animated: Bool = true) {
        guard numberOfSections > 0 else { return }
        
        let lastSection = numberOfSections - 1
        let lastItemIndex = numberOfItems(inSection: lastSection) - 1
        
        guard lastItemIndex >= 0 else { return }
        
        let indexPath = IndexPath(row: lastItemIndex, section: lastSection)
        scrollToItem(at: indexPath, at: pos, animated: animated)
    }

It seems there is a issues still?