Improve formatter followers count (IOS-140)

This commit is contained in:
Marcus Kida 2023-04-21 14:35:17 +02:00
parent 645542c581
commit 3c877416d6
No known key found for this signature in database
GPG Key ID: 19FF64E08013CA40
1 changed files with 5 additions and 1 deletions

View File

@ -30,6 +30,10 @@ extension UserView {
}
extension UserView.ViewModel {
private static var metricFormatter: MastodonMetricFormatter = {
return MastodonMetricFormatter()
}()
func bind(userView: UserView) {
// avatar
Publishers.CombineLatest(
@ -87,7 +91,7 @@ extension UserView.ViewModel {
}
userView.authorFollowersLabel.attributedText = NSAttributedString(
format: NSAttributedString(string: "%@ followers", attributes: [.font: Font.systemFont(ofSize: 15, weight: .regular)]),
args: NSAttributedString(string: count.formatted(), attributes: [.font: Font.systemFont(ofSize: 15, weight: .bold)])
args: NSAttributedString(string: Self.metricFormatter.string(from: count) ?? count.formatted(), attributes: [.font: Font.systemFont(ofSize: 15, weight: .bold)])
)
}
.store(in: &disposeBag)