/Users/hcri50/Documents/SwiftUI/DeleteUser/DeleteUser/ContentView.swift:17:35: ‘identified(by:)’ is deprecated: Use ForEach() or List().
I have tried
ForEach(users:id(by: .self))
ForEach(users.(by: .self))
And nothing is working.
Can someone please point me in the right direction please
My code below
struct ContentView : View {
@State var users = [“Paul”, “Taylor”, “Adele”]
var body: some View {
NavigationView {
List {
ForEach(users.identified(by: \.self)) { user in
Text(user)
}
.onDelete(perform: delete)
}
}
}
func delete(at offsets: IndexSet) {
if let first = offsets.first {
users.remove(at: first)
}
}
}