AsyncAttachmentRenderingDelegate
public protocol AsyncAttachmentRenderingDelegate : AnyObject
Describes an object that fulfils requirements to enable asynchronous rendering of attachments in the EditorView
-
Provides the viewport for the
Editor. In typical cases, this would be used if theEditorViewis made non-scrollable and hosted within another scrollable container i.e. ScrollView.Note
To use default value, i.e. viewport of the EditorView, leave this value asnilImportant
EditorViewalso has aviewportproperty that also depends on this property. Care must be taken to not to returneditor.viewporthere. Doing so will cause a stack overflow crash. An independently calculated value can safely be returned here.Declaration
Swift
var prioritizedViewport: CGRect? { get } -
Determines if particular attachment should be rendered asynchronously. The check may also be used to render certain types of attachments synchronously or asynchronously.
Declaration
Swift
func shouldRenderAsync(attachment: Attachment) -> BoolParameters
attachmentAttachment to be rendered.
Return Value
trueto render asynchronously. -
Notifies when an attachment is rendered asynchronously.
Declaration
Swift
func didRenderAttachment(_ attachment: Attachment, in editor: EditorView)Parameters
attachmentAttachment that is rendered.
editorEditor in which the attachment is rendered.
-
Notifies when the viewport is rendered. Value of
viewportis governed byviewportproperty inAsyncAttachmentRenderingDelegatewhen not nil, else fromEditorViewNote
There may be more than one invocation for the sameviewportespecially when user scroll out and back to the sameviewport. This is invoked when all the attachments in theviewportare rendered or the text is laid out and there are no attachments to render.Declaration
Swift
func didCompleteRenderingViewport(_ viewport: CGRect, in editor: EditorView)Parameters
viewportViewport that is rendered.
editorEditor for which the
viewportrendering is completed.
View on GitHub
AsyncAttachmentRenderingDelegate Protocol Reference