Created
October 5, 2017 12:33
-
-
Save koromiko/7cd42d963f3d02bf88faac630a67705b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func tableView(_ tableView: UITableView, willSelectRowAt indexPath: IndexPath) -> IndexPath? { | |
let photo = self.photos[indexPath.row] | |
if photo.for_sale { // If item is for sale | |
self.selectedIndexPath = indexPath | |
return indexPath | |
}else { // If item is not for sale | |
let alert = UIAlertController(title: "Not for sale", message: "This item is not for sale", preferredStyle: .alert) | |
alert.addAction( UIAlertAction(title: "Ok", style: .cancel, handler: nil)) | |
self.present(alert, animated: true, completion: nil) | |
return nil | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment