 
 import UIKit
 
+// via:http://stackoverflow.com/questions/27094878/how-do-i-get-the-count-of-a-swift-enum
+// enum which provides a count of its cases
+protocol CaseCountable {
+    static func countCases() -> Int
+    static var caseCount : Int { get }
+}
+// provide a default implementation to count the cases for Int enums assuming starting at 0 and contiguous
+extension CaseCountable where Self : RawRepresentable, Self.RawValue == Int {
+    // count the number of cases in the enum
+    static func countCases() -> Int {
+        // starting at zero, verify whether the enum can be instantiated from the Int and increment until it cannot
+        var count = 0
+        while let _ = Self(rawValue: count) { count++ }
+        return count
+    }
+}
+
 class NBTableViewController: UITableViewController {
     
-    enum Segue: Int {
+    enum Segue: Int, CaseCountable {
         case CWSegue, JDSegue, TSSegue
         
         func toString() -> String {

    // MARK: - Table view data source
    override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        // #warning Incomplete implementation, return the number of rows
        return 3
    }

    override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {

            case .TSSegue : return "TSMessage"
            }
        }
        
        static let caseCount = Segue.countCases()
    }

    override func viewDidLoad() {
