I have multiple selections in UITableview made in Swift, and I declare an array containing NSIndexPaths selected UITableview Cells.
self.selectedRows = self.preferencesTableView.indexPathsForSelectedRows()
How to convert this array to readable terms. For example, self.selectedRows NSlogged:
Selected items Strings [{length = 2, path = 0 - 1}, {length = 2, path = 0 - 0}, {length = 2, path = 0 - 3}]
I would like to convert this to: 1,2,3.
In Objective-C, I enumerate ObjectsWithOptions through an array and add the id of the array to the mutable array to get what I want.
[self.selectedRows enumerateObjectsWithOptions:NSEnumerationReverse usingBlock:^(id obj, NSUInteger idx, BOOL *stop) { NSIndexPath *indexPath = obj; [self.selectedCategorieItems addObject:[[[self.categoryArr objectAtIndex:0] objectForKey:@"id"]objectAtIndex:indexPath.row]]; }];
How to do it in Swift?
source share