How can I optimise code using Swift functions like the filter? What I want to do is I need to find a particular key if present no matter what value of that key is in the below array?
Below method works fine for me but I think there is some better way to do it.
let arrDic = [["Key1": "yes"], ["Key2": "no"], ["Key3": "yes"], ["Key4": "Option1, Option2"], ["Key5": "OC1_OPTIONB"], ["Key6": "H1_OPTIONA"]]
for dict in arrDic {
if dict["Key1"] != nil {
print(true)
break
}
}