         return rowCapacity - 1
     }
     
+    
     // Generator for implementing for..in iteration
-    func generate() -> AnyGenerator<T> {
-    
+    func generate() -> AnyGenerator<T>
+    {
+        
         let rowMax = rowCapacity
         let colMax = colCapacity
         

import Foundation

class LiteMatrix<T: NSObject> {

    private let matrix: ObjcLiteMatrix
    let rowCapacity: Int
    let colCapacity: Int
    
    private var initializeTOnMatrixInit: Bool = true
    private var warning: String
    private var index = (x:0, y:0)
    
    
    // Designated initializer, initializes a matrix of unique objects
    init(rows: Int, columns cols: Int) {
        rowCapacity = rows
        colCapacity = cols
        
        matrix = ObjcLiteMatrix(rowSize: rows, withColumnSize: cols)
        warning = "Index out of range - row capacity: \(rowCapacity), col capacity: \(colCapacity)"
       
        for i in 0..<rowCapacity {
            for j in 0..<colCapacity {
                matrix.addObjectToMatrixAtIndex(T() as AnyObject, row:i , column:j)
            }
        }
    }


    // Initializes a Matrix of references to the same object
    init(row: Int, column col: Int, withRepeatedValue value: T) {
        rowCapacity = row
        colCapacity = col
        
        matrix = ObjcLiteMatrix(rowSize: row, withColumnSize: col)
        warning = "Index out of range - row capacity: \(rowCapacity), col capacity: \(colCapacity)"
        
        for i in 0..<rowCapacity {

        var colIndex = 0
        
        // Passes function definition for next() on init with a closure
        return AnyGenerator {
            if rowIndex < rowMax {
                if colIndex < colMax {
                    let col = colIndex
                    colIndex += 1
                    return self.getObjectFromMatrixAtRow(rowIndex, column: col)
                } else {
                    colIndex = 0
                    let row = rowIndex
                    rowIndex += 1
                    return self.getObjectFromMatrixAtRow(row, column: colIndex)
                }
            } else {
                return nil
