Repository navigation
Releases
Releases · infinum/ios-accessibility-kit
1.1.0
AccessibilityKit 1.1.0 lets you correct accessibility values before they're reported, makes AccessibilityType enumerable, and fixes several observation bugs. It also adds a test suite and documents the whole public API in DocC.
📝 Upgrade notes
- CocoaPods is no longer supported. Install the package with Swift Package Manager.
- Snapshot states are now always sorted. The docs always said they were, but snapshots from
currentAccessibilitySnapshot(for:)and from observation came back in configuration order. Sorting also changes the order of thevaluesarray in the encoded JSON. If you read states by position, look them up byidentifierortypeinstead. (#8) - The font scale feature's
nameis now"Font Scale"(it was"Font scale"). Itsidentifieris unchanged, so encoded payloads stay the same. (#11) - Requirements: iOS 14, Xcode 15. The README used to say Xcode 12, but the package needed Swift 5.9 even at 1.0.0. (#20)
✨ New
- Correct values at the source.
AccessibilityTrackingObjecttakes an optionaltransformthat corrects the value where it's produced, so the encoded output carries the corrected value too. Put the object in your tracking configuration and the correction also reaches observed changes and the monitor (#9, closes #5):AccessibilityTrackingObject( type: .fontScale, customIdentifier: "large_text_enabled", transform: { value in .flag((value.scaleValue ?? 1) >= 1.2) } )
AccessibilityState.withValue(_:)returns a copy with a different value, andAccessibilitySnapshot.init(states:)is now public, so you can correct a snapshot after the fact. (#9)AccessibilityTypeconforms toCaseIterable, so you can track every feature withAccessibilityType.allCases. If you declared this conformance yourself, remove it to avoid a duplicate-conformance warning. (#12)AccessibilityValueisSendable. (#9)
🐛 Fixes
- Reconfiguring tracking no longer silently stops an existing observation. (#11)
- After reconfiguring, a snapshot taken under the old configuration is no longer delivered. (#11)
- An observer added twice is now notified once per change. (#11)
- Snapshots are no longer kept in memory for the life of the process. (#11)
- The monitor no longer retains its observers in a cycle. (#10)
AccessibilityMonitorViewkeeps one view model while it's shown. Embedded in SwiftUI (for example in a.sheet), it used to re-register its observation and flash an empty list on every parent re-render. (#21)- The example app now resolves the package from its own repository, whatever the clone's folder is called. (#9)
📚 Docs and tests
- Every public symbol has DocC documentation. The README now matches the library, including the real JSON output. (#13)
- The package has its first tests: 50 in 9 suites, covering the public API and the observation internals. (#8, #10, #11, #12)
Known limitation
Presenting the accessibility monitor replaces the app's own observeAccessibilityTracking completion while it's open. The README and DocC describe this. A fix depends on the Swift 6 work and is planned for the next major release.
What's Changed
- Sort accessibility states produced from tracking objects by @nikolamajcen in #8
- Removal of CocoaPods support and accessibility state improvement by @nikolamajcen in #17
- Allow consumers to correct accessibility values by @nikolamajcen in #9
- Add tests for the public API and internal mechanisms by @nikolamajcen in #10
- Fix defects found while building the test suite by @nikolamajcen in #11
- Make the accessibility type enumerable by @nikolamajcen in #12
- Document the public API in DocC format by @nikolamajcen in #13
- Correct the Xcode requirement in the README by @nikolamajcen in #20
- Keep one view model for the monitor's lifetime by @nikolamajcen in #21
Full Changelog: 1.0.0...1.1.0
1.0.0
The initial release of the AccessibilityKit.