So I'm trying to create a Picker in SwiftUI that uses every item of an array. Xcode says "Anonymous closure arguments cannot be used inside a closure that has explicit arguments" when I try to let it use the item of the array (as visible in the code)
import SwiftUIstruct TimerPicker: View { @State var selectedTime = 0 let availableMinutes = Array(1 ... 59) private let pickerStyle = SegmentedPickerStyle() var body: some View { VStack { Picker(selection: $selectedTime, label: Text("")) { ForEach(0 ..< availableMinutes.count) {_ in Text("\(self.availableMinutes[$0]) min") } } .labelsHidden() } }
Thanks in advance for every answer.