I have a AVPlayer class that I'm using in a detail view that takes a indexPath of type Int.
I am getting the indexPath from the table view tableViewDidSelectAtIndexPath before sending it to the detail VC to use.
I tried to just simply downcast the NSIndexPath as! NSInteger before sending it to detail VC to use but it crashes without a crash message. So Im a bit stuck as to how to go about this.
Is it possible to downcast this? How can I get the number out of the NSIndexPath into an Int so I can use it in my class?
NSIndexPathis always* a combination of section and either row (forUITableView) or item (forUICollectionView).you need to dissolve the section by accessing the single index:
* EDIT
Respective the comments: you are right. Multiple indexes are possible with
NSIndexPath.If you know you have multiple indexes (what I wouldn't expect in
UITableViewDelegate) you can iterate the indexes:EDIT
PLEASE read documentation and headers before you ask the next time. Little hint: cmd-click
NSIndexPathwill take you to its header file with all possible informations.