Releases: skelpo/CSV
Releases · skelpo/CSV
1.1.2
1.1.1
With the current implementation, when encoding an array of dictionaries, the elements would not always be encoded in the same order, resulting in values ending up in the wrong column. The AsyncEncoder now tracks the column indexes so cells will always be in the correct column.
v1.1.0
Configurable CSV Structures
You can now pass in a Config
instance to the initializers for any of the Encoder/Decoder/Serializer/Parser types to define what characters are used for separating rows and as cell delimiters.
let config = Config(separator: "|", delimiter: "'")
let parser = SyncParser(config: config)
let csv = """
'first_name'|'last_name'
'Jonathan ''Jon'''|'Kernney'
"""
let data = parser.parse(Array(csv.utf8))
print(data) // ["first_name": ["Jonathan 'Jon'"], "last_name": ["Kerrney"]]
v1.0.1
We Must Escape
Quotes that are inside of cells and headers are now escaped, so your CSV isn't all broken when you serialize or encode data.
Oh, we also have a shiny new README!
v1.0.0
Streaming
let chunks: [[UInt8]] = // ...
var parser = Parser(onHeader: nil, onCell: { header, cell in
print(String(decoding: header, as: UTF8.self) + ":", String(decoding: cell, as: UTF8.self))
})
chunks.forEach { chunk in
parser.parse(chunk)
}
// Array<Dictionary<Title, Cell?>>
let data: [[UInt8]: [[UInt8]?]] = // ...
var serializer = Serializer(onRow: { row in
print(String(decoding: row, as: UTF8.self))
})
data.forEach { row in
serializer.serialize(row)
}