Here is the implementation of the broken @AppStorage.
import SwiftUI
struct ContentView: View {
var body: some View {
Spacer()
ForEach(values, id: \.self.id) { tuple in
Picker("", selection: tuple.value) {
ForEach(1..<15, id: \.self) {
Text("Select \($0)")
}
}
Spacer()
}
Spacer()
}
private var values: [(id: String, value: Binding<Int>)] {
return [("first", $first), ("second", $second), ("third", $third)]
}
@AppStorage("first") private var first = 8
@AppStorage("second") private var second = 18
@AppStorage("third") private var third = 2
}
What is wrong with the code?