Grid
open class Grid<T> where T : CellProtocol
Represents a grid in the diagram.
-
Initializes a new instance of the grid class.
Declaration
Swift
public init() -
Initializes a new instance of the grid class with the specified amount of rows and columns.
Declaration
Swift
public init(columns: Int, rows: Int)Parameters
columnsThe initial count of columns.
rowsThe initial count of rows.
-
Initializes a new instance of the grid class from the specified grid.
Declaration
Swift
public init(original: Grid<T>)Parameters
originalThe grid from which the new grid copies its settings and data.
-
Resizes the grid to the specified number of rows and columns.
Declaration
Swift
open func resize(_ columns: Int, rows: Int)Parameters
columnsThe new count of columns.
rowsThe new count of rows.
-
Deletes the column at the specified index.
Declaration
Swift
open func deleteColumn(_ col: Int)Parameters
colThe index of the column to delete.
-
Inserts a column at the specified index.
Declaration
Swift
open func insertColumns(_ col: Int)Parameters
colThe index of the column to insert.
-
Deletes the row at the specified index.
Declaration
Swift
open func deleteRow(_ row: Int)Parameters
rowThe index of the row to delete.
-
Inserts a row at the specified index.
Declaration
Swift
open func insertRow(_ row: Int)Parameters
rowThe index of the row to insert.
-
Adds the specified item in the specified cell.
Declaration
Swift
open func addItem(_ col: Int, row: Int, item: T)Parameters
colThe index of the column of the cell where the item will be inserted.
rowThe index of the row of the cell where the item will be inserted.
itemThe item to insert.
-
Sets the specified item in the specified cell.
Declaration
Swift
open func setItem(_ col: Int, row: Int, item: T?)Parameters
colThe index of the column of the cell.
rowThe index of the row of the cell.
itemThe item to set.
-
Gets the item in the specified cell.
Declaration
Swift
open func getItem(_ col: Int, row: Int) -> T?Parameters
colThe index of the column.
rowThe index of the row.
Return Value
The item in the cell; nil if none is found.
-
Gets the count of items in the grid.
Declaration
Swift
open var count: Int { get set }
Grid Class Reference