mirror of
https://github.com/metabolist/metatext.git
synced 2024-11-06 00:39:31 +00:00
14 lines
548 B
Swift
14 lines
548 B
Swift
// Copyright © 2020 Metabolist. All rights reserved.
|
|
|
|
import UIKit
|
|
|
|
extension UIButton {
|
|
func setAttributedLocalizedTitle(localizationKey: String, count: Int) {
|
|
let localizedTitle = String.localizedStringWithFormat(NSLocalizedString(localizationKey, comment: ""), count)
|
|
|
|
setAttributedTitle(localizedTitle.countEmphasizedAttributedString(count: count), for: .normal)
|
|
setAttributedTitle(
|
|
localizedTitle.countEmphasizedAttributedString(count: count, highlighted: true),
|
|
for: .highlighted)
|
|
}
|
|
}
|