//
//  UITableView+RevealingExtensions.swift
//  RevealingTableViewCell
//
//  Created by sovata on 08/04/2017.
//  Copyright © 2017 Nikolay Suvandzhiev. All rights reserved.
//

import Foundation
import UIKit


public extension UITableView
{
    /// If you leave `exceptThisOne` as `nil`, then all cells will be closed.
    /// Otherwise all cells except of the cell specified will be closed
    public func closeAllCells(exceptThisOne cellThatShouldNotBeClosed: RevealingTableViewCell? = nil)
    {
        for visibleCell in self.visibleCells
        {
            if let revealingTableViewCell = visibleCell as? RevealingTableViewCell
            {
                if let cellThatShouldNotBeClosed = cellThatShouldNotBeClosed
                {
                    if visibleCell != cellThatShouldNotBeClosed
                    {
                        revealingTableViewCell.setRevealingState(.closed, animated: true)
                    }
                }
                else
                {
                    revealingTableViewCell.setRevealingState(.closed, animated: true)
                }
            }
        }
    }
}

//
//  UITableView+RevealingExtensions.swift
//  RevealingTableViewCell
//
//  Created by sovata on 08/04/2017.
//  Copyright © 2017 Nikolay Suvandzhiev. All rights reserved.
//

import Foundation
import UIKit


public extension UITableView
{
    public func closeAllCells(exceptThisOne: RevealingTableViewCell? = nil)
    {
        for visibleCell in self.visibleCells as! [RevealingTableViewCell]
        {
            if let exceptThisOne = exceptThisOne
            {
                if visibleCell != exceptThisOne
                {
                    visibleCell.setRevealingState(.closed, animated: true)
                }
            }
            else
            {
                visibleCell.setRevealingState(.closed, animated: true)
            }
        }
    }
}

--- 
+++ 
@@ -12,20 +12,25 @@
 
 public extension UITableView
 {
-    public func closeAllCells(exceptThisOne: RevealingTableViewCell? = nil)
+    /// If you leave `exceptThisOne` as `nil`, then all cells will be closed.
+    /// Otherwise all cells except of the cell specified will be closed
+    public func closeAllCells(exceptThisOne cellThatShouldNotBeClosed: RevealingTableViewCell? = nil)
     {
-        for visibleCell in self.visibleCells as! [RevealingTableViewCell]
+        for visibleCell in self.visibleCells
         {
-            if let exceptThisOne = exceptThisOne
+            if let revealingTableViewCell = visibleCell as? RevealingTableViewCell
             {
-                if visibleCell != exceptThisOne
+                if let cellThatShouldNotBeClosed = cellThatShouldNotBeClosed
                 {
-                    visibleCell.setRevealingState(.closed, animated: true)
+                    if visibleCell != cellThatShouldNotBeClosed
+                    {
+                        revealingTableViewCell.setRevealingState(.closed, animated: true)
+                    }
                 }
-            }
-            else
-            {
-                visibleCell.setRevealingState(.closed, animated: true)
+                else
+                {
+                    revealingTableViewCell.setRevealingState(.closed, animated: true)
+                }
             }
         }
     }
Tweak in the closeAllCells logic to avoid forcing the whole tableView to only have cells of type `RevealingTableViewCell `.
