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
GridViewwhich can be used to handle cell specificEditorVieweventsDeclaration
Swift
public weak var delegate: GridViewDelegate? -
Gets the attachment containing the
GridViewDeclaration
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 theAttachmentthat hosts theGridView.Note
In absence of aboundObserver, theGridViewwill not autoresize when the content in the cells are changed.Declaration
Swift
public var boundsObserver: BoundsObserving? { get set } -
Selection color for the
GridView. Defaults totintColorDeclaration
Swift
public var selectionColor: UIColor? -
Determines if
GridViewis 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
GridViewDeclaration
Swift
public var containsFrozenColumns: Bool { get } -
Determines if there are any frozen rows in the
GridViewDeclaration
Swift
public var containsFrozenRows: Bool { get } -
Collection of cells contained in the
GridViewDeclaration
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
GridViewDeclaration
Swift
public var numberOfRows: Int { get } -
Initializes
GridViewusing the provided configuration.Declaration
Swift
public convenience init(config: GridConfiguration, cellEditorInitializer: GridCell.EditorInitializer? = nil) -
Initializes
GridViewusing the provided configuration.Declaration
Swift
public convenience init(config: GridConfiguration, cells: [GridCell], cellEditorInitializer: GridCell.EditorInitializer? = nil)Parameters
configConfiguration for
GridViewcellsCells contained within
GridViewcellEditorInitializerCustom initializer for
EditorViewwithinGridCell. 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
GridViewrendering 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
enabledtrueto enable resizing -
Gets the cell for the
EditorViewcontained in the current instanceDeclaration
Swift
public func cellFor(_ editor: EditorView) -> GridCell?Parameters
editorEditor for which cell needs to be queried.
Return Value
GridCellthat 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: [GridCell])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: [GridCell]) -> 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: [GridCell])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: GridCell)Parameters
cellCell to split.
-
Inserts a new row at given index.
Declaration
Swift
@discardableResult public func insertRow(at index: Int, configuration: GridRowConfiguration) -> Result<[GridCell], GridViewError>Parameters
indexIndex 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
configurationConfiguration 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
indexIndex 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
configurationConfiguration 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
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) -> GridCell?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
GridView Class Reference