for reference the multiselector is from this repository https://github.com/Jeehut/MultiSelectorDemo
What gives you that error?
so basically I created a button that does the task:
if title != "" {
realmManager.addTask(courseTitle: title)
}
(this is from the actual app where I use a normal picker that has a binding to title when it is clicked the title variable changes and a task is added using that title)
so from these variables:
@State var task = Task3(name: "", servingGoals: [allGoals[1]])
@State var isNavigationBarHidden: Bool = true
and the usage of multiselector from the repository here:
MultiSelector(
label: Text("Serving Goals"),
options: allGoals,
optionToString: { $0.name },
selected: $task.servingGoals
)
I tried to use the selected binding in the if statement rather than the title
so it will be like this:
// i get the error here
if task.servingGoals != "" {
realmManager.addTask(courseTitle: task.servingGoals)
}
What are you trying to do when you get the error?
I tried to use the selected binding in the "if statement" rather than the title
Is this using the standard SwiftUI Picker or one of the multiple selection pickers you say you've tried but don't work with Realm?
It is the multiple selection picker I provided apologies for not including it earlier
So given those data structures, you should be able to write code to convert between a Goal and a String. And then you can just add Goals to the Set.
How do i do that?
I am sorry if I did not make anything clear if you do not understand something feel free to ask me I will explain what I meant.