I'm trying to filter an array containing Recipes that have a property called title of type String that is required.
These are the variables used in the line of code:
@State private var searchingFor = ""
@State private var filteredRecipes = [Recipe]()
This is the line of code giving me the error:
filteredRecipes=filteredRecipes.filter{$0.title.contains(searchingFor)}
The error: "Value of optional type 'String?' must be unwrapped to refer to member 'contains' of wrapped base type 'String'"
Any ideas on how I need to rewrite that line of code so that I don't get that error? ie. how do I unwrap 'String?'