Issue #515
Use enumerated
and id: \.element.name
struct CountriesView: View {
let countries: [Country]
var body: some View {
let withIndex = countries.enumerated().map({ $0 })
return List(withIndex, id: \.element.name) { index, country in
NavigationLink(
destination: CountryView(country: country),
label: {
VStack(alignment: .leading) {
Text(country.name)
.styleMultiline()
}
.paddingVertically()
}
)
}
}
}