Skip to content

Commit

Permalink
Added ability to detect if cell editor is initialized and a callback …
Browse files Browse the repository at this point in the history
…for the same
  • Loading branch information
rajdeep committed Dec 11, 2023
1 parent 333e68b commit 8b77b9e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Proton/Sources/Swift/Grid/View/GridCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,14 @@ open class GridCell {
/// Controls if the cell can be selected or not.
public var isSelectable: Bool = true

/// Invoked when Editor in contained in the Cell is initialized. Only applicable when deferred `editorInitializer` is passed in `init`.
public var onEditorInitialized: ((GridCell, EditorView) -> Void)?

/// Confirms if Editor within Cell has been initialized or not. Only applicable when deferred `editorInitializer` is passed in `init`.
public var isEditorInitialized: Bool {
_editor != nil
}

private(set) var editorSetupComplete = false
private var _editor: EditorView?
/// Editor within the cell
Expand All @@ -161,6 +169,7 @@ open class GridCell {
return _editor
}
let editor = editorInitializer()
onEditorInitialized?(self, editor)
_editor = editor
return editor
}
Expand Down

0 comments on commit 8b77b9e

Please sign in to comment.