1
0
mirror of https://github.com/metabolist/metatext synced 2024-12-27 02:02:38 +01:00
metatext-app-ios-iphone-ipad/Extensions/UIButton+Extensions.swift
2020-12-02 17:06:46 -08:00

15 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)
}
}