I have a class I use to encapsulate data handling - similar to NSFetchedResultsController, but custom to the needs of the app. I'm converting this class to Swift (dual attempts are for illustration, not actual implementation).
@objc class DataHandler: NSObject {
final func deleteEntryAt(indexPath: NSIndexPath) {
let entry = entries[indexPath.row]
let iRow = indexPath.row
if let row = indexPath.row {
}
}
}
And the Objective-C version, which functions as expected:
- (void)deleteEntryAtIndexPath:(NSIndexPath*)indexPath {
Entry *entry = self.entries[indexPath.row];
}
Looking at the NSIndexPath header and documentation, for both Swift and Objective-C reveals no property or function named 'row'; so, I'm at a loss.
Note: I have tried both optional and non-optional variations.
The passed NSIndexPath in the sample code is non-optional, which is why I believe this issue is different than the following:
- NSIndexPath? does not have a member name 'row' error in Swift
- NSIndexPath does not have a member named row in swift
Nor does the method have any outside knowledge at this point for the issue to be similar to this:
At least I don't think so. If this is a duplicate of those, such is life and I do apologize.
Update:
Clean & build - no change.
You need to import
UIKit
.section
,row
anditem
are properties ofNSIndexPath
added by UIKit.https://developer.apple.com/library/prerelease/ios//documentation/UIKit/Reference/NSIndexPath_UIKitAdditions/index.html