mirror of
https://github.com/metabolist/metatext.git
synced 2024-11-25 09:41:00 +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
|
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
|
titleLabel.text = viewModel.instance.title
|
||||||
uriLabel.text = viewModel.instance.uri
|
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() {
|
func setupAccessibility() {
|
||||||
|
|
|
@ -99,8 +99,7 @@ private extension TagView {
|
||||||
NSLocalizedString("tag.people-talking", comment: ""),
|
NSLocalizedString("tag.people-talking", comment: ""),
|
||||||
accounts)
|
accounts)
|
||||||
accountsLabel.text = accountsText
|
accountsLabel.text = accountsText
|
||||||
accessibilityLabel.append("\n")
|
accessibilityLabel.appendWithSeparator(accountsText)
|
||||||
accessibilityLabel.append(accountsText)
|
|
||||||
accountsLabel.isHidden = false
|
accountsLabel.isHidden = false
|
||||||
} else {
|
} else {
|
||||||
accountsLabel.isHidden = true
|
accountsLabel.isHidden = true
|
||||||
|
@ -112,8 +111,7 @@ private extension TagView {
|
||||||
let accessibilityRecentUses = String.localizedStringWithFormat(
|
let accessibilityRecentUses = String.localizedStringWithFormat(
|
||||||
NSLocalizedString("tag.accessibility-recent-uses-%ld", comment: ""),
|
NSLocalizedString("tag.accessibility-recent-uses-%ld", comment: ""),
|
||||||
uses)
|
uses)
|
||||||
accessibilityLabel.append("\n")
|
accessibilityLabel.appendWithSeparator(accessibilityRecentUses)
|
||||||
accessibilityLabel.append(accessibilityRecentUses)
|
|
||||||
} else {
|
} else {
|
||||||
usesLabel.isHidden = true
|
usesLabel.isHidden = true
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue