// // MessagesCollectionView+Extensions.swift // Malinka // // Created by Nut.Tech on 01.02.2023. // Copyright © 2023 NUT.Tech. All rights reserved. // import UIKit import MessageKit extension MessagesCollectionView { func scrollFullDown(animated: Bool = true) { DispatchQueue.main.async { self.performBatchUpdates(nil) { [weak self] _ in guard let self = self else { return } let contentSize = self.collectionViewLayout.collectionViewContentSize let bottomOffset = CGPoint(x: 0, y: contentSize.height - self.bounds.size.height + self.contentInset.bottom) self.setContentOffset(bottomOffset, animated: animated) } } } }