As soon as you set the
editing property of a
UITableView to be true, its cells stop being tappable. This is often a good idea, because if a user explicitly enabled editing mode they probably want to delete or move stuff, and it's only going to be annoying if they can select rows by accident.
Of course, as always, there are times when you specifically want both actions to be available - for the user to be able to move or delete a cell, and also tap on it to select. If that's the situation you find yourself in right now, here's the line of code you need:
tableView.allowsSelectionDuringEditing = true
Sponsored You’re already busy updating your app for Swift 4.2 and iOS 12, so why not let Instabug help you find and fix bugs? Add just two lines of code to your project and receive comprehensive reports with all the feedback you need to ship a world-class app – click here to learn more!
Available from iOS 3.0
Did this solution work for you? Please pass it on!
Other people are reading…
About the Swift Knowledge Base
This is part of the Swift Knowledge Base, a free, searchable collection of solutions for common iOS questions.
Download for free!
Want a free 75-minute video teaching functional programming, protocol-oriented programming, and more? This is your lucky day!