Array element checking in swift

后端 未结 3 738
迷失自我
迷失自我 2021-01-15 18:38

Currently implementing a favourite function to my application which is based on quotes. I would like to perform a check for if the user has already saved an element to an ar

3条回答
  •  甜味超标
    2021-01-15 19:21

    Try this:

    let currentQuote = dreamFact.dreamArray[factIndex]
    if find(favouriteQuotesArray!, currentQuote) != nil {
        //Do something
    }
    

提交回复
热议问题