I need to convert a nsindexpath var into NsInteger or simply an int. e.g:
int rowIndex = [mGoogleBaseTable selectedRow];
//mGoogleBaseTable is a NSTable type
If
NSIndexPath *p = ... // some indexpath
then
NSInteger row = p.row;
NSInteger section = p.section;
That's all!
In swift :
Associate your collection view to your var :
@IBOutlet weak var collectionView: UICollectionView!
In prepareForSegue
func, you can call :
var indexPath = collectionView.indexPathsForSelectedItems()
Maybe, this is can help you
NSInteger variable = indexPath.row;
In Swift:
let section: Int = indexPath.section
let row: Int = indexPath.row
I prefer doing it this way
NSNumber *selRow = [[NSNumber alloc] initWithInteger:indexPath.row];
Simply convert into int by,
NSIndexPath *path = ... // some indexpath
int row = (int)path.row;