CSVCoding

2.0.0

CSV Coding support for Swift
elegantchaos/CSVCoding

What's New

2.0

2022-09-02T15:13:43Z

Cleaned up header translation.
Made the use of header/heading more consistent, resulting in a very slight API change.

CSVEncoder

Very basic support for encoding an Swift object as CSV.

Usage

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. .

Decoding

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

Description

  • Swift Tools 5.3.0
View More Packages from this Author

Dependencies

Last updated: Tue Nov 08 2022 05:45:43 GMT-0500 (GMT-05:00)