I'm using Xcode 11 beta 5 and what I had it doesn't work anymore. This is my code:
struct ModeView : View {
@EnvironmentObject var state: IntentionState
var body: some View {
Picker(selection: $state.selection, label: Text("")) {
ForEach(state.modes.identified(by: \.self)) { mode in
Text(mode)
}
}.pickerStyle(SegmentedPickerStyle())
}
}
The error is in the line ForEach(uistate.modes.identified(by: \.self)) { mode in and it says:
Value of type '[String]' has no member 'identified'
When I was using Xcode 11 beta 4 it worked perfectly. The question now is how to use ForEach with an array string in Xcode beta 5
ForEach syntax changed a little bit in Beta 5.
Have you tried:
ForEach(state.modes, id: \.self) { mode in
Text(mode)
}
As per the apple release note, it's known issue from their end. We have to wait for another release.
https://developer.apple.com/documentation/ios_ipados_release_notes/ios_ipados_13_beta_5_release_notes

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With