UITableView Extension to Deselect Selected Row

Other

Nothing fancy. Just a tiny little extension method that makes doing this in Swift slightly nicer.

import UIKit

public extension UITableView {

    public func deselectSelectedRowAnimated(animated: Bool) {
        if let indexPath = indexPathForSelectedRow() {
            deselectRowAtIndexPath(indexPath, animated: animated)
        }
    }

}

The Author

iOS and Mac developer.