AttachmentOffsetProviding
public protocol AttachmentOffsetProviding : AnyObject
Describes an object capable of providing offsets for the Attachment
. The value is used to offset the Attachment
when rendered alongside the text. This may
be used to align the content baselines in Attachment
content to that of it’s container’s content baselines.
Note
This function may be called m0re than once in the same rendering pass. Changing offsets does not resize the container i.e. unlike how container resizes to fit the attachment, if the offset is change such that the attachment ends up rendering outside the bounds of it’s container, it will not resize the container.Attention
While offset can be provided for any type ofAttachment
i.e. Inline or Block, it is recommended that offset be provided only for Inline. If an offset is provided for Block attachment,
it is possible that the attachment starts overlapping the content in Editor
in the following line since the offset does not affect the line height.
-
Undocumented
Declaration
Swift
func offset(for attachment: Attachment, in textContainer: NSTextContainer, proposedLineFragment lineFrag: CGRect, glyphPosition position: CGPoint, characterIndex charIndex: Int) -> CGPoint