Semantically, to consider indexPath invalid, you need to check something, such as a table view or a collection view.
indexPath , , . ( " ".)
IndexPath, :
let invalidIndexPath = IndexPath(row: NSNotFound, section: NSNotFound)
:
self.tableView.indexPathForSelectedRow , nil, .
if let path = tableView.indexPathForSelectedRow {
}
else {
}
path NSNotFound .