GenericElement

public class GenericElement : ElementProtocol

Base Class for all HTML elements implement

  • Contains a array with AttributeType

    Declaration

    Swift

    public var attributes: [AttributeType]
  • tag

    Contains String with tag element. Default is ""

    Declaration

    Swift

    private(set) var tag: String { get }
  • Define if element is block tag or line tag. Default is false

    Declaration

    Swift

    private(set) var container: Bool { get }
  • Define if element is a form element. Default is false

    Declaration

    Swift

    private(set) var formElement: Bool { get }
  • Contains a array of elements

    Declaration

    Swift

    public var objects: [ElementProtocol]

Initialization

  • Init with array of AttributeType

    • Usage: init(("class", "myclass"), ("id", "myId"))

    Declaration

    Swift

    public init(_ attributes: AttributeType...)

    Parameters

    attributes
  • Init with array of AttributeType

    Declaration

    Swift

    public init(_ attributes: [AttributeType])

    Parameters

    attributes

    [AttributeType]

Functions

  • This method add a new single attribute

    Declaration

    Swift

    public func addAttribute(_ attr: AttributeType)

    Parameters

    attr
  • This method return open tag and all attributes

    Declaration

    Swift

    func openTag() -> String

    Return Value

    String open tag with attributes

  • This method return tag and all elements

    Declaration

    Swift

    func closeTag() -> String

    Return Value

    String close tag

  • This method return tag and all elements

    Declaration

    Swift

    public func getString() -> String

    Return Value

    String tag and all elements

  • This method print tag and all elements

    Declaration

    Swift

    public func generate()