TextTable
public struct TextTable
Used to create a tabular representation of data.
-
The
Stringused to separate columns in the table. Defaults to|
.Declaration
Swift
public var columnFence = "|" -
The
Stringused to separate rows in the table. Defaults to-
.Declaration
Swift
public var rowFence = "-" -
The
Stringused to mark the intersections of acolumnFenceand arowFence. Defaults to+
.Declaration
Swift
public var cornerFence = "+" -
The table’s header text. If set to
nil, no header will be rendered. Defaults tonil.Declaration
Swift
public var header: String? = nil -
Create a new
TextTablefromTextTableColumns.- parameters:
- columns: An
ArrayofTextTableColumns. - header: The table header. Defaults to
nil.
Declaration
Swift
public init(columns: [TextTableColumn], header: String? = nil) -
Create a new
TextTablefrom anTextTableRepresentables.- parameters:
- objects: An
ArrayofTextTableRepresentables. - header: The table header. This will override the header specified by the
TextTableRepresentable. Defaults tonil.
Declaration
Swift
public init<T: TextTableRepresentable>(objects: [T], header: String? = nil) -
Add a row to the table.
- parameters:
- values: The values contained in the new row.
Declaration
Swift
public mutating func addRow(values: [CustomStringConvertible]) -
Render the table to a
String.Declaration
Swift
public func render() -> StringReturn Value
The
Stringrepresentation of the table.
TextTable Struct Reference