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
  • 43,529
  • 77
  • 242
  • 443

1 Answers1

2

Try like this

contains(ignores, username)
Leo Dabus
  • 216,610
  • 56
  • 458
  • 536