I have a little problem,
I have a Swift app with a picker:
/// DATA.swift
import SwiftUI
class FormPage: ObservableObject {
@State var country = ["USA", "Japan", "Germany"]
@State var index = 0
}
/// FORM.swift
import SwiftUI
struct ContentView: View {
@StateObject var choiceForm = FormForFormulaire()
var body: some View {
Form {
Section {
Picker(selection: $choiceForm.index, label: Text("Pays de destination")) {
ForEach(0 ..< choice.country.count) {
Text(choiceForm.country[$0]).tag($0)
}
}
}
}
The picker view is working but it doesn't update: I click Japan, and the view doesn't change.
Sorry for my English, I hope someone understood me!!
Thanks