Я пытаюсь отобразить атрибутивную строку, используя разные размеры шрифта с одинаковой высотой строки, вот что я пробовал до сих пор:
let paraStyle = NSMutableParagraphStyle()
paraStyle.maximumLineHeight = 30
let username = NSMutableAttributedString(string: user.username, attributes: [
NSAttributedString.Key.font: UIFont(name: "Oswald-Medium", size: 17) as Any,
NSAttributedString.Key.foregroundColor: UIColor(named: "DarkColor") as Any,
NSAttributedString.Key.paragraphStyle: paraStyle
])
let onlineColor = UIColor(named: user.online ? "OnlineColor" : "OfflineColor")
let online = NSMutableAttributedString(string: "• ", attributes: [
NSAttributedString.Key.font: UIFont.systemFont(ofSize: 24) as Any,
NSAttributedString.Key.foregroundColor: onlineColor as Any,
NSAttributedString.Key.baselineOffset: -4
])
let text = NSMutableAttributedString(string: content, attributes: [
NSAttributedString.Key.font: UIFont(name: "Oswald-Regular", size: 14) as Any,
NSAttributedString.Key.foregroundColor: UIColor(named: "TextColor") as Any
])
username.append(online)
username.append(text)
Результат выглядит так, я хотел бы первая строка имеет ту же высоту, что и другие.

Я играл с lineSpacing
и lineHeightMultiple
, но всегда есть пробел, есть идеи как это исправить?