Skip to content

Commit 46b7627

Browse files
committed
Check UISwitch state using combination of trait and value
1 parent 0f195fb commit 46b7627

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Sources/AccessibilitySnapshot/Core/Swift/Classes/UIAccessibility+SnapshotAdditions.swift

+3-2
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,10 @@ extension NSObject {
108108

109109
if accessibilityTraits.contains(.switchButton) {
110110
if let `self` = self as? UISwitch {
111-
if self.isOn {
111+
// TODO: Do these need to be localized by script? What about other integers? What about non-integer accessibility values?
112+
if accessibilityValue == "1" {
112113
traitSpecifiers.append(strings.switchButtonOnTraitName)
113-
} else {
114+
} else if accessibilityValue == "0" {
114115
traitSpecifiers.append(strings.switchButtonOffTraitName)
115116
}
116117

0 commit comments

Comments
 (0)