Skip to content

Releases: skelpo/CSV

1.1.2

20 Oct 12:51
e686bbb
Compare
Choose a tag to compare

Serializer will now properly handle serializing columns of different lengths instead of crashing.

1.1.1

11 Aug 22:05
05d10cb
Compare
Choose a tag to compare

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

20 May 16:54
8747b09
Compare
Choose a tag to compare

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

07 May 14:58
9ed6d6b
Compare
Choose a tag to compare

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

19 Apr 15:21
caad986
Compare
Choose a tag to compare

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)
}