mirror of
https://github.com/metabolist/metatext.git
synced 2024-11-25 01:31:02 +00:00
Refactoring
This commit is contained in:
parent
550a1acb8b
commit
339159abd1
3 changed files with 17 additions and 5 deletions
|
@ -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 ?? ","
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue