Код: Выделить всё
let adminName = " ADMIN "
let name = [adminName, "Greg Weg"].joined(separator: " ")
let attributed = NSMutableAttributedString(string: name)
let paragraphStyle = NSMutableParagraphStyle()
paragraphStyle.minimumLineHeight = 28
let adminAttributes: [NSAttributedString.Key: Any] = [
.foregroundColor: UIColor.purple,
.backgroundColor: UIColor.purple.withAlphaComponent(0.2),
.paragraphStyle: paragraphStyle,
.font: UIFont.poppinsRegular.withSize(16),
]
let adminRange = attributed.mutableString.range(of: adminName)
attributed.setAttributes(adminAttributes, range: adminRange)
//assign attributed to UILabel
[img]https://i.sstatic.net /yrj1Ltv0.jpg[/img]
Что мне нужно иметь?

Подробнее здесь: https://stackoverflow.com/questions/784 ... tributes-i
Мобильная версия