What's the difference between "isEditing", "focus", and "accessibility focus" in SwiftUI in iOS 15 SDK?

What's the difference between "isEditing", "focus", and "accessibility focus" in SwiftUI in iOS 15 SDK?

In iOS 13/14 SDKs, using a hardware keyboard, you can focus a different field than the one you're currently editing. One of the main difficulties in SwiftUI that we've had for iPad has been how to manage these kinds of situations, since for example, with SecureField, there's no hook for when it starts editing or when it becomes focused. So we had no way to customize the focused appearance of SecureField or even, programmatically set focus to password field if it had an error, scroll the view to make sure whichever field is now focused in visible, etc.

We found that "isEditing" and "isFocused" are two completely different things in iOS, and there's a third thing—"accessibility focus" which also needs to be kept track of. "Keyboard focus" is when you have a physical keyboard and you use tab to select a different field—this allows you to focus a different field than the one that's currently being edited!

But in the new SwiftUI "focus" system, it sounded like "isEditing" and "focused" are now being treated as the same thing? Is that correct? Can you no longer focus a different field than the one that's being edited with a keyboard? Is accessibility focus still a different thing??

Please clarify thanks!

What's the difference between "isEditing", "focus", and "accessibility focus" in SwiftUI in iOS 15 SDK?
 
 
Q