TableView

public class TableView : UIView
extension TableView: UIScrollViewDelegate
extension TableView: AsyncDeferredRenderable
extension TableView: 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 TableView as an attachment.

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

    Declaration

    Swift

    public weak var delegate: TableViewDelegate? { get set }
  • Gets the attachment containing the TableView

    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 TableView. Typically, this will be the Attachment that hosts the TableView.

    Note

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

    Declaration

    Swift

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

    Declaration

    Swift

    public var selectionColor: UIColor?
  • Determines if TableView 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 TableView

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

    public var numberOfRows: Int { get }
  • Cells visible in current viewport.

    Declaration

    Swift

    public var visibleCells: [TableCell] { get }
  • Undocumented

    Declaration

    Swift

    public override var bounds: CGRect { get set }
  • Initializes TableView using the provided configuration.

    Declaration

    Swift

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

    Declaration

    Swift

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

    Parameters

    config

    Configuration for TableView

    cells

    Cells contained within TableView

    cellEditorInitializer

    Custom initializer for EditorView within TableCell. 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 TableView rendering may be broken.

  • Undocumented

    Declaration

    Swift

    public override var backgroundColor: UIColor? { get set }
  • Maintains the scroll lock on the cell passed in if the original rect ends up moving as a result of cells getting rendered above this rect position

    Declaration

    Swift

    public func maintainScrolledPositionLock(on cell: TableCell?, rect: CGRect)

    Parameters

    cell

    Cell to lock on

    rect

    Offset within cell with respect to origin to scroll to.

  • Undocumented

    Declaration

    Swift

    public override func layoutSubviews()
  • 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) -> TableCell?

    Parameters

    editor

    Editor for which cell needs to be queried.

    Return Value

    TableCell 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: [TableCell])

    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: [TableCell]) -> 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: [TableCell])

    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: TableCell)

    Parameters

    cell

    Cell to split.

  • 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) -> TableCell?

    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?)