TextField with @FocusState SwiftUI

Опубликовано: 23 Октябрь 2021
на канале: iOS Shiga
392
6

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. When focus enters the modified view, the wrapped value of this property updates to match a given prototype value. Similarly, when focus leaves, the wrapped value of this property resets to nil or false. Setting the property’s value programmatically has the reverse effect, causing focus to move to the view associated with the updated value.