'contains()'不可用:在序列上调用'contains()'方法

时间:2016-04-21 05:04:59

标签: swift2.2

如何“在序列上调用'contains()'方法?”

 func deleteSelfieObjectFromList(selfieImgObject: SelfieImage) {
    if contains(self.dataArray, selfieImgObject) {
       removeObject(&self.dataArray, object: selfieImgObject)
       self.collectionView?.reloadData()
    }
  }

1 个答案:

答案 0 :(得分:0)

像这样:

let arr = [42]
if arr.contains(42) {
    print("found")
}