I would like to scroll the UICollectionView to the bottom so the last item is in the view. I have tried to use scrollToItemAtIndexPath but it does not seem to be working. I want
For Swift -
For Horizontal Scrolling - .right
For Vertical Scrolling - .bottom
override func viewDidLayoutSubviews() {
let section = 0
let lastItemIndex = self.dateCollectionView.numberOfItemsInSection(section) - 1
let indexPath:NSIndexPath = NSIndexPath.init(forItem: lastItemIndex, inSection: section)
self.dateCollectionView.scrollToItemAtIndexPath(indexPath, atScrollPosition: .right, animated: false)
}