Prev Source
Next Source

FocusState | Apple Developer Documentation

original source

A property wrapper type that can read and write a value that SwiftUI updates as the placement of focus within the scene changes.

Use this property wrapper in conjunction with focused(:equals:) and focused(:) to describe views whose appearance and contents relate to the location of focus in the scene.

In the following example of a simple login screen, when the user presses the Sign In button and one of the fields is still empty, focus moves to that field. Otherwise, the sign-in process proceeds.


Date
August 6, 2022