Simple question, but after literally hours of searching and a few hundred hairs lost, I can't find the way to get the index for an element in an NSMutableArray in Swift.
If someone knows how to do it or a workaround, please, help me out.
I tried
var pagerViewControllers = [UIViewController]
...
let viewControllerIndex = pagerViewControllers.indexOfObject(viewController)
[EDIT]
Just to avoid confusion and for those downvoting the question, NSArray used to have the indexOf method. That method was replaced by indexOfObject in NSArray but you can still use indexOf [and it is workign like that now] for NSMUtableArray. Actually the line shown above will throw an error, even though parent class NSArray does have indexOfObject.
This whole thing makes it very confusing if it is the first time that you're working with arrays in Swift, which it is the case. In the answers and comments to this question, you'll see this confusion reflected all over, so I think the question is valuable for clarification to others, and the right answer was selected.
[EDIT]
let indexof = yourarray.indexOf("a")indexOfObjectis a valid method.