learnig kid learnig kid - 8 months ago 19
Swift Question

ios Swift:How to compare object that existing in mutable array

Actually i'm new person for swift, this is my first project with swift.i have a problem faced that i cant compare the values with contains(),this is my code -- var str = "Dear"

if addstatus.contains(str) {
} else {

For this code it suggest a error ,pls find the screenshot

enter image description here

Anyone can help me,thanks in advance :|


You can use containsObject method for checking object exist in NSMutableArray

var myArray: NSMutableArray = ["one", "two", "three"]

  if myArray.containsObject("one") {
  } else {
    print("NO ")