diff --git a/Extensions/String+Extensions.swift b/Extensions/String+Extensions.swift index c9d3f14..343bb3f 100644 --- a/Extensions/String+Extensions.swift +++ b/Extensions/String+Extensions.swift @@ -52,4 +52,18 @@ extension String { return mutableString } + + func appendingWithSeparator(_ string: Self) -> Self { + appending(Self.separator).appending(string) + } + + mutating func appendWithSeparator(_ string: Self) { + append(Self.separator.appending(string)) + } +} + +private extension String { + static var separator: Self { + Locale.autoupdatingCurrent.groupingSeparator ?? "," + } } diff --git a/Views/UIKit/Content Views/InstanceView.swift b/Views/UIKit/Content Views/InstanceView.swift index 29c7ed3..42904ca 100644 --- a/Views/UIKit/Content Views/InstanceView.swift +++ b/Views/UIKit/Content Views/InstanceView.swift @@ -83,7 +83,7 @@ private extension InstanceView { titleLabel.text = viewModel.instance.title uriLabel.text = viewModel.instance.uri - accessibilityLabel = viewModel.instance.title.appending("\n").appending(viewModel.instance.uri) + accessibilityLabel = viewModel.instance.title.appendingWithSeparator(viewModel.instance.uri) } func setupAccessibility() { diff --git a/Views/UIKit/Content Views/TagView.swift b/Views/UIKit/Content Views/TagView.swift index e523bca..06638f6 100644 --- a/Views/UIKit/Content Views/TagView.swift +++ b/Views/UIKit/Content Views/TagView.swift @@ -99,8 +99,7 @@ private extension TagView { NSLocalizedString("tag.people-talking", comment: ""), accounts) accountsLabel.text = accountsText - accessibilityLabel.append("\n") - accessibilityLabel.append(accountsText) + accessibilityLabel.appendWithSeparator(accountsText) accountsLabel.isHidden = false } else { accountsLabel.isHidden = true @@ -112,8 +111,7 @@ private extension TagView { let accessibilityRecentUses = String.localizedStringWithFormat( NSLocalizedString("tag.accessibility-recent-uses-%ld", comment: ""), uses) - accessibilityLabel.append("\n") - accessibilityLabel.append(accessibilityRecentUses) + accessibilityLabel.appendWithSeparator(accessibilityRecentUses) } else { usesLabel.isHidden = true }