Text

public struct Text

The wrapper for the message text in different formats: plain text, markdown, and html. An instance of Text can only be one of HTML, Markdown or Plain

Since

2.3.0
  • Returns the plain text if exist

    Declaration

    Swift

    public private(set) var plain: String? { get }
  • Returns the html if exist.

    Declaration

    Swift

    public private(set) var html: String? { get }
  • Returns the markdown if exist.

    Declaration

    Swift

    public private(set) var markdown: String? { get }
  • Make a Text object for the plain text.

    Declaration

    Swift

    public static func plain(plain: String) -> Text

    Parameters

    plain

    The plain text.

  • Make a Text object for the html.

    Since

    3.4.0

    Declaration

    Swift

    public static func html(html: String) -> Text

    Parameters

    html

    The text with the html markup.

  • Make a Text object for the markdown.

    Since

    3.4.0

    Declaration

    Swift

    public static func markdown(markdown: String) -> Text

    Parameters

    markdown

    The text with the markdown markup.

Deprecated

  • Make a Text object for the html.

    Declaration

    Swift

    @available(*, deprecated, message: "Use html(html: String﹚ instead")
    public static func html(html: String, plain: String? = nil) -> Text

    Parameters

    html

    The text with the html markup.

    plain

    This param is ignored. null can be passed.

  • Make a Text object for the markdown.

    Declaration

    Swift

    @available(*, deprecated, message: "Use markdown(markdown: String﹚ instead")
    public static func markdown(markdown: String, html: String, plain: String? = nil) -> Text

    Parameters

    markdown

    The text with the markdown markup.

    html

    This param is ignored. null can be passed.

    plain

    This param is ignored. null can be passed.