Latest 0.4.0
License MIT
Platforms ios 8.0



Use CodableCSV to enable JSON-like parsing using the Codable protocols in Swift.

Custom coding options

Custom coding options include that you can define the character separating values in one row, the delimiter separating rows from each other, as well as enclosures which ensure that values could potentially include the separator or delimiter characters (currently only support for separator available).


You can define your own sorting order for header titles using a CSVEncoder. Simply put in a (String, String) -> Bool closure defining a < (less than) relation.


You can put in your custom encoders and decoders for more complex data structures. For encoding custom nested types register a (C) -> String? closure in your CSVEncoder. For decoding register a (String) -> C? closure in your CSVDecoder. Use this for all types, which are not in the following list: Bool, Int8, Int16, Int32, Int64, Int, UInt8, UInt16, UInt32, UInt64, UInt, String.


struct Person: Codable {
    var name: String
    var age: Int

let person0 = Person(name: "Paul", age: 22)
let person1 = Person(name: "Peter", age: 34)

let encoded: Data = CSVEncoder().encode([person0, person1])

let decoded: [Person] = CSVDecoder().decode(Person.self, from: encoded)



CodableCSV is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'CodableCSV'


pauljohanneskraft, [email protected]


CodableCSV is available under the MIT license. See the LICENSE file for more info.

Latest podspec

    "name": "CodableCSV",
    "version": "0.4.0",
    "summary": "CodableCSV allows you to encode and decode CSV files using Codable model types.",
    "description": "'Encoding and decoding CSV files is really easy with CodableCSV. Just create Codable model types and parse the CSV files just like JSON or plists.'",
    "homepage": "",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    "authors": {
        "pauljohanneskraft": "[email protected]"
    "source": {
        "git": "",
        "tag": "0.4.0"
    "platforms": {
        "ios": "8.0"
    "swift_version": "4.0",
    "source_files": "CodableCSV/Classes/**/*"

Pin It on Pinterest

Share This