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

    columns

    The initial count of columns.

    rows

    The initial count of rows.

  • Initializes a new instance of the grid class from the specified grid.

    Declaration

    Swift

    public init(original: Grid<T>)

    Parameters

    original

    The 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

    columns

    The new count of columns.

    rows

    The new count of rows.

  • Deletes the column at the specified index.

    Declaration

    Swift

    open func deleteColumn(_ col: Int)

    Parameters

    col

    The index of the column to delete.

  • Inserts a column at the specified index.

    Declaration

    Swift

    open func insertColumns(_ col: Int)

    Parameters

    col

    The index of the column to insert.

  • Deletes the row at the specified index.

    Declaration

    Swift

    open func deleteRow(_ row: Int)

    Parameters

    row

    The index of the row to delete.

  • Inserts a row at the specified index.

    Declaration

    Swift

    open func insertRow(_ row: Int)

    Parameters

    row

    The 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

    col

    The index of the column of the cell where the item will be inserted.

    row

    The index of the row of the cell where the item will be inserted.

    item

    The item to insert.

  • Sets the specified item in the specified cell.

    Declaration

    Swift

    open func setItem(_ col: Int, row: Int, item: T?)

    Parameters

    col

    The index of the column of the cell.

    row

    The index of the row of the cell.

    item

    The item to set.

  • Gets the item in the specified cell.

    Declaration

    Swift

    open func getItem(_ col: Int, row: Int) -> T?

    Parameters

    col

    The index of the column.

    row

    The 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 }