From f8f14dc8ea37e2ba8481af1433552da3b5921640 Mon Sep 17 00:00:00 2001 From: Steven Deutsch Date: Tue, 15 Aug 2017 00:47:31 -0500 Subject: [PATCH] Fix estimated width layout bug by rounding up --- Sources/MessagesCollectionViewFlowLayout.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Sources/MessagesCollectionViewFlowLayout.swift b/Sources/MessagesCollectionViewFlowLayout.swift index 8e578c0d..275fd3c0 100644 --- a/Sources/MessagesCollectionViewFlowLayout.swift +++ b/Sources/MessagesCollectionViewFlowLayout.swift @@ -294,12 +294,12 @@ extension MessagesCollectionViewFlowLayout { switch message.data { case .text(let text): - estimatedWidth = text.width(considering: containerHeight, and: messageLabelFont) + estimatedWidth = text.width(considering: containerHeight, and: messageLabelFont).rounded(.up) case .attributedText(let text): - estimatedWidth = text.width(considering: containerHeight) + estimatedWidth = text.width(considering: containerHeight).rounded(.up) } - let widthToUse = estimatedWidth.rounded(.up) > availableWidth ? availableWidth : estimatedWidth + let widthToUse = estimatedWidth > availableWidth ? availableWidth : estimatedWidth let finalWidth = widthToUse + horizontalMessageInsets