containsは、配列と比較対象を引数にする以外にも、配列と関数を引数に持たせることも出来ます。
let selectedMemberList:[String] = ["a","b","c"] var flag = "false" if contains(selectedMemberList, { (element) -> Bool in return element=="b"}){ flag = "true" } print(flag)
関数を使わない場合
let selectedMemberList:[String] = ["a","b","c"] flag = "false" if contains(selectedMemberList, "b"){ flag = "true" } print(flag)