 }
 
 private func fence(strings: [String], separator: String) -> String {
-    return separator + strings.joinWithSeparator(separator) + separator
+    #if swift(>=3)
+        return separator + strings.joined(separator: separator) + separator
+    #else
+        return separator + strings.joinWithSeparator(separator) + separator
+    #endif
 }
 
 public struct TextTableColumn {

    }

    public mutating func addRow(values: [CustomStringConvertible]) {
        let values = values.count >= columns.count ? values :
            values + [CustomStringConvertible](count: columns.count - values.count, repeatedValue: "")
        columns = zip(columns, values).map {
            (column, value) in
            var column = column


    public func render() -> String {
        let separator = fence(columns.map({ column in
            #if swift(>=3)
                return repeatElement(rowFence, count: column.width + 2).joined(separator: "")
            #else
                return Repeat(count: column.width + 2, repeatedValue: rowFence).joinWithSeparator("")
            #endif
        }), separator: cornerFence)
        let header = fence(columns.map({ " \($0.header.withPadding($0.width)) " }), separator: columnFence)
        #if swift(>=3)
            let values = columns.isEmpty ? "" : (0..<columns.first!.values.count).map({ rowIndex in
                fence(columns.map({ " \($0.values[rowIndex].withPadding($0.width)) " }), separator: columnFence)
            }).joined(separator: "\n")
            return [separator, header, separator, values, separator].joined(separator: "\n")
        #else
            let values = columns.isEmpty ? "" : (0..<columns.first!.values.count).map({ rowIndex in
                fence(columns.map({ " \($0.values[rowIndex].withPadding($0.width)) " }), separator: columnFence)
            }).joinWithSeparator("\n")
            return [separator, header, separator, values, separator].joinWithSeparator("\n")
        #endif
    }
}
