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
TableViewwhich can be used to handle cell specificEditorVieweventsDeclaration
Swift
public weak var delegate: TableViewDelegate? { get set } -
Gets the attachment containing the
TableViewDeclaration
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 theAttachmentthat hosts theTableView.Note
In absence of aboundObserver, theTableViewwill not autoresize when the content in the cells are changed.Declaration
Swift
public var boundsObserver: BoundsObserving? { get set } -
Selection color for the
TableView. Defaults totintColorDeclaration
Swift
public var selectionColor: UIColor? -
Determines if
TableViewis selected or not.Declaration
Swift
public var isSelected: Bool { get set } -
Allows scrolling grid in any direction. Defaults to
falseDefault 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
TableViewDeclaration
Swift
public var containsFrozenColumns: Bool { get } -
Determines if there are any frozen rows in the
TableViewDeclaration
Swift
public var containsFrozenRows: Bool { get } -
Collection of cells contained in the
TableViewDeclaration
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
TableViewDeclaration
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
TableViewusing the provided configuration.Declaration
Swift
public convenience init(config: GridConfiguration, cellEditorInitializer: GridCell.EditorInitializer? = nil) -
Initializes
TableViewusing the provided configuration.Declaration
Swift
public convenience init(config: GridConfiguration, cells: [TableCell], cellEditorInitializer: TableCell.EditorInitializer? = nil)Parameters
configConfiguration for
TableViewcellsCells contained within
TableViewcellEditorInitializerCustom initializer for
EditorViewwithinTableCell. This will also be used when creating new cells as a return of adding new row or column, or cells being split.ImportantCare must be taken that the number of cells are correct per the configuration provided, failing which the
TableViewrendering 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
cellCell to lock on
rectOffset 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
enabledtrueto enable resizing -
Gets the cell for the
EditorViewcontained in the current instanceDeclaration
Swift
public func cellFor(_ editor: EditorView) -> TableCell?Parameters
editorEditor for which cell needs to be queried.
Return Value
TableCellthat contains the passed inEditorView, 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
cellsCells 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]) -> BoolParameters
cellsCollection of cells to check if these can be merged.
Return Value
trueis cells can be merged. -
Merges the cells if the collection is mergeable.
Declaration
Swift
public func merge(cells: [TableCell])Parameters
cellsCells 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
cellCell to split.
-
Deletes the row at given index
Declaration
Swift
public func deleteRow(at index: Int)Parameters
indexIndex to delete
-
Deletes the column at given index
Declaration
Swift
public func deleteColumn(at index: Int)Parameters
indexIndex to delete
-
Freezes all the columns from 0 to the index provided
Declaration
Swift
public func freezeColumns(upTo maxIndex: Int)Parameters
maxIndexIndex to freeze upto
-
Freezes all the rows from 0 to the index provided
Declaration
Swift
public func freezeRows(upTo maxIndex: Int)Parameters
maxIndexIndex 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
rowIndexRow index for the cell
columnIndexColumn 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
rowIndexRow index of the cell
columnIndexColumn index for the cell
animatedAnimates scroll if
true -
Applies style to row at given index
Declaration
Swift
public func applyStyle(_ style: GridCellStyle, toRow index: Int)Parameters
styleStyle to apply
indexIndex of the row
-
Applies style to column at given index
Declaration
Swift
public func applyStyle(_ style: GridCellStyle, toColumn index: Int)Parameters
styleStyle to apply
indexIndex of the column
-
Undocumented
Declaration
Swift
public func scrollViewDidScroll(_ scrollView: UIScrollView) -
Undocumented
Declaration
Swift
public func containerEditor(_ editor: EditorView, backgroundColorUpdated color: UIColor?, oldColor: UIColor?)
View on GitHub
TableView Class Reference