diff --git a/CodableCSV.podspec b/CodableCSV.podspec index 06df990..742203d 100644 --- a/CodableCSV.podspec +++ b/CodableCSV.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'CodableCSV' - s.version = '0.5.4' + s.version = '0.5.5' s.summary = "Read and write CSV files row-by-row or through Swift's Codable interface." s.homepage = 'https://github.com/dehesa/CodableCSV' diff --git a/README.md b/README.md index 71b385d..120ec7b 100644 --- a/README.md +++ b/README.md @@ -13,9 +13,9 @@ - Imperative CSV reader/writer (row-by-row and/or field-by-field). - Declarative `Codable` encoder/decoder and lazy row decoder. -- Support multiple inputs/outputs: `String`s, `Data` blobs, and `URL`s. -- Support numerous string encodings and Byte Order Markers (BOM). -- Extensive configuration: delimiters, escaping scalar, trim strategy, presampling, codable strategies, etc. +- Support multiple inputs/outputs: `String`s, `Data` blobs, `URL`s, and `Stream`s (commonly used for `stdin`). +- Support numerous string encodings and [Byte Order Markers](https://en.wikipedia.org/wiki/Byte_order_mark) (BOM). +- Extensive configuration: delimiters, escaping scalar, trim strategy, codable strategies, presampling, etc. - [RFC4180](https://tools.ietf.org/html/rfc4180) compliant with default configuration and CRLF (`\r\n`) row delimiter. - Multiplatform support with no dependencies. @@ -39,7 +39,7 @@ You can choose to add the library through SPM or Cocoapods: let package = Package( /* Your package name, supported platforms, and generated products go here */ dependencies: [ - .package(url: "https://github.com/dehesa/CodableCSV.git", from: "0.5.4") + .package(url: "https://github.com/dehesa/CodableCSV.git", from: "0.5.5") ], targets: [ .target(name: /* Your target name here */, dependencies: ["CodableCSV"]) @@ -50,7 +50,7 @@ You can choose to add the library through SPM or Cocoapods: - [Cocoapods](https://cocoapods.org). ``` - pod 'CodableCSV', '~> 0.5.4' + pod 'CodableCSV', '~> 0.5.5' ```
@@ -76,7 +76,7 @@ The following types provide imperative control on how to read/write CSV data.CSVReader
.
-A `CSVReader` parses CSV data from a given input (`String`, or `Data`, or file) and returns CSV rows as a `String`s array. `CSVReader` can be used at a _high-level_, in which case it parses an input completely; or at a _low-level_, in which each row is decoded when requested.
+A `CSVReader` parses CSV data from a given input (`String`, `Data`, `URL`, or `InputStream`) and returns CSV rows as a `String`s array. `CSVReader` can be used at a _high-level_, in which case it parses an input completely; or at a _low-level_, in which each row is decoded when requested.
- Complete input parsing.
diff --git a/sources/declarative/decodable/Decoder.swift b/sources/declarative/decodable/Decoder.swift
index 07ca459..7cfd262 100644
--- a/sources/declarative/decodable/Decoder.swift
+++ b/sources/declarative/decodable/Decoder.swift
@@ -96,3 +96,11 @@ extension CSVDecoder {
return LazySequence(source: source)
}
}
+
+#if canImport(Combine)
+import Combine
+
+extension CSVDecoder: TopLevelDecoder {
+ public typealias Input = Data
+}
+#endif
diff --git a/sources/declarative/encodable/Encoder.swift b/sources/declarative/encodable/Encoder.swift
index b7d33ae..680ae66 100644
--- a/sources/declarative/encodable/Encoder.swift
+++ b/sources/declarative/encodable/Encoder.swift
@@ -62,3 +62,11 @@ extension CSVEncoder {
try sink.completeEncoding()
}
}
+
+#if canImport(Combine)
+import Combine
+
+extension CSVEncoder: TopLevelEncoder {
+ public typealias Output = Data
+}
+#endif
diff --git a/sources/imperative/reader/ReaderAPI.swift b/sources/imperative/reader/ReaderAPI.swift
index bd5e474..936b3e3 100644
--- a/sources/imperative/reader/ReaderAPI.swift
+++ b/sources/imperative/reader/ReaderAPI.swift
@@ -229,7 +229,7 @@ private extension CSVReader {
/// - parameter stream: The stream to be parsed.
/// - parameter configuration: Recipe detailing how to parse the CSV data (i.e. encoding, delimiters, etc.).
/// - throws: `CSVError