GridView

public class GridView : UIView
extension GridView: UIScrollViewDelegate
extension GridView: AsyncDeferredRenderable
extension GridView: BackgroundColorObserving

A view that provides a tabular structure where each cell is an EditorView. Since the cells contains an EditorView in itself, it is capable of hosting any attachment that EditorView can host including another GridView as an attachment.

  • Delegate for GridView which can be used to handle cell specific EditorView events

    Declaration

    Swift

    public weak var delegate: GridViewDelegate?
  • Gets the attachment containing the GridView

    Declaration

    Swift

    public var containerAttachment: Attachment? { get }
  • Determines if column resizing handles are visible or not.

    Declaration

    Swift

    public private(set) var isColumnResizingHandlesVisible: Bool { get set }
  • Bounds observer for the GridView. Typically, this will be the Attachment that hosts the GridView.

    Note

    In absence of a boundObserver, the GridView will not autoresize when the content in the cells are changed.

    Declaration

    Swift

    public var boundsObserver: BoundsObserving? { get set }
  • Selection color for the GridView. Defaults to tintColor

    Declaration

    Swift

    public var selectionColor: UIColor?
  • Determines if GridView is selected or not.

    Declaration

    Swift

    public var isSelected: Bool { get set }
  • Allows scrolling grid in any direction. Defaults to false Default behaviour restricts scrolling to horizontal or vertical direction at a time.

    Declaration

    Swift

    public var isFreeScrollingEnabled: Bool { get set }
  • Maximum index up till which columns are frozen. Columns are frozen from 0 to this index value.

    Declaration

    Swift

    public var frozenColumnMaxIndex: Int? { get }
  • Maximum index up till which rows are frozen. Rows are frozen from 0 to this index value.

    Declaration

    Swift

    public var frozenRowMaxIndex: Int? { get }
  • Determines if there are any frozen columns in the GridView

    Declaration

    Swift

    public var containsFrozenColumns: Bool { get }
  • Determines if there are any frozen rows in the GridView

    Declaration

    Swift

    public var containsFrozenRows: Bool { get }
  • Collection of cells contained in the GridView

    Declaration

    Swift

    public var cells: [GridCell] { get }
  • Undocumented

    Declaration

    Swift

    public var selectedCells: [GridCell] { get }
  • Number of columns in the GridView.

    Declaration

    Swift

    public var numberOfColumns: Int { get }
  • Number of rows in the GridView

    Declaration

    Swift

    public var numberOfRows: Int { get }
  • Initializes GridView using the provided configuration.

    Declaration

    Swift

    public convenience init(config: GridConfiguration, cellEditorInitializer: GridCell.EditorInitializer? = nil)
  • Initializes GridView using the provided configuration.

    Declaration

    Swift

    public convenience init(config: GridConfiguration, cells: [GridCell], cellEditorInitializer: GridCell.EditorInitializer? = nil)

    Parameters

    config

    Configuration for GridView

    cells

    Cells contained within GridView

    cellEditorInitializer

    Custom initializer for EditorView within GridCell. This will also be used when creating new cells as a return of adding new row or column, or cells being split.

    Important

    Care must be taken that the number of cells are correct per the configuration provided, failing which the GridView rendering may be broken.

  • Undocumented

    Declaration

    Swift

    public override var backgroundColor: UIColor? { get set }
  • Enables or disables column resizing

    Declaration

    Swift

    public func setColumnResizing(_ enabled: Bool)

    Parameters

    enabled

    true to enable resizing

  • Gets the cell for the EditorView contained in the current instance

    Declaration

    Swift

    public func cellFor(_ editor: EditorView) -> GridCell?

    Parameters

    editor

    Editor for which cell needs to be queried.

    Return Value

    GridCell that contains the passed in EditorView, if present

  • Selects given cells. Also, deselects any previously selected cells

    Note

    Any combination of cells can be passed in, and will be selected, if possible.

    Declaration

    Swift

    public func selectCells(_ cells: [GridCell])

    Parameters

    cells

    Cells to select.

  • Deselects any selected cell.

    Declaration

    Swift

    public func deselectCells()
  • Determines if the collection of cells can be merged. For cells to be mergable, they need to be adjacent to each other, and the shape of selection needs to be rectangular.

    Declaration

    Swift

    public func isCellSelectionMergeable(_ cells: [GridCell]) -> Bool

    Parameters

    cells

    Collection of cells to check if these can be merged.

    Return Value

    true is cells can be merged.

  • Merges the cells if the collection is mergeable.

    Declaration

    Swift

    public func merge(cells: [GridCell])

    Parameters

    cells

    Cells to merge.

  • Splits the cell into original constituent cells from earlier Merge operation. After split, the contents are held in the first original cell and all new split cells are added as empty,

    Declaration

    Swift

    public func split(cell: GridCell)

    Parameters

    cell

    Cell to split.

  • Inserts a new row at given index.

    Declaration

    Swift

    @discardableResult
    public func insertRow(at index: Int, configuration: GridRowConfiguration) -> Result<[GridCell], GridViewError>

    Parameters

    index

    Index at which new row should be inserted. If the index is out of bounds, row will be inserted at the top or bottom of the grid based on index value

    configuration

    Configuration for the new row

    Return Value

    Result with newly added cells for .success, error in case of .failure

  • Inserts a new column at given index.

    Declaration

    Swift

    @discardableResult
    public func insertColumn(at index: Int, configuration: GridColumnConfiguration) -> Result<[GridCell], GridViewError>

    Parameters

    index

    Index at which new column should be inserted. If the index is out of bounds, column will be inserted at the beginning or end of the grid based on index value

    configuration

    Configuration for the new column

    Return Value

    Result with newly added cells for .success, error in case of .failure

  • Deletes the row at given index

    Declaration

    Swift

    public func deleteRow(at index: Int)

    Parameters

    index

    Index to delete

  • Deletes the column at given index

    Declaration

    Swift

    public func deleteColumn(at index: Int)

    Parameters

    index

    Index to delete

  • Freezes all the columns from 0 to the index provided

    Declaration

    Swift

    public func freezeColumns(upTo maxIndex: Int)

    Parameters

    maxIndex

    Index to freeze upto

  • Freezes all the rows from 0 to the index provided

    Declaration

    Swift

    public func freezeRows(upTo maxIndex: Int)

    Parameters

    maxIndex

    Index to freeze upto

  • Undocumented

    Declaration

    Swift

    public func unfreezeColumns()
  • Undocumented

    Declaration

    Swift

    public func unfreezeRows()
  • Undocumented

    Declaration

    Swift

    public func collapseRow(at index: Int)
  • Gets the cell at given row and column index. Indexes may be contained in a merged cell.

    Declaration

    Swift

    public func cellAt(rowIndex: Int, columnIndex: Int) -> GridCell?

    Parameters

    rowIndex

    Row index for the cell

    columnIndex

    Column index for the cell

    Return Value

    Cell at given row and column, if exists`

  • Scrolls the cell at given index into viewable area. Indexes may be contained in a merged cell.

    Declaration

    Swift

    public func scrollToCellAt(rowIndex: Int, columnIndex: Int, animated: Bool = false)

    Parameters

    rowIndex

    Row index of the cell

    columnIndex

    Column index for the cell

    animated

    Animates scroll if true

  • Applies style to row at given index

    Declaration

    Swift

    public func applyStyle(_ style: GridCellStyle, toRow index: Int)

    Parameters

    style

    Style to apply

    index

    Index of the row

  • Applies style to column at given index

    Declaration

    Swift

    public func applyStyle(_ style: GridCellStyle, toColumn index: Int)

    Parameters

    style

    Style to apply

    index

    Index of the column

  • Undocumented

    Declaration

    Swift

    public func scrollViewDidScroll(_ scrollView: UIScrollView)
  • Undocumented

    Declaration

    Swift

    public func containerEditor(_ editor: EditorView, backgroundColorUpdated color: UIColor?, oldColor: UIColor?)