It\'s kind pretty straight forward to find an element in an array with type String, Int, etc.
var States = [\"CA\", \"FL\", \"MI\"]
var filteredStates = Stat
With the following code you receive all candy structs in the array, which match to "Chocolate"
.
var candiesFiltered = candies.filter{$0.name == "Chocolate"}
If you just want a boolean if it has been found or not you could use the following code:
var found = candies.filter{$0.name == "Chocolate"}.count > 0