Show issue state icons in lists
This commit is contained in:
@@ -255,3 +255,28 @@ func symbolText(_ symbol: String, text: String, font: UIFont, color: UIColor) ->
|
||||
]))
|
||||
return output
|
||||
}
|
||||
|
||||
func configureIssueStateIcon(
|
||||
_ icon: UIImageView,
|
||||
state: String,
|
||||
textStyle: UIFont.TextStyle
|
||||
) {
|
||||
let symbol: String
|
||||
let color: UIColor
|
||||
let accessibilityLabel: String
|
||||
switch state {
|
||||
case "open":
|
||||
(symbol, color, accessibilityLabel) = ("exclamationmark.circle.fill", .systemGreen, "Open issue")
|
||||
case "closed":
|
||||
(symbol, color, accessibilityLabel) = ("checkmark.circle.fill", .systemPurple, "Closed issue")
|
||||
default:
|
||||
(symbol, color, accessibilityLabel) = ("questionmark.circle.fill", .systemGray, "Unknown issue state")
|
||||
}
|
||||
icon.image = UIImage(systemName: symbol)
|
||||
icon.tintColor = color
|
||||
icon.preferredSymbolConfiguration = UIImage.SymbolConfiguration(textStyle: textStyle)
|
||||
icon.setContentHuggingPriority(.required, for: .horizontal)
|
||||
icon.setContentCompressionResistancePriority(.required, for: .horizontal)
|
||||
icon.isAccessibilityElement = true
|
||||
icon.accessibilityLabel = accessibilityLabel
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user