Table

public final class Table : GenericElement

Table html tag class element

### Usage Example: ###

  let table = Table()
  table.tableHeaders(titles: ["Name", "Age", "Height", "Location"])
  //table.tableHeaders(titles: ["Name", "Age", "Height", "Location"], aligns: ["center", "left", "left", "left"]) // Align Headers

  table.addRow()
  table.addInRow("Arthurito Thompson")
  table.addInRow("52")
  table.addInRow("1,30")
  table.addInRow("Torresmo, RS")
  table.addRow()
  table.addInRow("Stephen Curry")
  table.addInRow("27")
  table.addInRow("1,91")
  table.addInRow("Akron, OH")
  table.addRow()
  table.addInRow("Klay Thompson")
  table.addInRow("25")
  table.addInRow("2,01")
  table.addInRow("Los Angeles, CA")
  • Object with table body. tr, td: TBody

    Declaration

    Swift

    private let tbody: TBody
  • Object with table head. th, td: THead? is optional

    Declaration

    Swift

    private var thead: THead?
  • List of rows a array of Trtag element

    Declaration

    Swift

    private var rows: [Tr]
  • tag

    Override tag element for element. Default is table

    Declaration

    Swift

    override var tag: String { get }
  • Override container element defaults is true

    Declaration

    Swift

    override var container: Bool { get }

Functions

  • This method append a new eow element in row objects list

    Declaration

    Swift

    public func tableHeaders(titles: [String], aligns: [String]? = nil, class: [String]? = nil)

    Parameters

    titles

    Array with titles [String]

    aligns

    optional array with aligns [String]?

    class

    optional array with css class [String]?

  • This method append a new eow element in row objects list

    Declaration

    Swift

    @discardableResult
    public func addRow(_ attributes: AttributeType...) -> Tr

    Parameters

    element

    Generic Type ElementProtocol or String

    attributes

    This is a attr for select attributes AttributeType... CVarArg Returns: Td a item to customize

  • This method append a new collumn element in row objects list

    • Attention it is mandatory to create a row to add a column to it !!

    Declaration

    Swift

    @discardableResult
    public func addInRow<T>(_ element: T, attributes: AttributeType...) -> Td

    Parameters

    element

    Generic Type ElementProtocol or String

    attributes

    This is a attr for select attributes AttributeType... CVarArg Returns: Td a item to customize

  • Override method return tag and all elements

    Declaration

    Swift

    public override func getString() -> String

    Return Value

    String tag and all table elements

  • Override generate methot do print elements

    Declaration

    Swift

    public override func generate()