CodableCSV is a multi-platform Swift package for parsing/writing CSV files providing:
- Imperative row-by-row and field-by-field CSV reader/writer.
- Declarative encoding/decoding through Swift's Codable adoption.
- Support for multiple inputs/outputs (Strings, Data, File handles, Foundation's Streams, etc.) and Byte Order Markers (BOM).
- Configurable row/field delimiters, escaping scalars, headers, and trim sets.
- Configurable buffers supporting huge files (iteratively loading them in memory if necessary).
We just released 0.5.2 finally reaching full Codable adoption. Meaning, you can use
CSVEncoder and request keyed or unkeyed container to iterate through a CSV file's rows or to iterate through the files within a row.
let decoder = CSVDecoder() let result = try decoder.decode([Student].self, from: URL("~/Desktop/Students.csv")
Usage and configuration values mimics Foundation's JSON & PLIST strategies including some more such as
decimalStrategy (to encode/decode
Decimal types from/to