Using CoreData I don't know how to solve that problem:
Error: Cannot convert value of type 'NSSet?' to expected argument type 'Range<Int>'
private func displayTopics(subject: Subject) -> some View {
NavigationView {
Form {
List {
ForEach(subject.topics) { topic in
NavigationLink(
destination: Text("Destination"),
label: {
Text("Navigate")
})
}
}
}
}
What should I do?
ForEach does not understand NSSet
, you have to convert it in array:
if subject.topics != nil {
ForEach(Array(subject.topics! as Set), id: \.self) { topic in
NavigationLink(
destination: Text("Destination"),
label: {
Text("Navigate")
})
}
}
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