[ad_1]
Apple launched the @FocusState and @AccessibilityFocusState and their respective APIs for iOS 15. Usually when I’ve an app that helps a number of variations and I would like to make use of a brand new API, I might wrap the code with if #accessible (iOS x) {} or use @accessible.
For managing focus state, I have to declare a var with the @AccessibilityFocusState property wrapper, and actually together with the next code in a SwiftUI View will trigger it to crash at runtime on an iOS 14 gadget, though the compiler has no complaints:
@accessible(iOS 15.0, tvOS 15.0, *)
@AccessibilityFocusState var focus: FocusLocation?
On tvOS, I can use the compiler directive #if os(tvOS) … #endif to this compile conditionally, however this is not an choice for iOS variations that are dealt with at runtime.
To be clear, I do know that I can’t use this API for iOS 14 gadgets, however dropping assist for iOS 14 is one other challenge solely
Is there anyway to make use of this iOS 15+ API for iOS 15+ VoiceOver customers, and nonetheless enable basic iOS 14 customers to run the remainder of the app?
[ad_2]
