Код: Выделить всё
struct ContentView: View {
@FocusState private var focusedElement: FocusableElement?
enum FocusableElement: Hashable {
case button
}
var body: some View {
VStack{
VStack {
Button("Move focus to Button2") {
focusedElement = .button
}
Button("Button2") {}
.focused($focusedElement, equals: .button)
}
}
}
}
Подробнее здесь: https://stackoverflow.com/questions/794 ... ss-enabled
Мобильная версия