0

Can I use the contains method on an Array or do I have to instead use the filter method and loop through with a check?

Given ignores is an Array<String>

e.g.

    return self.ignores.filter({ (user) -> Bool in
        user == username
    }).count > 0

or

    return self.ignores.contains(username);
MonkeyBonkey
  • 46,433
  • 78
  • 254
  • 460

1 Answers1

2

Try like this

contains(ignores, username)
Leo Dabus
  • 229,809
  • 59
  • 489
  • 571