GridCell
open class GridCell
extension GridCell: BoundsObserving
extension GridCell: EditorViewDelegate
extension GridCell: Equatable
extension GridCell: Hashable
Denotes a cell in the GridView
-
Undocumented
Declaration
Swift
public typealias EditorInitializer = () -> EditorView
-
Additional attributes that can be stored on Cell to identify various aspects like Header, Numbered etc.
Declaration
Swift
public var additionalAttributes: [String : Any]
-
Row indexes spanned by the cell. In case of a merged cell, this will contain all the rows= indexes which are merged.
Declaration
Swift
public internal(set) var rowSpan: [Int] { get }
-
Column indexes spanned by the cell. In case of a merged cell, this will contain all the column indexes which are merged.
Declaration
Swift
public internal(set) var columnSpan: [Int] { get }
-
Frame of the cell within
GridView
Declaration
Swift
public internal(set) var frame: CGRect { get }
-
Undocumented
Declaration
Swift
public var backgroundColor: UIColor? { get set }
-
Sets the cell selected
Declaration
Swift
public var isSelected: Bool { get set }
-
Controls if the cell can be selected or not.
Declaration
Swift
public var isSelectable: Bool
-
Invoked when Editor in contained in the Cell is initialized.
Declaration
Swift
public var onEditorInitialized: ((GridCell, EditorView) -> Void)?
-
Confirms if Editor within Cell has been initialized or not.
Declaration
Swift
public var isEditorInitialized: Bool { get }
-
Editor within the cell
Declaration
Swift
public var editor: EditorView { get }
-
Denotes if the cell can be split i.e. is a merged cell.
Declaration
Swift
public var isSplittable: Bool { get }
-
Content size of the cell
Declaration
Swift
public var contentSize: CGSize { get }
-
Content view for the cell
Declaration
Swift
public let contentView: UIView
-
Undocumented
Declaration
Swift
public let gridStyle: GridStyle
-
Undocumented
Declaration
Swift
public let style: GridCellStyle
-
Undocumented
Declaration
Swift
public let ignoresOptimizedInit: Bool
-
Initializes the cell
Important
Creating aGridView
with 100s of cells can result in slow performance when creating an attributed string containing the GridView attachment. Using the closure defers the creation until the view is ready to be rendered in the UI. It is recommended to setup all the parts of editor in closure where possible, or wait until after the GridView is rendered. In case, editor must be initialized before the rendering is complete and it is not possible to configure an aspect within the closure itself,setupEditor()
may be invoked. Use ofsetupEditor()
is discouraged.Declaration
Swift
public init(rowSpan: [Int], columnSpan: [Int], initialHeight: CGFloat = 40, style: GridCellStyle = .init(), gridStyle: GridStyle = .default, ignoresOptimizedInit: Bool = false, editorInitializer: EditorInitializer? = nil)
Parameters
rowSpan
Array of row indexes the cells spans. For e.g. a cell with first two rows as merged, will have a value of [0, 1] denoting 0th and 1st index.
columnSpan
Array of column indexes the cells spans. For e.g. a cell with first two columns as merged, will have a value of [0, 1] denoting 0th and 1st index.
initialHeight
Initial height of the cell. This will be updated based on size of editor content on load,
style
Visual style of the cell
gridStyle
Visual style for grid containing cell border color and width
ignoresOptimizedInit
Ignores optimization to initialize editor within the cell. With optimization, the editor is not initialized until the cell is ready to be rendered on the UI thereby not incurring any overheads when creating attributedText containing a
GridView
in an attachment. Defaults tofalse
.editorInitializer
Closure for setting up the
EditorView
within the cell. -
Sets the focus in the
Editor
within the cell.Declaration
Swift
public func setFocus()
-
Removes the focus from the
Editor
within the cell.Declaration
Swift
public func removeFocus()
-
Applies the given style to the cell
Declaration
Swift
public func applyStyle(_ style: GridCellStyle)
Parameters
style
Style to apply
-
Declaration
Swift
public func didChangeBounds(_ bounds: CGRect, oldBounds: CGRect)
-
Declaration
Swift
public func editor(_ editor: EditorView, didReceiveFocusAt range: NSRange)
-
Declaration
Swift
public func editor(_ editor: EditorView, didLoseFocusFrom range: NSRange)
-
Declaration
Swift
public func editor(_ editor: EditorView, didTapAtLocation location: CGPoint, characterRange: NSRange?)
-
Declaration
Swift
public func editor(_ editor: EditorView, didChangeSelectionAt range: NSRange, attributes: [NSAttributedString.Key : Any], contentType: EditorContent.Name)
-
Declaration
Swift
public func editor(_ editor: EditorView, didReceiveKey key: EditorKey, at range: NSRange)
-
Undocumented
Declaration
Swift
public func editor(_ editor: EditorView, didChangeBackgroundColor color: UIColor?, oldColor: UIColor?)
-
Declaration
Swift
public static func == (lhs: GridCell, rhs: GridCell) -> Bool
-
Declaration
Swift
public func hash(into hasher: inout Hasher)