There is a UIViewController UIViewController with a UIViewController inserted in it, as well as a UICollectionView using AutoLayout and stretching along the edges of the UIViewController . I create cells and sections by inserts. And also I go down to the last cell.
private func addNewMessage() { let tuplForAdd = dataSource.newMessage() if tuplForAdd.needNewSection { collectionView!.insertSections(dataSource.indexSet) } else { collectionView!.insertItems(at: [tuplForAdd.indexPath]) } collectionView.scrollToItem(at: tuplForAdd.indexPath, at: .bottom, animated: true) } Everything works fine until I prescribe a small contentInset
collectionView.contentInset.top = 64 After that, scrolling does not start immediately, but after scrolling down the height of the main window to 64. How can this be solved?
P / S The solution cannot be layout.sectionInset (as the height of the header section depends on it)