Pointer
Pointer
TSDThe Swift Den
Created by Pointer on 9/27/2023 in #swift-development
Picker not changing
hey y'all, how come this super simple code is not working for me? If I select a different unit in the Picker, it doesn't change its label
import SwiftUI

struct ContentView: View {

let unitList = ["Centimeters", "Meters", "Kilometers", "Inches", "Feet", "Yards", "Miles"]
@State private var unitDestination = "Meters"

var body: some View {
NavigationView {
Form {
Section {
Picker("Destinated Unit", selection: $unitDestination) {
ForEach(0..<unitList.count, id: \.self) { value in
Text(unitList[value])
}
}
}
}
}
}
}
import SwiftUI

struct ContentView: View {

let unitList = ["Centimeters", "Meters", "Kilometers", "Inches", "Feet", "Yards", "Miles"]
@State private var unitDestination = "Meters"

var body: some View {
NavigationView {
Form {
Section {
Picker("Destinated Unit", selection: $unitDestination) {
ForEach(0..<unitList.count, id: \.self) { value in
Text(unitList[value])
}
}
}
}
}
}
}
3 replies
TSDThe Swift Den
Created by Pointer on 9/16/2023 in #swift-development
Error on one struct but not on the other
No description
6 replies
TSDThe Swift Den
Created by Pointer on 9/13/2023 in #swift-development
For??
No description
1 replies
TSDThe Swift Den
Created by Pointer on 9/7/2023 in #swift-development
Can't run Xcode at all
No description
1 replies
TSDThe Swift Den
Created by Pointer on 6/27/2023 in #swift-development
init(coordinateRegion... was deprecated in iOS 17.0: Use Map initializers
No description
3 replies