Skip to content

Instantly share code, notes, and snippets.

@cybertk
Created August 20, 2015 08:34
Show Gist options
  • Select an option

  • Save cybertk/2befc00818c1ea6227fc to your computer and use it in GitHub Desktop.

Select an option

Save cybertk/2befc00818c1ea6227fc to your computer and use it in GitHub Desktop.

Revisions

  1. cybertk created this gist Aug 20, 2015.
    21 changes: 21 additions & 0 deletions UITableView+ClearSelections.swift
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@
    //
    // UITableView+ClearSelections.swift
    // Cybertk
    //
    // Created by Quanlong He on 8/20/15.
    // Copyright © 2015 Quanlong He. All rights reserved.
    //

    import Foundation

    extension UITableView {

    // Clear all selections
    func clearSelections(animated: Bool) {
    if let indexPaths = self.indexPathsForSelectedRows {
    for indexPath in indexPaths {
    self.deselectRowAtIndexPath(indexPath, animated: animated)
    }
    }
    }
    }