HTMLNode

public enum HTMLNode

A structure representing an HTML element with means to modify its CSS style as well as custom attributes.

  • Undocumented

    Declaration

    Swift

    case raw(String)
  • Undocumented

    Declaration

    Swift

    case div(
        subNodes: [HTMLNode] = [],
        style: [CSSKey: CSSValue] = [:],
        customAttributes: [String: String?] = [:]
    )
  • Undocumented

    Declaration

    Swift

    case img(
        path: String,
        style: [CSSKey: CSSValue] = [:]
    )
  • Undocumented

    Declaration

    Swift

    case input(
        placeholder: String,
        value: String,
        style: [CSSKey: CSSValue] = [:],
        customAttributes: [String: String?] = [:]
    )
  • Creates a string representation of the HTMLNode.

    Declaration

    Swift

    public func string() -> String
  • Returns an HTMLNode with an added CSS style attribute.

    Declaration

    Swift

    public func withStyle(key: CSSKey, value newValue: CSSValue) -> HTMLNode

    Parameters

    key

    The CSS key of the added attribute.

    value

    The CSS value of the added attribute.

  • Returns an HTMLNode with an added custom HTML attribute.

    Declaration

    Swift

    public func withCustomAttribute(key: String, value newValue: String? = nil) -> HTMLNode

    Parameters

    key

    The String key of the added attribute.

    value

    The String value of the added attribute.

  • An enumeration representing a CSS key.

    See more

    Declaration

    Swift

    public enum CSSKey : String, CustomStringConvertible
  • An enumeration representing a CSS value.

    See more

    Declaration

    Swift

    public enum CSSValue : Equatable
  • Undocumented

    Declaration

    Swift

    public static func div(style: [CSSKey : CSSValue] = [:], buildSubnode: () -> HTMLNode) -> HTMLNode