After Swift 3 conversion, I can't get rid of error: “Ambiguous use of 'indexOfObject(passingTest:)'”
问题 I'm using NSArray 's indexesOfObjects(passingTest:), but after I converted my code to Swift 3 I get the error: "Ambiguous use of 'indexOfObject(passingTest:)'". My code below worked fine with Swift 2.3. let indexesOfBubbleConstraints = bubbleConstraints.indexesOfObjects(passingTest: { (constraint, idx, stop) in if let view = constraint.firstItem as? UIView{ return view.tag == usernameTag } else{ return false } }) For Swift 3, I also had to cast constraint to AnyObject , but that doesn't fix