RendererView

open class RendererView : UIView

A scrollable, multiline text region capable of resizing itself based of the height of the content. Maximum height of RendererView may be restricted using an absolute value or by using auto-layout constraints. Instantiation of RendererView is simple and straightforward and can be used to host simple formatted text or complex layout containing multiple nested RendererView via use of Attachment.

  • An object interested in intercepting and responding to user interaction like tap and selecting changes in the RendererView.

    Declaration

    Swift

    public weak var delegate: RendererViewDelegate?
  • Undocumented

    Declaration

    Swift

    public weak var listFormattingProvider: RendererListFormattingProvider?
  • Context for the current renderer

    Declaration

    Swift

    public let context: RendererViewContext
  • Initializes the RendererView

    Declaration

    Swift

    public init(frame: CGRect = .zero, context: RendererViewContext = .shared)

    Parameters

    frame

    Initial frame to be used for RendererView

    context

    Optional context to be used. RendererViewContext is link between RendererCommandExecutor and the RendererView. RendererCommandExecutor needs to have same context as the RendererView to execute a command on it. Unless you need to have restriction around some commands to be restricted in execution on certain specific renderers, the default value may be used.

  • Default font to be used for the rendered content.

    Note

    This font is only applied in case where the attributedText does not have font information in the content. If the attributedText already has an attribute applied for font, this font will be ignored.

    Declaration

    Swift

    public var font: UIFont { get set }
  • Content rendered in the RendererView.

    Declaration

    Swift

    public var attributedText: NSAttributedString { get set }
  • Gets or sets the selected range.

    Declaration

    Swift

    public var selectedRange: NSRange { get set }
  • The types of data converted to tappable URLs in the renderer view.

    Declaration

    Swift

    public var dataDetectorTypes: UIDataDetectorTypes { get set }
  • The attributes to apply to links.

    Declaration

    Swift

    public var linkTextAttributes: [NSAttributedString.Key : Any]! { get set }
  • Selected text in the editor.

    Declaration

    Swift

    public var selectedText: NSAttributedString { get }
  • Returns the visible text range.

    Note

    The range may also contains lines that are partially visible owing to the current scroll position.

    Declaration

    Swift

    public var visibleRange: NSRange { get }
  • Get all the content from Renderer.

    See also

    If you need to get content in a given range, please use contents(in range:NSRange).

    Declaration

    Swift

    public var contents: [EditorContent] { get }
  • Gets and sets the content offset.

    Declaration

    Swift

    public var contentOffset: CGPoint { get set }
  • Scrolls the given range to visible area of the RendererView. The scroll only changes enough to make the range visible i.e. the it does not scroll far enough such that given range is centred in the visible area of Renderer. No-op if the range is already visible.

    Declaration

    Swift

    public func scrollRangeToVisible(_ range: NSRange)

    Parameters

    range

    Range to scroll to.

  • Scrolls the given rectangle to visible area of RendererView

    Declaration

    Swift

    public func scrollRectToVisible(_ rect: CGRect, animated: Bool)

    Parameters

    rect

    Rectangle to scroll to.

    animated

    Determines if the scroll action should animate

  • Gets the contents in the given range

    Declaration

    Swift

    public func contents(in range: NSRange? = nil) -> [EditorContent]

    Parameters

    range

    Range to get contents from.

  • Gets the bounding rectangles for the given range. If the range spans across multiple lines, in the RendererView, a rectangle is returned for each of the line.

    Declaration

    Swift

    public func rects(for range: NSRange) -> [CGRect]

    Parameters

    range

    Range to get bounding rectangles for.

  • Adds given attributes to the range provided. If the range already contains a value for an attribute being provided, existing value will be overwritten by the new value provided in the attributes.

    Declaration

    Swift

    public func addAttributes(_ attributes: [NSAttributedString.Key : Any], at range: NSRange)

    Parameters

    attributes

    Attributes to be added.

    range

    Range on which attributes should be applied to.

  • Removes the given attributes from the range provided. If the attribute does not exist in the range, it will be a no-op.

    Declaration

    Swift

    public func removeAttributes(_ attributes: [NSAttributedString.Key], at range: NSRange)

    Parameters

    attributes

    Attributes to remove.

    range

    Range to remove the attributes from.

  • Adds given attribute to the range provided. If the attribute already exists in the range, it will be overwritten with the new value provided here.

    Declaration

    Swift

    public func addAttribute(_ name: NSAttributedString.Key, value: Any, at range: NSRange)

    Parameters

    name

    Key of the attribute to add.

    value

    Value of the attribute.

    range

    Range to which attribute should be added.

  • Removes the attribute from given range. If the attribute does not exist in the range, it is a no-op.

    Declaration

    Swift

    public func removeAttribute(_ name: NSAttributedString.Key, at range: NSRange)

    Parameters

    name

    Key of attribute to be removed.

    range

    Range from which attribute should be removed.