Search code examples
iosswiftchatswift5messagekit

How to reduce space between 2 message cell in MessageKit Library Swift?


I'm using MessageKit Chat Library. I removed the Avatar View from message cell. But the space between 2 message cells is too much. I want to reduce space between 2 message cell. how can I do that ?


Edit:

I  marked the spaces


Solution

  • I solved problem with cell spacing on cell in CollectionView

        if let layout = messagesCollectionView.collectionViewLayout as? MessagesCollectionViewFlowLayout {
            layout.textMessageSizeCalculator.outgoingAvatarSize = .zero
            layout.textMessageSizeCalculator.incomingAvatarSize = .zero
            layout.sectionInset = UIEdgeInsets(top: -10, left: 0, bottom: -5, right: 0)
            layout.minimumInteritemSpacing = 0
            layout.minimumLineSpacing = 0
        }