From 3c877416d68d2f764e9c0739fe98b0cb1cc9033f Mon Sep 17 00:00:00 2001 From: Marcus Kida Date: Fri, 21 Apr 2023 14:35:17 +0200 Subject: [PATCH] Improve formatter followers count (IOS-140) --- .../MastodonUI/View/Content/UserView+ViewModel.swift | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/MastodonSDK/Sources/MastodonUI/View/Content/UserView+ViewModel.swift b/MastodonSDK/Sources/MastodonUI/View/Content/UserView+ViewModel.swift index c70ca4588..f61e7a2e6 100644 --- a/MastodonSDK/Sources/MastodonUI/View/Content/UserView+ViewModel.swift +++ b/MastodonSDK/Sources/MastodonUI/View/Content/UserView+ViewModel.swift @@ -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)