Skip to content

Instantly share code, notes, and snippets.

@kristofk
Created October 15, 2025 11:33
Show Gist options
  • Select an option

  • Save kristofk/1c514593d2ea5a63a14e960c99d32d4a to your computer and use it in GitHub Desktop.

Select an option

Save kristofk/1c514593d2ea5a63a14e960c99d32d4a to your computer and use it in GitHub Desktop.
Overwrite UIAccessibility properties for easier control and debugging
var _accessibilityLabel: String? = ""
override var accessibilityLabel: String? {
get {
_accessibilityLabel
}
set {
print("[x] accessibilityValue: [\(_accessibilityLabel ?? "nil")] => [\(newValue ?? "nil")]")
_accessibilityLabel = newValue
}
}
var _accessibilityValue: String? = ""
override var accessibilityValue: String? {
get {
_accessibilityValue
}
set {
print("[x] accessibilityValue: [\(_accessibilityValue ?? "nil")] => [\(newValue ?? "nil")]")
_accessibilityValue = newValue
}
}
var _accessibilityHint: String? = ""
override var accessibilityHint: String? {
get {
_accessibilityHint
}
set {
print("[x] accessibilityHint: [\(_accessibilityHint ?? "nil")] => [\(newValue ?? "nil")]")
_accessibilityHint = newValue
}
}
var _isAccessibilityElement: Bool = true
override var isAccessibilityElement: Bool {
get {
_isAccessibilityElement
}
set {
print("[x] isAccessibilityElement: [\(_isAccessibilityElement)] => [\(newValue)]")
_isAccessibilityElement = newValue
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment