Improve username setup

This commit is contained in:
Ilya Laktyushin
2021-02-17 19:36:40 +04:00
parent 666b93af70
commit dcf0ccf6eb
4 changed files with 33 additions and 7 deletions

View File

@@ -191,7 +191,7 @@ final class ChatTitleView: UIView, NavigationBarTitleView {
}
latestIndex = range.upperBound
let part = String(rawText[rawText.index(rawText.startIndex, offsetBy: lowerSegmentIndex) ..< rawText.index(rawText.startIndex, offsetBy: range.upperBound)])
let part = String(rawText[rawText.index(rawText.startIndex, offsetBy: lowerSegmentIndex) ..< rawText.index(rawText.startIndex, offsetBy: min(rawText.count, range.upperBound))])
if index == 0 {
segments.append(.number(count, NSAttributedString(string: part, font: textFont, textColor: textColor)))
} else {