Swiftpack.co - elegantchaos/CSVCoding as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by elegantchaos.
elegantchaos/CSVCoding v1.0.2
CSV Coding support for Swift
⭐️ 2
🕓 3 weeks ago
iOS macOS watchOS tvOS
.package(url: "https://github.com/elegantchaos/CSVCoding.git", from: "v1.0.2")


Very basic support for encoding an Swift object as CSV.


let encoder = CSVEncoder()
encoder.dateEncodingStragegy = .iso8601
let data = try! encoder.encode(rows: [MyCodableThing()])

You pass the encoder a list of codable objects.

This results in a data object which is a UTF-8 string.

Each line of the string contains a value for each property of the codable object.

By default the first line is a header, using the names of the properties. This can be disabled with encoder.headerEncodingStrategy = .none. .


Currently only encoding is supported. Simple decoding should be quite easy to add however, so please add an issue if you need it.


Stars: 2
Last commit: 3 weeks ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Release Notes

3 weeks ago

Added some rudimentary documentation.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics