Merge pull request #5 from skelpo/develop

Version 1.0.0
This commit is contained in:
Caleb Kleveter 2019-04-19 10:14:46 -05:00 committed by GitHub
commit caad9866a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
113 changed files with 16948 additions and 1758 deletions

1
.gitignore vendored
View File

@ -2,3 +2,4 @@
/.build
/Packages
/*.xcodeproj
/build

View File

@ -1,61 +0,0 @@
{
"object": {
"pins": [
{
"package": "Core",
"repositoryURL": "https://github.com/vapor/core.git",
"state": {
"branch": null,
"revision": "eb876a758733166a4fb20f3f0a17b480c5ea563e",
"version": "3.4.3"
}
},
{
"package": "Crypto",
"repositoryURL": "https://github.com/vapor/crypto.git",
"state": {
"branch": null,
"revision": "5605334590affd4785a5839806b4504407e054ac",
"version": "3.3.0"
}
},
{
"package": "swift-nio",
"repositoryURL": "https://github.com/apple/swift-nio.git",
"state": {
"branch": null,
"revision": "5d8148c8b45dfb449276557f22120694567dd1d2",
"version": "1.9.5"
}
},
{
"package": "swift-nio-ssl",
"repositoryURL": "https://github.com/apple/swift-nio-ssl.git",
"state": {
"branch": null,
"revision": "8380fa29a2af784b067d8ee01c956626ca29f172",
"version": "1.3.1"
}
},
{
"package": "swift-nio-ssl-support",
"repositoryURL": "https://github.com/apple/swift-nio-ssl-support.git",
"state": {
"branch": null,
"revision": "c02eec4e0e6d351cd092938cf44195a8e669f555",
"version": "1.0.0"
}
},
{
"package": "swift-nio-zlib-support",
"repositoryURL": "https://github.com/apple/swift-nio-zlib-support.git",
"state": {
"branch": null,
"revision": "37760e9a52030bb9011972c5213c3350fa9d41fd",
"version": "1.0.0"
}
}
]
},
"version": 1
}

View File

@ -1,4 +1,4 @@
// swift-tools-version:4.0
// swift-tools-version:5.0
import PackageDescription
@ -7,12 +7,9 @@ let package = Package(
products: [
.library(name: "CSV", targets: ["CSV"]),
],
dependencies: [
.package(url: "https://github.com/vapor/core.git", from: "3.4.3"),
.package(url: "https://github.com/vapor/crypto.git", from: "3.3.0")
],
dependencies: [],
targets: [
.target(name: "CSV", dependencies: ["Bits", "Debugging", "Async", "Core"]),
.testTarget(name: "CSVTests", dependencies: ["CSV", "Random"]),
.target(name: "CSV", dependencies: []),
.testTarget(name: "CSVTests", dependencies: ["CSV"]),
]
)

View File

@ -1,28 +0,0 @@
import Foundation
import Async
extension Future where T == Data {
public func parseCSV() -> Future<[CSV.Column]> {
return self.map(to: [CSV.Column].self) { (data) in
return CSV.parse(data)
}
}
public func parseCSV() -> Future<[String: CSV.Column]> {
return self.map(to: [String: CSV.Column].self) { (data) in
return CSV.parse(data)
}
}
public func parseCSV() -> Future<[String: [String?]]> {
return self.map(to: [String: [String?]].self) { (data) in
return CSV.parse(data)
}
}
public func csvTo<T>(_ type: T.Type) -> Future<[T]> where T: Decodable {
return self.map(to: [T].self) { (data) in
return try _CSVDecoder.decode(T.self, from: data)
}
}
}

View File

@ -1,14 +0,0 @@
@_exported import Bits
import Foundation
public struct CSV {
public struct Column {
public let header: String
public var fields: [String?]
public init(header: String, fields: [String?]) {
self.header = header
self.fields = fields
}
}
}

View File

@ -1,114 +0,0 @@
import Foundation
extension CSV {
public static func parse(_ csv: Data) -> [String: [String?]] {
let data = Array(csv)
let end = data.endIndex
let estimatedRowCount = data.reduce(0) { $1 == .newLine ? $0 + 1 : $0 }
var columns: [(title: String, cells: [String?])] = []
var columnIndex = 0
var iterator = data.startIndex
var inQuotes = false
var cellStart = data.startIndex
var cellEnd = data.startIndex
header: while iterator < end {
let byte = data[iterator]
switch byte {
case .quote:
inQuotes = !inQuotes
cellEnd += 1
case .comma:
if inQuotes { cellEnd += 1; break }
var cell = Array(data[cellStart...cellEnd-1])
cell.removeAll { $0 == .quote }
guard let title = String(bytes: cell, encoding: .utf8) else { return [:] }
var cells: [String?] = []
cells.reserveCapacity(estimatedRowCount)
columns.append((title, cells))
cellStart = iterator + 1
cellEnd = iterator + 1
case .newLine, .carriageReturn:
if inQuotes { cellEnd += 1; break }
var cell = Array(data[cellStart...cellEnd-1])
cell.removeAll { $0 == .quote }
guard let title = String(bytes: cell, encoding: .utf8) else { return [:] }
var cells: [String?] = []
cells.reserveCapacity(estimatedRowCount)
columns.append((title, cells))
let increment = byte == .newLine ? 1 : 2
cellStart = iterator + increment
cellEnd = iterator + increment
iterator += increment
break header
default: cellEnd += 1
}
iterator += 1
}
while iterator < end {
let byte = data[iterator]
switch byte {
case .quote:
inQuotes = !inQuotes
cellEnd += 1
case .comma:
if inQuotes { cellEnd += 1; break }
var cell = Array(data[cellStart...cellEnd-1])
cell.removeAll { $0 == .quote }
columns[columnIndex].cells.append(cell.count > 0 ? String(bytes: cell, encoding: .utf8) : nil)
columnIndex += 1
cellStart = iterator + 1
cellEnd = iterator + 1
case .newLine, .carriageReturn:
if inQuotes { cellEnd += 1; break }
var cell = Array(data[cellStart...cellEnd-1])
cell.removeAll { $0 == .quote }
columns[columnIndex].cells.append(cell.count > 0 ? String(bytes: cell, encoding: .utf8) : nil)
columnIndex = 0
let increment = byte == .newLine ? 1 : 2
cellStart = iterator + increment
cellEnd = iterator + increment
iterator += increment
continue
default: cellEnd += 1
}
iterator += 1
}
if cellEnd > cellStart {
var cell = Array(data[cellStart...cellEnd-1])
cell.removeAll { $0 == .quote }
columns[columnIndex].cells.append(cell.count > 0 ? String(bytes: cell, encoding: .utf8) : nil)
}
return columns.reduce(into: [:]) { result, column in
result[column.title] = column.cells
}
}
public static func parse(_ data: Data) -> [String: Column] {
let elements: [String: [String?]] = self.parse(data)
return elements.reduce(into: [:]) { columns, element in
columns[element.key] = Column(header: element.key, fields: element.value)
}
}
public static func parse(_ data: Data) -> [Column] {
let elements: [String: [String?]] = self.parse(data)
return elements.reduce(into: []) { columns, element in
columns.append(Column(header: element.key, fields: element.value))
}
}
}

View File

@ -1,62 +0,0 @@
import Foundation
import Bits
extension Array where Element == CSV.Column {
func seralize() -> Data {
guard let count = self.first?.fields.count else {
return self.map { $0.header.data }.joined(separator: .comma)
}
var index = 0
var data: [Data] = [self.map { $0.header.data }.joined(separator: .comma)]
data.reserveCapacity((self.first?.fields.count ?? 0) + 1)
while index < count {
data.append(self.map { ($0.fields[index] ?? "").data }.joined(separator: .comma))
index += 1
}
return data.joined(separator: .newLine)
}
}
extension Dictionary where Key == String, Value == Array<String?> {
func seralize() -> Data {
guard let count = self.first?.value.count else {
return self.keys.map { $0.data }.joined(separator: .comma)
}
var index = 0
var data: [Data] = [self.keys.map { $0.data }.joined(separator: .comma)]
data.reserveCapacity((self.first?.value.count ?? 0) + 1)
while index < count {
data.append(self.values.map { ($0[index] ?? "").data }.joined(separator: .comma))
index += 1
}
return data.joined(separator: .newLine)
}
}
extension String {
var data: Data {
return Data(self.utf8)
}
}
extension Array where Element == Data {
func joined(separator: UInt8) -> Element {
let count = self.count
var data = Data()
var iterator = 0
while iterator < count {
if data.count > 0 { data.append(separator) }
data.append(contentsOf: self[iterator])
iterator += 1
}
return data
}
}

View File

@ -1,11 +1,266 @@
import Foundation
public final class CSVCoder {
public static func decode<T>(_ data: Data, to type: T.Type = T.self)throws -> [T] where T: Decodable {
return try _CSVDecoder.decode(T.self, from: data)
/// Encodes Swift types to CSV data.
///
/// This exampls shows how multiple instances of a `Person` type will be encoded
/// to CSV data. `Person` conforms to `Codable`, so it is compatible with both the
/// `CSVEndocder` and `CSVDecoder`.
///
/// ```
/// struct Person: Codable {
/// let firstName: String,
/// let lastName: String,
/// let age: Int
/// }
///
/// let people = [
/// Person(firstName: "Grace", lastName: "Hopper", age: 113),
/// Person(firstName: "Linus", lastName: "Torvold", age: 50)
/// ]
///
/// let data = try CSVEncoder().sync.encode(people)
/// print(String(decoding: data, as: UTF8.self))
///
/// /* Prints:
/// "firstName","lastName","age"
/// "Grace","Hopper","113"
/// "Linus","Torvold","50"
/// */
/// ```
public final class CSVEncoder {
/// The encoding options the use when encoding an object.
///
/// Currently, this decideds how `nil` and `bool` values should be handled.
public var encodingOptions: CSVCodingOptions
/// Creates a new `CSVEncoder` instance.
///
/// - Parameter encodingOptions: The encoding options the use when encoding an object.
public init(encodingOptions: CSVCodingOptions = .default) {
self.encodingOptions = encodingOptions
}
public static func encode<T>(_ objects: [T], boolEncoding: BoolEncodingStrategy = .toString, stringEncoding: String.Encoding = .utf32)throws -> Data where T: Encodable {
return try Data(_CSVEncoder.encode(objects, boolEncoding: boolEncoding, stringEncoding: stringEncoding))
/// Creates a `CSVSyncEncoder` using the registered encoding options.
///
/// This encoder is for if you have several objects that you want to encode at
/// a single time into a single document.
public var sync: CSVSyncEncoder {
return CSVSyncEncoder(encodingOptions: self.encodingOptions)
}
/// Creates a new `CSVAsyncEncoder` using the registered encoding options.
///
/// This encoder is for if you have multiple objects that will be encoded separately,
/// but into a single document.
///
/// - Parameter onRow: The closure that will be called when each object passed
/// into the encoder is encoded to a row.
/// - Returns: A `CSVAsyncEncoder` instance with the current encoder's encoding
/// options and the `onRow` closure as its callback.
public func async(_ onRow: @escaping ([UInt8]) -> ()) -> CSVAsyncEncoder {
return CSVAsyncEncoder(encodingOptions: self.encodingOptions, onRow: onRow)
}
}
/// The encoder for encoding multiple objects at once into a single CSV document.
///
/// You can get an instance of the `CSVSyncEncoder` with the `CSVEncoder.sync` property.
public final class CSVSyncEncoder {
internal var encodingOptions: CSVCodingOptions
internal init(encodingOptions: CSVCodingOptions) {
self.encodingOptions = encodingOptions
}
/// Encodes an array of encodable objects into a single CSV document.
///
/// - Parameter objects: The objects to encode to CSV rows.
/// - Returns: The data for the CSV document.
///
/// - Throws: Encoding errors that occur when encoding the given objects.
public func encode<T>(_ objects: [T])throws -> Data where T: Encodable {
var rows: [[UInt8]] = []
rows.reserveCapacity(objects.count)
let encoder = AsyncEncoder(encodingOptions: self.encodingOptions) { row in
rows.append(row)
}
try objects.forEach(encoder.encode)
return Data(rows.joined(separator: [10]))
}
}
/// An encoder for encoding multiple objects separately into a single CSV document.
///
/// You can get an instance of the `CSVAsyncEncoder` using the `CSVEncoder.async(_:)` method.
public final class CSVAsyncEncoder {
internal var encodingOptions: CSVCodingOptions
private var encoder: AsyncEncoder
internal init(encodingOptions: CSVCodingOptions, onRow: @escaping ([UInt8]) -> ()) {
self.encodingOptions = encodingOptions
self.encoder = AsyncEncoder(encodingOptions: encodingOptions, onRow: onRow)
}
/// Encodes an `Encodable` object into a row for a CSV document and passes it into
/// the `onRow` closure.
///
/// - Parameter object: The object to encode to a CSV row.
/// - Throws: Erros that occur when encoding the object passed in.
public func encode<T>(_ object: T)throws where T: Encodable {
try self.encoder.encode(object)
}
}
/// Decodes CSV document data to Swift types.
///
/// This example shows how a simple `Person` type will be decoded from a CSV document.
/// Person` conforms to `Codable`, so it is compatible with both the `CSVEndocder` and `CSVDecoder`.
///
/// ```
/// struct Person: Codable {
/// let firstName: String,
/// let lastName: String,
/// let age: Int
/// }
///
/// let csv = """
/// "firstName","lastName","age"
/// "Grace","Hopper","113"
/// "Linus","Torvold","50"
/// """
/// let data = Data(csv.utf8)
///
/// let people = try CSVDecoder.sync.decode(Person.self, from: data)
/// print(people.map { $0.firstName }) // Prints: `["Grace","Linus"]`
/// ```
public final class CSVDecoder {
/// The decoding options to use when decoding data to an object.
///
/// This is currently used to specify how `nil` and `Bool` values should be handled.
public var decodingOptions: CSVCodingOptions
/// Creates a new `CSVDecoder` instance.
///
/// - Parameter decodingOptions: The decoding options to use when decoding data to an object.
public init(decodingOptions: CSVCodingOptions = .default) {
self.decodingOptions = decodingOptions
}
/// Creates a `CSVSyncDecoder` with the registered encoding options.
///
/// This decoder is for if you have whole CSV document you want to decode at once.
public var sync: CSVSyncDecoder {
return CSVSyncDecoder(decodingOptions: self.decodingOptions)
}
/// Creates a `CSVAsyncDecoder` instance with the registered encoding options.
///
/// This decoder is for if you have separate chunks of the same CSV document that you will
/// be decoding at different times.
///
/// - Parameters:
/// - type: The `Decodable` type that the rows of the CSV document will be decoded to.
/// - length: The content length of the whole CSV document.
/// - onInstance: The closure that is called when an instance of `D` is decoded from the data passed in.
///
/// - Returns: A `CSVAsyncDecoder` instance with the current encoder's encoding options and the
/// `.onInstance` closure as its callback.
public func async<D>(for type: D.Type = D.self, length: Int, _ onInstance: @escaping (D) -> ()) -> CSVAsyncDecoder
where D: Decodable
{
return CSVAsyncDecoder(
decoding: D.self,
onInstance: onInstance,
length: length,
decodingOptions: self.decodingOptions
)
}
}
/// A decoder for decoding a single CSV document all at once.
///
/// You can get an instance of `CSVSyncDecoder` from the `CSVDecoder.sync` property.
public final class CSVSyncDecoder {
internal var decodingOptions: CSVCodingOptions
internal init(decodingOptions: CSVCodingOptions) {
self.decodingOptions = decodingOptions
}
/// Decodes a whole CSV document into an array of a specified `Decodable` type.
///
/// - Parameters:
/// - type: The `Decodable` type to decode the CSV rows to.
/// - data: The CSV data to decode.
/// - Returns: An array of `D` instances, decoded from the data passed in.
///
/// - Throws: Errors that occur during the decoding proccess.
public func decode<D>(_ type: D.Type = D.self, from data: Data)throws -> [D] where D: Decodable {
var result: [D] = []
result.reserveCapacity(data.lazy.split(separator: "\n").count)
let decoder = AsyncDecoder(decoding: type, path: [], decodingOptions: self.decodingOptions) { decoded in
guard let typed = decoded as? D else {
assertionFailure("Passed incompatible value into decoding completion callback")
return
}
result.append(typed)
}
try decoder.decode(Array(data), length: data.count)
return result
}
}
/// A decoder for decoding sections of a CSV document at different times.
///
/// You can get an instance of `CSVAsyncDecoder` from the `CSVDecoder.async(for:length_:)` method.
public final class CSVAsyncDecoder {
internal var length: Int
internal var decoding: Decodable.Type
internal var decodingOptions: CSVCodingOptions
private var rowDecoder: AsyncDecoder
internal init<D>(decoding: D.Type, onInstance: @escaping (D) -> (), length: Int, decodingOptions: CSVCodingOptions)
where D: Decodable
{
let callback = { (decoded: Decodable) in
guard let typed = decoded as? D else {
assertionFailure("Passed incompatible value into decoding completion callback")
return
}
onInstance(typed)
}
self.length = length
self.decoding = decoding
self.decodingOptions = decodingOptions
self.rowDecoder = AsyncDecoder(
decoding: D.self,
path: [],
decodingOptions: decodingOptions,
onInstance: callback
)
rowDecoder.onInstance = callback
}
/// Decodes a section of a CSV document to instances of the registered `Decodable` type.
///
/// When a whole row has been parsed from the data passed in, it is decoded and passed into
/// the `.onInstance` callback that is registered.
///
/// - Note: Each chunk of data passed in is assumed to come directly after the previous one
/// passed in. The chunks may not be passed in out of order.
///
/// - Parameter data: A section of the CSV document to decode.
/// - Throws: Errors that occur during the decoding process.
public func decode<C>(_ data: C)throws where C: Collection, C.Element == UInt8 {
try self.rowDecoder.decode(Array(data), length: self.length)
}
}

View File

@ -0,0 +1,127 @@
/// The options used for encoding/decoding certin types in the `CSVEncoder` and `CSVDecoder`.
public final class CSVCodingOptions {
/// The default coding options.
///
/// This option set uses `.string` for the `BoolCodingStrategy` and `.blank` for
/// the `NilCodingStrategy`. This means `Bool` will be represented the value's textual name
/// and `nil` will be an empty cell.
public static let `default` = CSVCodingOptions(boolCodingStrategy: .string, nilCodingStrategy: .blank)
/// The bool encoding/decoding strategy used for the encoder/decoder the option set is passed to.
public var boolCodingStrategy: BoolCodingStrategy
/// The nil encoding/decoding strategy used for the encoder/decoder the option set is passed to.
public var nilCodingStrategy: NilCodingStrategy
/// Creates a new `CSVCodingOptions` instance.
///
/// - Parameters:
/// - boolCodingStrategy: The bool encoding/decoding strategy used for the encoder/decoder the option set is passed to.
/// - nilCodingStrategy: The nil encoding/decoding strategy used for the encoder/decoder the option set is passed to.
public init(boolCodingStrategy: BoolCodingStrategy, nilCodingStrategy: NilCodingStrategy) {
self.boolCodingStrategy = boolCodingStrategy
self.nilCodingStrategy = nilCodingStrategy
}
}
/// The encoding/decodig strategies used on boolean values in a CSV document.
public enum BoolCodingStrategy: Hashable {
/// The bools are represented by their number counter part, `false` is `0` and `true` is `1`.
case integer
/// The bools are represented by their textual counter parts, `false` is `"false"` and `true` is `"true"`.
case string
/// The bools are checked against multiple different values when they are decoded.
/// They are encoded to their string values.
///
/// When decoding data with this strategy, the characters in the data are lowercased and it is then
/// checked against `true`, `yes`, `y`, `y`, and `1` for true and `false`, `no`, `f`, `n`, and `0` for false.
case fuzzy
/// A custom coding strategy with any given representations for the `true` and `false` values.
///
/// - Parameters:
/// - true: The value that `true` gets converted to, and that `true` is represented by in the CSV document.
/// - false: The value that `false` gets converted to, and that `false` is represented by in the CSV document.
case custom(`true`: [UInt8],`false`: [UInt8])
/// Converts a `Bool` value to the bytes the reporesent it, given the current strategy.
///
/// - Parameter bool: The `Bool` instance to get the bytes for.
/// - Returns: The bytes value for the bool passed in.
public func bytes(from bool: Bool) -> [UInt8] {
switch self {
case .integer: return bool ? "1" : "0"
case .string, .fuzzy: return bool ? "true" : "false"
case let .custom(`true`, `false`): return bool ? `true` : `false`
}
}
/// Attempts get a `Bool` value from given bytes using the current strategy.
///
/// - Parameter bytes: The bytes to chek against the expected value for the given strategy.
/// - Returns: The `Bool` value for the bytes passed in, or `nil` if no match is found.
public func bool(from bytes: [UInt8]) -> Bool? {
switch (self, bytes) {
case (.integer, ["0"]): return false
case (.integer, ["1"]): return true
case (.string, "false"): return false
case (.string, "true"): return true
case (let .custom(`true`, `false`), _):
switch bytes {
case `false`: return false
case `true`: return true
default: return nil
}
case (.fuzzy, _):
switch String(decoding: bytes, as: UTF8.self).lowercased() {
case "true", "yes", "t", "y", "1": return true
case "false", "no", "f", "n", "0": return false
default: return nil
}
default: return nil
}
}
}
/// The encoding/decoding strategies used for `nil` values in a CSV document.
public enum NilCodingStrategy: Hashable {
/// A `nil` value is represented by an empty cell.
case blank
/// A `nil` value is represented by `N/A` as a cell's contents.
case na
/// A `nil` value is represented by a custom set of bytes.
///
/// - Parameter bytes: The bytes that represent `nil` in the CSV document.
case custom(_ bytes: [UInt8])
/// Gets the bytes that represent `nil` with the current strategy.
///
/// - Returns: `nil`, represented by a byte array.
public func bytes() -> [UInt8] {
switch self {
case .na: return [78, 47, 65]
case .blank: return []
case let .custom(bytes): return bytes
}
}
/// Checks to see if a given array of bytes represents `nil` with the current strategy.
///
/// - Parameter bytes: The bytes to match against the current strategy.
/// - Returns: A `Bool` indicating whether the bytes passed in represent `nil` or not.
public func isNull(_ bytes: [UInt8]) -> Bool {
switch (self, bytes) {
case (.na, [78, 47, 65]): return true
case (.blank, []): return true
case (let .custom(expected), _): return expected == bytes
default: return false
}
}
}

View File

@ -0,0 +1,118 @@
import Foundation
extension Array where Element == UInt8 {
var int: Int? {
let count: Int = self.endIndex
var result: Int = 0
let direction: Int
var iterator: Int
if self.first == 45 {
iterator = self.startIndex + 1
direction = -1
} else {
iterator = self.startIndex
direction = 1
}
while iterator < count {
switch self[iterator] {
case 48: result = result &* 10
case 49: result = (result &* 10) &+ 1
case 50: result = (result &* 10) &+ 2
case 51: result = (result &* 10) &+ 3
case 52: result = (result &* 10) &+ 4
case 53: result = (result &* 10) &+ 5
case 54: result = (result &* 10) &+ 6
case 55: result = (result &* 10) &+ 7
case 56: result = (result &* 10) &+ 8
case 57: result = (result &* 10) &+ 9
case 44: break
default: return nil
}
iterator += 1
}
return result &* direction
}
var float: Float? {
let count: Int = self.endIndex
var result: Int = 0
var decimal: Float = 1
let direction: Int
var iterator: Int
if self.first == 45 {
iterator = self.startIndex + 1
direction = -1
} else {
iterator = self.startIndex
direction = 1
}
while iterator < count {
switch self[iterator] {
case 48: result = result &* 10
case 49: result = (result &* 10) &+ 1
case 50: result = (result &* 10) &+ 2
case 51: result = (result &* 10) &+ 3
case 52: result = (result &* 10) &+ 4
case 53: result = (result &* 10) &+ 5
case 54: result = (result &* 10) &+ 6
case 55: result = (result &* 10) &+ 7
case 56: result = (result &* 10) &+ 8
case 57: result = (result &* 10) &+ 9
case 46: decimal = pow(10, Float(count - 1 - iterator))
case 44: break
default: return nil
}
iterator += 1
}
return Float(result &* direction) / decimal
}
var double: Double? {
let count: Int = self.endIndex
var result: Int = 0
var decimal: Double = 1
let direction: Int
var iterator: Int
if self.first == 45 {
iterator = self.startIndex + 1
direction = -1
} else {
iterator = self.startIndex
direction = 1
}
while iterator < count {
switch self[iterator] {
case 48: result = result &* 10
case 49: result = (result &* 10) &+ 1
case 50: result = (result &* 10) &+ 2
case 51: result = (result &* 10) &+ 3
case 52: result = (result &* 10) &+ 4
case 53: result = (result &* 10) &+ 5
case 54: result = (result &* 10) &+ 6
case 55: result = (result &* 10) &+ 7
case 56: result = (result &* 10) &+ 8
case 57: result = (result &* 10) &+ 9
case 46: decimal = pow(10, Double(count - 1 - iterator))
case 44: break
default: return nil
}
iterator += 1
}
return Double(result &* direction) / decimal
}
}

View File

@ -0,0 +1,107 @@
internal final class AsyncDecoder: Decoder {
internal enum Storage {
case none
case singleValue([UInt8])
case keyedValues([String: [UInt8]])
}
var codingPath: [CodingKey]
var userInfo: [CodingUserInfoKey : Any]
var decoding: Decodable.Type
var handler: AsyncDecoderHandler
var decodingOptions: CSVCodingOptions
var onInstance: (Decodable)throws -> ()
var data: Storage
init(
decoding: Decodable.Type,
path: [CodingKey],
info: [CodingUserInfoKey : Any] = [:],
data: Storage = .none,
decodingOptions: CSVCodingOptions,
onInstance: @escaping (Decodable)throws -> ()
) {
self.codingPath = path
self.userInfo = info
self.decoding = decoding
self.handler = AsyncDecoderHandler { _ in return }
self.decodingOptions = decodingOptions
self.onInstance = onInstance
self.data = data
self.handler.onRow = { [unowned self] row in
self.data = .keyedValues(row)
let decoded = try self.decoding.init(from: self)
try self.onInstance(decoded)
self.data = .none
}
if self.userInfo[CodingUserInfoKey(rawValue: "decoder")!] == nil {
self.userInfo[CodingUserInfoKey(rawValue: "decoder")!] = "CSVDecoder(Async)"
}
}
func container<Key>(keyedBy type: Key.Type) throws -> KeyedDecodingContainer<Key> where Key : CodingKey {
guard case .keyedValues = self.data else {
throw DecodingError.dataCorrupted(.init(
codingPath: self.codingPath,
debugDescription: "Attempted to created keyed container with unkeyed data"
))
}
let container = try AsyncKeyedDecoder<Key>(path: self.codingPath, decoder: self)
return KeyedDecodingContainer(container)
}
func unkeyedContainer() throws -> UnkeyedDecodingContainer {
fatalError()
}
func singleValueContainer() throws -> SingleValueDecodingContainer {
guard case .singleValue = self.data else {
throw DecodingError.dataCorrupted(.init(
codingPath: self.codingPath,
debugDescription: "Attempted to create single value container with keyed data"
))
}
return try AsyncSingleValueDecoder(path: self.codingPath, decoder: self)
}
func decode(_ data: [UInt8], length: Int)throws {
try self.handler.parse(data, length: length).get()
}
}
internal final class AsyncDecoderHandler {
var parser: Parser
var currentRow: [String: [UInt8]]
var onRow: ([String: [UInt8]])throws -> ()
private var columnCount: Int
private var currentColumn: Int
init(onRow: @escaping ([String: [UInt8]])throws -> ()) {
self.parser = Parser()
self.currentRow = [:]
self.onRow = onRow
self.columnCount = 0
self.currentColumn = 0
self.parser.onHeader = { _ in self.columnCount += 1 }
self.parser.onCell = { header, cell in
self.currentRow[String(decoding: header, as: UTF8.self)] = cell
if self.currentColumn == (self.columnCount - 1) {
self.currentColumn = 0
try self.onRow(self.currentRow)
} else {
self.currentColumn += 1
}
}
}
func parse(_ bytes: [UInt8], length: Int) -> Result<Void, ErrorList> {
return self.parser.parse(bytes, length: length)
}
}

View File

@ -0,0 +1,139 @@
internal final class AsyncKeyedDecoder<K>: KeyedDecodingContainerProtocol where K: CodingKey {
internal var codingPath: [CodingKey]
internal var decoder: AsyncDecoder
private var data: [String: [UInt8]]
internal init(path: [CodingKey], decoder: AsyncDecoder)throws {
self.decoder = decoder
self.codingPath = path
guard case let .keyedValues(data) = decoder.data else {
throw DecodingError.dataCorrupted(.init(
codingPath: path,
debugDescription: "Keyed data required to create a created a keyed decoder"
))
}
self.data = data
}
public var allKeys: [K] {
return self.data.keys.compactMap(K.init)
}
private func bytes<T>(for key: K, type: T.Type)throws -> [UInt8] {
guard let bytes = self.data[key.stringValue] else {
throw DecodingError.valueNotFound(
T.self,
.init(codingPath: self.codingPath, debugDescription: "No value for key `\(key.stringValue)` found in row")
)
}
return bytes
}
public func contains(_ key: K) -> Bool {
return self.data.keys.contains(key.stringValue)
}
public func decodeNil(forKey key: K) throws -> Bool {
guard let bytes = self.data[key.stringValue] else { return true }
return self.decoder.decodingOptions.nilCodingStrategy.isNull(bytes)
}
public func decode(_ type: Bool.Type, forKey key: K) throws -> Bool {
let bytes = try self.bytes(for: key, type: Bool.self)
guard let bool = self.decoder.decodingOptions.boolCodingStrategy.bool(from: bytes) else {
throw DecodingError.typeMismatch(
Bool.self,
.init(codingPath: self.codingPath, debugDescription: """
Cannot get Bool from bytes `\(bytes)` using bool decoding strategy \
`\(self.decoder.decodingOptions.boolCodingStrategy)`
"""
)
)
}
return bool
}
public func decode(_ type: String.Type, forKey key: K) throws -> String {
let bytes = try self.bytes(for: key, type: type)
return String(decoding: bytes, as: UTF8.self)
}
public func decode(_ type: Double.Type, forKey key: K) throws -> Double {
let bytes = try self.bytes(for: key, type: type)
guard let double = bytes.double else {
throw DecodingError.typeMismatch(
Double.self,
.init(codingPath: self.codingPath, debugDescription: "Cannot convert bytes `\(bytes)` to type `Double`")
)
}
return double
}
public func decode(_ type: Float.Type, forKey key: K) throws -> Float {
let bytes = try self.bytes(for: key, type: type)
guard let float = bytes.float else {
throw DecodingError.typeMismatch(
Float.self,
.init(codingPath: self.codingPath, debugDescription: "Cannot convert bytes `\(bytes)` to type `Float`")
)
}
return float
}
public func decode(_ type: Int.Type, forKey key: K) throws -> Int {
let bytes = try self.bytes(for: key, type: type)
guard let int = bytes.int else {
throw DecodingError.typeMismatch(
Int.self,
.init(codingPath: self.codingPath, debugDescription: "Cannot convert bytes `\(bytes)` to type `Int`")
)
}
return int
}
public func decode<T>(_ type: T.Type, forKey key: K) throws -> T where T : Decodable {
let bytes = try self.bytes(for: key, type: type)
let decoder = AsyncDecoder(
decoding: self.decoder.decoding,
path: self.codingPath + [key],
data: .singleValue(bytes),
decodingOptions: self.decoder.decodingOptions,
onInstance: self.decoder.onInstance
)
let t = try T.init(from: decoder)
return t
}
public func nestedContainer<NestedKey>(keyedBy type: NestedKey.Type, forKey key: K)
throws -> KeyedDecodingContainer<NestedKey> where NestedKey : CodingKey
{
throw DecodingError.dataCorruptedError(
forKey: key,
in: self,
debugDescription: "CSV decoding does not support nested keyed decoders"
)
}
public func nestedUnkeyedContainer(forKey key: K) throws -> UnkeyedDecodingContainer {
throw DecodingError.dataCorruptedError(
forKey: key,
in: self,
debugDescription: "CSV decoding does not support nested unkeyed decoders"
)
}
public func superDecoder() throws -> Decoder {
return self.decoder
}
public func superDecoder(forKey key: K) throws -> Decoder {
return self.decoder
}
}

View File

@ -0,0 +1,82 @@
internal final class AsyncSingleValueDecoder: SingleValueDecodingContainer {
var codingPath: [CodingKey]
var decoder: AsyncDecoder
var bytes: [UInt8]
internal init(path: [CodingKey], decoder: AsyncDecoder)throws {
self.decoder = decoder
self.codingPath = path
guard case let .singleValue(bytes) = decoder.data else {
throw DecodingError.dataCorrupted(.init(
codingPath: path,
debugDescription: "Single value required to create a created a single value decoder"
))
}
self.bytes = bytes
}
func decodeNil() -> Bool {
return self.decoder.decodingOptions.nilCodingStrategy.isNull(self.bytes)
}
func decode(_ type: Bool.Type) throws -> Bool {
guard let bool = self.decoder.decodingOptions.boolCodingStrategy.bool(from: self.bytes) else {
throw DecodingError.typeMismatch(
Bool.self,
.init(codingPath: self.codingPath, debugDescription: "Cannot decode `Bool` from bytes `\(bytes)`")
)
}
return bool
}
func decode(_ type: String.Type) throws -> String {
return String(decoding: self.bytes, as: UTF8.self)
}
func decode(_ type: Double.Type) throws -> Double {
guard let double = self.bytes.double else {
throw DecodingError.typeMismatch(type, .init(
codingPath: self.codingPath,
debugDescription: "Cannot convert bytes `\(self.bytes)` to Double"
))
}
return double
}
func decode(_ type: Float.Type) throws -> Float {
guard let float = self.bytes.float else {
throw DecodingError.typeMismatch(type, .init(
codingPath: self.codingPath,
debugDescription: "Cannot convert bytes `\(self.bytes)` to Float"
))
}
return float
}
func decode(_ type: Int.Type) throws -> Int {
guard let int = self.bytes.int else {
throw DecodingError.typeMismatch(type, .init(
codingPath: self.codingPath,
debugDescription: "Cannot convert bytes `\(self.bytes)` to Int"
))
}
return int
}
func decode<T>(_ type: T.Type) throws -> T where T : Decodable {
let decoder = AsyncDecoder(
decoding: self.decoder.decoding,
path: self.codingPath,
data: .singleValue(self.bytes),
decodingOptions: self.decoder.decodingOptions,
onInstance: self.decoder.onInstance
)
let t = try T.init(from: decoder)
return t
}
}

View File

@ -1,118 +0,0 @@
import Foundation
extension Array where Element == UInt8 {
var int: Int? {
let count: Int = self.endIndex
var result: Int = 0
let direction: Int
var iterator: Int
if self.first == .hyphen {
iterator = self.startIndex + 1
direction = -1
} else {
iterator = self.startIndex
direction = 1
}
while iterator < count {
switch self[iterator] {
case .zero: result = result &* 10
case .one: result = (result &* 10) &+ 1
case .two: result = (result &* 10) &+ 2
case .three: result = (result &* 10) &+ 3
case .four: result = (result &* 10) &+ 4
case .five: result = (result &* 10) &+ 5
case .six: result = (result &* 10) &+ 6
case .seven: result = (result &* 10) &+ 7
case .eight: result = (result &* 10) &+ 8
case .nine: result = (result &* 10) &+ 9
case .comma: break
default: return nil
}
iterator += 1
}
return result &* direction
}
var float: Float? {
let count: Int = self.endIndex
var result: Int = 0
var decimal: Float = 1
let direction: Int
var iterator: Int
if self.first == .hyphen {
iterator = self.startIndex + 1
direction = -1
} else {
iterator = self.startIndex
direction = 1
}
while iterator < count {
switch self[iterator] {
case .zero: result = result &* 10
case .one: result = (result &* 10) &+ 1
case .two: result = (result &* 10) &+ 2
case .three: result = (result &* 10) &+ 3
case .four: result = (result &* 10) &+ 4
case .five: result = (result &* 10) &+ 5
case .six: result = (result &* 10) &+ 6
case .seven: result = (result &* 10) &+ 7
case .eight: result = (result &* 10) &+ 8
case .nine: result = (result &* 10) &+ 9
case .period: decimal = pow(10, Float(count - 1 - iterator))
case .comma: break
default: return nil
}
iterator += 1
}
return Float(result &* direction) / decimal
}
var double: Double? {
let count: Int = self.endIndex
var result: Int = 0
var decimal: Double = 1
let direction: Int
var iterator: Int
if self.first == .hyphen {
iterator = self.startIndex + 1
direction = -1
} else {
iterator = self.startIndex
direction = 1
}
while iterator < count {
switch self[iterator] {
case .zero: result = result &* 10
case .one: result = (result &* 10) &+ 1
case .two: result = (result &* 10) &+ 2
case .three: result = (result &* 10) &+ 3
case .four: result = (result &* 10) &+ 4
case .five: result = (result &* 10) &+ 5
case .six: result = (result &* 10) &+ 6
case .seven: result = (result &* 10) &+ 7
case .eight: result = (result &* 10) &+ 8
case .nine: result = (result &* 10) &+ 9
case .period: decimal = pow(10, Double(count - 1 - iterator))
case .comma: break
default: return nil
}
iterator += 1
}
return Double(result &* direction) / decimal
}
}

View File

@ -1,105 +0,0 @@
import Foundation
import Bits
final class DecoderDataContainer {
var allKeys: [CodingKey]?
let data: [UInt8]
private(set) var row: [String: Bytes]!
private(set) var cell: Bytes?
private(set) var header: [String]
private var dataIndex: Int
init(data: [UInt8])throws {
self.allKeys = nil
self.row = [:]
self.cell = nil
self.data = data
self.header = []
self.dataIndex = data.startIndex
try self.configure()
}
private func configure()throws {
self.header.reserveCapacity(self.data.lazy.split(separator: .newLine).first?.reduce(0) { $1 == .comma ? $0 + 1 : $0 } ?? 0)
var cellStart = self.dataIndex
var cellEnd = self.dataIndex
var inQuote: Bool = false
header: while self.dataIndex < data.endIndex {
let byte = data[self.dataIndex]
switch byte {
case .quote:
inQuote = !inQuote
cellEnd += 1
case .comma:
if inQuote { fallthrough }
var cell = Array(self.data[cellStart...cellEnd-1])
cell.removeAll { $0 == .quote }
try self.header.append(String(cell))
cellStart = self.dataIndex + 1
cellEnd = self.dataIndex + 1
case .newLine, .carriageReturn:
if inQuote { fallthrough }
var cell = Array(self.data[cellStart...cellEnd-1])
cell.removeAll { $0 == .quote }
try self.header.append(String(cell))
self.dataIndex = byte == .newLine ? self.dataIndex + 1 : self.dataIndex + 2
break header
default: cellEnd += 1
}
self.dataIndex += 1
}
self.row.reserveCapacity(self.header.count)
}
func cell(for key: CodingKey) {
self.cell = row[key.stringValue]
}
func incremetRow() {
guard self.dataIndex < data.endIndex else {
self.row = nil
return
}
var cellStart = self.dataIndex
var cellEnd = self.dataIndex
var inQuote: Bool = false
var columnIndex: Int = 0
while self.dataIndex < data.endIndex {
let byte = data[self.dataIndex]
switch byte {
case .quote:
inQuote = !inQuote
cellEnd += 1
case .comma:
if inQuote { fallthrough }
var cell = Array(self.data[cellStart...cellEnd-1])
cell.removeAll { $0 == .quote }
self.row[header[columnIndex]] = cell
cellStart = self.dataIndex + 1
cellEnd = self.dataIndex + 1
columnIndex += 1
case .newLine, .carriageReturn:
if inQuote { fallthrough }
var cell = Array(self.data[cellStart...cellEnd-1])
cell.removeAll { $0 == .quote }
self.row[header[columnIndex]] = cell
self.dataIndex = byte == .newLine ? self.dataIndex + 1 : self.dataIndex + 2
return
default: cellEnd += 1
}
self.dataIndex += 1
}
}
}

View File

@ -1,23 +0,0 @@
extension DecodingError {
static func unableToExtract<T>(type: T.Type, at path: CodingPath) -> DecodingError {
return DecodingError.typeMismatch(type, Context(codingPath: path, debugDescription: "Unable to extract type '\(type)' from string"))
}
static func badKey(_ key: CodingKey, at path: CodingPath) -> DecodingError {
return DecodingError.keyNotFound(key, Context(codingPath: path, debugDescription: "Could not find column '\(key.stringValue)' in CSV"))
}
static func nilKey<T>(_ key: CodingKey, type: T.Type, at path: CodingPath) -> DecodingError {
return DecodingError.valueNotFound(type, Context(codingPath: path, debugDescription: "Cell in column \(key.stringValue) not populated"))
}
static func nilValue<T>(type: T.Type, at path: CodingPath) -> DecodingError {
let column = path.map { $0.stringValue }.joined(separator: ".")
return DecodingError.valueNotFound(type, Context(codingPath: path, debugDescription: "Cell in column '\(column)' not populated"))
}
static func dataToStringFailed(path: CodingPath, encoding: String.Encoding) -> DecodingError {
let column = path.map { $0.stringValue }.joined(separator: ".")
return DecodingError.dataCorrupted(DecodingError.Context(codingPath: path, debugDescription: "Unable to convert data to string with \(encoding) encoding at \(column)"))
}
}

View File

@ -1,43 +0,0 @@
import Foundation
public typealias CodingPath = [CodingKey]
final class _CSVDecoder: Decoder {
let userInfo: [CodingUserInfoKey : Any]
var codingPath: [CodingKey]
let container: DecoderDataContainer
init(csv: [UInt8], path: CodingPath = [], info: [CodingUserInfoKey : Any] = [:])throws {
self.codingPath = path
self.userInfo = info
self.container = try DecoderDataContainer(data: csv)
}
func container<Key>(keyedBy type: Key.Type) throws -> KeyedDecodingContainer<Key> where Key : CodingKey {
guard self.container.row != nil else {
throw DecodingError.typeMismatch(
[String: String?].self,
DecodingError.Context(
codingPath: self.codingPath,
debugDescription: "Cannot get CSV row as expected format '[String: String?]'"
)
)
}
let container = _CSVKeyedDecoder<Key>(decoder: self)
return KeyedDecodingContainer(container)
}
func unkeyedContainer() throws -> UnkeyedDecodingContainer {
return _CSVUnkeyedDecoder(decoder: self, path: self.codingPath)
}
func singleValueContainer() throws -> SingleValueDecodingContainer {
return _CSVSingleValueDecoder(decoder: self)
}
static func decode<T>(_ type: T.Type, from data: Data)throws -> [T] where T: Decodable {
let decoder = try _CSVDecoder(csv: Array(data))
return try Array<T>(from: decoder)
}
}

View File

@ -1,89 +0,0 @@
import Foundation
final class _CSVKeyedDecoder<K>: KeyedDecodingContainerProtocol where K: CodingKey {
let codingPath: [CodingKey]
let allKeys: [K]
let decoder: _CSVDecoder
init(decoder: _CSVDecoder) {
self.codingPath = []
self.decoder = decoder
if let allKeys = decoder.container.allKeys as? [K] {
self.allKeys = allKeys
} else {
let keys = Array(decoder.container.row.keys).compactMap(K.init)
self.allKeys = keys
self.decoder.container.allKeys = keys
}
}
func contains(_ key: K) -> Bool {
return self.decoder.container.row[key.stringValue] != nil
}
func decodeNil(forKey key: K) throws -> Bool {
let cell = self.decoder.container.row[key.stringValue]
return cell == nil || cell == [.N, .forwardSlash, .A] || cell == [.N, .A]
}
func decode(_ type: Bool.Type, forKey key: K) throws -> Bool {
let cell = try self.decoder.container.row.value(for: key)
let value = try String(cell).lowercased()
switch value {
case "true", "yes", "t", "y", "1": return true
case "false", "no", "f", "n", "0": return false
default: throw DecodingError.unableToExtract(type: type, at: self.codingPath + [key])
}
}
func decode(_ type: String.Type, forKey key: K) throws -> String {
let cell = try self.decoder.container.row.value(for: key)
return try String(cell)
}
func decode(_ type: Double.Type, forKey key: K) throws -> Double {
let value = try self.decoder.container.row.value(for: key)
guard let double = value.double else { throw DecodingError.unableToExtract(type: type, at: self.codingPath + [key]) }
return double
}
func decode(_ type: Float.Type, forKey key: K) throws -> Float {
let value = try self.decoder.container.row.value(for: key)
guard let float = value.float else { throw DecodingError.unableToExtract(type: type, at: self.codingPath + [key]) }
return float
}
func decode(_ type: Int.Type, forKey key: K) throws -> Int {
let value = try self.decoder.container.row.value(for: key)
guard let int = value.int else { throw DecodingError.unableToExtract(type: type, at: self.codingPath + [key]) }
return int
}
func decode<T>(_ type: T.Type, forKey key: K) throws -> T where T : Decodable {
defer { _ = self.decoder.codingPath.removeLast() }
self.decoder.container.cell(for: key)
self.decoder.codingPath += [key]
return try T(from: self.decoder)
}
func nestedContainer<NestedKey>(keyedBy type: NestedKey.Type, forKey key: K) throws -> KeyedDecodingContainer<NestedKey> where NestedKey : CodingKey {
let column = codingPath.map { $0.stringValue }.joined(separator: ".")
throw DecodingError.dataCorruptedError(forKey: key, in: self, debugDescription: "Found nested data in a cell in column '\(column)'")
}
func nestedUnkeyedContainer(forKey key: K) throws -> UnkeyedDecodingContainer {
let column = codingPath.map { $0.stringValue }.joined(separator: ".")
throw DecodingError.dataCorruptedError(forKey: key, in: self, debugDescription: "Found nested data in a cell in column '\(column)'")
}
func superDecoder() throws -> Decoder {
let key = K(stringValue: "super")!
throw DecodingError.keyNotFound(key, DecodingError.Context(codingPath: self.codingPath + [key], debugDescription: "Cannot create super decoder for CSV structure"))
}
func superDecoder(forKey key: K) throws -> Decoder {
throw DecodingError.keyNotFound(key, DecodingError.Context(codingPath: self.codingPath + [key], debugDescription: "Cannot create super decoder for CSV structure"))
}
}

View File

@ -1,53 +0,0 @@
import Foundation
final class _CSVSingleValueDecoder: SingleValueDecodingContainer {
let codingPath: [CodingKey]
let decoder: _CSVDecoder
init(decoder: _CSVDecoder) {
self.codingPath = decoder.codingPath
self.decoder = decoder
}
func decodeNil() -> Bool {
return decoder.container.cell == nil || decoder.container.cell == [.N, .forwardSlash, .A] || decoder.container.cell == [.N, .A]
}
func decode(_ type: Bool.Type) throws -> Bool {
guard let cell = self.decoder.container.cell else { throw DecodingError.nilValue(type: type, at: self.codingPath) }
let value = try String(cell).lowercased()
switch value {
case "true", "yes", "t", "y", "1": return true
case "false", "no", "f", "n", "0": return false
default: throw DecodingError.unableToExtract(type: type, at: self.codingPath)
}
}
func decode(_ type: String.Type) throws -> String {
guard let cell = self.decoder.container.cell else { throw DecodingError.nilValue(type: type, at: self.codingPath) }
return try String(cell)
}
func decode(_ type: Double.Type) throws -> Double {
guard let cell = self.decoder.container.cell else { throw DecodingError.nilValue(type: type, at: self.codingPath) }
guard let double = cell.double else { throw DecodingError.unableToExtract(type: type, at: self.codingPath) }
return double
}
func decode(_ type: Float.Type) throws -> Float {
guard let cell = self.decoder.container.cell else { throw DecodingError.nilValue(type: type, at: self.codingPath) }
guard let float = cell.float else { throw DecodingError.unableToExtract(type: type, at: self.codingPath) }
return float
}
func decode(_ type: Int.Type) throws -> Int {
guard let cell = self.decoder.container.cell else { throw DecodingError.nilValue(type: type, at: self.codingPath) }
guard let int = cell.int else { throw DecodingError.unableToExtract(type: type, at: self.codingPath) }
return int
}
func decode<T>(_ type: T.Type) throws -> T where T : Decodable {
let column = codingPath.map { $0.stringValue }.joined(separator: ".")
throw DecodingError.dataCorruptedError(in: self, debugDescription: "Found nested data in a cell in column '\(column)'")
}
}

View File

@ -1,68 +0,0 @@
import Foundation
import Core
final class _CSVUnkeyedDecoder: UnkeyedDecodingContainer {
let codingPath: [CodingKey]
let count: Int?
var currentIndex: Int
let decoder: _CSVDecoder
init(decoder: _CSVDecoder, path: CodingPath = []) {
self.codingPath = path
self.count = nil
self.currentIndex = 0
self.decoder = decoder
self.decoder.container.incremetRow()
}
var isAtEnd: Bool {
return self.decoder.container.row == nil
}
func error<T>(for type: T.Type) -> Error {
return DecodingError.typeMismatch(type, DecodingError.Context(codingPath: self.codingPath, debugDescription: "Cannot get \(T.self) value from string array"))
}
func decodeNil() throws -> Bool {
return false
}
func decode(_ type: Bool.Type) throws -> Bool { throw self.error(for: type) }
func decode(_ type: String.Type) throws -> String { throw self.error(for: type) }
func decode(_ type: Double.Type) throws -> Double { throw self.error(for: type) }
func decode(_ type: Float.Type) throws -> Float { throw self.error(for: type) }
func decode(_ type: Int.Type) throws -> Int { throw self.error(for: type) }
func decode<T>(_ type: T.Type) throws -> T where T : Decodable {
defer {
self.currentIndex += 1
self.decoder.container.incremetRow()
}
return try T(from: self.decoder)
}
func nestedContainer<NestedKey>(keyedBy type: NestedKey.Type) throws -> KeyedDecodingContainer<NestedKey> where NestedKey : CodingKey {
throw DecodingError.valueNotFound(
KeyedDecodingContainer<NestedKey>.self,
DecodingError.Context(
codingPath: self.codingPath,
debugDescription: "Cannot create nested container from CSV Unkeyed Container"
)
)
}
func nestedUnkeyedContainer() throws -> UnkeyedDecodingContainer {
throw DecodingError.valueNotFound(
UnkeyedDecodingContainer.self,
DecodingError.Context(
codingPath: self.codingPath,
debugDescription: "Cannot create nested unkeyed container from CSV Unkeyed Container"
)
)
}
func superDecoder() throws -> Decoder {
throw DecodingError.valueNotFound(Decoder.self, DecodingError.Context(codingPath: self.codingPath, debugDescription: "Cannot create super decoder from CSV Unkeyed Decoder"))
}
}

View File

@ -0,0 +1,71 @@
import Foundation
final class AsyncEncoder: Encoder {
let codingPath: [CodingKey]
let userInfo: [CodingUserInfoKey : Any]
let container: DataContainer
let encodingOptions: CSVCodingOptions
let onRow: ([UInt8]) -> ()
init(
path: [CodingKey] = [],
info: [CodingUserInfoKey : Any] = [:],
encodingOptions: CSVCodingOptions,
onRow: @escaping ([UInt8]) -> ()
) {
self.codingPath = path
self.userInfo = info
self.container = DataContainer(section: .header)
self.encodingOptions = encodingOptions
self.onRow = onRow
}
func container<Key>(keyedBy type: Key.Type) -> KeyedEncodingContainer<Key> where Key : CodingKey {
let container = AsyncKeyedEncoder<Key>(path: self.codingPath, encoder: self)
return KeyedEncodingContainer(container)
}
func unkeyedContainer() -> UnkeyedEncodingContainer {
return AsyncUnkeyedEncoder(encoder: self)
}
func singleValueContainer() -> SingleValueEncodingContainer {
return AsyncSingleValueEncoder(path: self.codingPath, encoder: self)
}
func encode<T>(
_ object: T
)throws where T: Encodable {
switch self.container.section {
case .header:
try object.encode(to: self)
self.onRow(Array(self.container.cells.joined(separator: [44])))
self.container.section = .row
self.container.rowCount += 1
self.container.cells = []
fallthrough
case .row:
try object.encode(to: self)
self.onRow(Array(self.container.cells.joined(separator: [44])))
self.container.rowCount += 1
self.container.cells = []
}
}
enum EncodingSection {
case header
case row
}
final class DataContainer {
var cells: [[UInt8]]
var section: EncodingSection
var rowCount: Int
init(cells: [[UInt8]] = [], section: EncodingSection = .row) {
self.cells = cells
self.section = section
self.rowCount = 0
}
}
}

View File

@ -0,0 +1,83 @@
import Foundation
final class AsyncKeyedEncoder<K>: KeyedEncodingContainerProtocol where K: CodingKey {
var codingPath: [CodingKey]
var encoder: AsyncEncoder
init(path: [CodingKey], encoder: AsyncEncoder) {
self.codingPath = path
self.encoder = encoder
}
func _encode(_ value: [UInt8], for key: K) {
switch self.encoder.container.section {
case .header:
let bytes = Array([[34], key.stringValue.bytes, [34]].joined())
self.encoder.container.cells.append(bytes)
case .row:
let bytes = Array([[34], value, [34]].joined())
self.encoder.container.cells.append(bytes)
}
}
func _encode(_ value: [UInt8]?, for key: K)throws {
if let value = value {
self._encode(value, for: key)
} else {
try self.encodeNil(forKey: key)
}
}
func encodeNil(forKey key: K) throws {
let value = self.encoder.encodingOptions.nilCodingStrategy.bytes()
self._encode(value, for: key)
}
func encode(_ value: Bool, forKey key: K) throws {
let value = self.encoder.encodingOptions.boolCodingStrategy.bytes(from: value)
self._encode(value, for: key)
}
func encode(_ value: Double, forKey key: K) throws { self._encode(value.bytes, for: key) }
func encode(_ value: Float, forKey key: K) throws { self._encode(value.bytes, for: key) }
func encode(_ value: Int, forKey key: K) throws { self._encode(value.bytes, for: key) }
func encode(_ value: String, forKey key: K) throws { self._encode(value.bytes, for: key) }
func encode<T>(_ value: T, forKey key: K) throws where T : Encodable {
let encoder = AsyncEncoder(encodingOptions: self.encoder.encodingOptions, onRow: self.encoder.onRow)
try value.encode(to: encoder)
self._encode(encoder.container.cells[0], for: key)
}
func encodeIfPresent(_ value: Bool?, forKey key: K) throws {
let value = value.map(self.encoder.encodingOptions.boolCodingStrategy.bytes(from:))
try self._encode(value, for: key)
}
func encodeIfPresent(_ value: Double?, forKey key: K) throws { try self._encode(value?.bytes, for: key) }
func encodeIfPresent(_ value: Float?, forKey key: K) throws { try self._encode(value?.bytes, for: key) }
func encodeIfPresent(_ value: Int?, forKey key: K) throws { try self._encode(value?.bytes, for: key) }
func encodeIfPresent(_ value: String?, forKey key: K) throws { try self._encode(value?.bytes, for: key) }
func encodeIfPresent<T>(_ value: T?, forKey key: K) throws where T : Encodable {
if let value = value {
try self.encode(value, forKey: key)
} else {
try self.encodeNil(forKey: key)
}
}
func nestedContainer<NestedKey>(keyedBy keyType: NestedKey.Type, forKey key: K) -> KeyedEncodingContainer<NestedKey>
where NestedKey : CodingKey
{
let container = AsyncKeyedEncoder<NestedKey>(path: self.codingPath + [key], encoder: self.encoder)
return KeyedEncodingContainer(container)
}
func nestedUnkeyedContainer(forKey key: K) -> UnkeyedEncodingContainer {
return AsyncUnkeyedEncoder(encoder: self.encoder)
}
func superEncoder() -> Encoder {
return self.encoder
}
func superEncoder(forKey key: K) -> Encoder {
return encoder
}
}

View File

@ -0,0 +1,32 @@
import Foundation
final class AsyncSingleValueEncoder: SingleValueEncodingContainer {
let codingPath: [CodingKey]
let encoder: AsyncEncoder
init(path: [CodingKey], encoder: AsyncEncoder) {
self.codingPath = path
self.encoder = encoder
}
func encodeNil() throws {
let value = self.encoder.encodingOptions.nilCodingStrategy.bytes()
self.encoder.container.cells.append(value)
}
func encode(_ value: Bool) throws {
let value = self.encoder.encodingOptions.boolCodingStrategy.bytes(from: value)
self.encoder.container.cells.append(value)
}
func encode(_ value: String) throws { self.encoder.container.cells.append(value.bytes) }
func encode(_ value: Double) throws { self.encoder.container.cells.append(value.bytes) }
func encode(_ value: Float) throws { self.encoder.container.cells.append(value.bytes) }
func encode(_ value: Int) throws { self.encoder.container.cells.append(value.bytes) }
func encode<T>(_ value: T) throws where T : Encodable {
let column = self.codingPath.map { $0.stringValue }.joined(separator: ".")
throw EncodingError.invalidValue(value, EncodingError.Context(
codingPath: self.codingPath,
debugDescription: "Cannot encode nested data into cell in column '\(column)'"
))
}
}

View File

@ -0,0 +1,45 @@
import Foundation
final class AsyncUnkeyedEncoder: UnkeyedEncodingContainer {
var codingPath: [CodingKey]
var encoder: AsyncEncoder
init(encoder: AsyncEncoder) {
self.encoder = encoder
self.codingPath = []
}
var count: Int {
return 0
}
func fail(with value: Any) -> Error {
return EncodingError.invalidValue(value, EncodingError.Context(
codingPath: [],
debugDescription: "Cannot use CSV decoder to decode array values"
))
}
func encodeNil() throws { throw self.fail(with: Optional<Any>.none as Any) }
func encode(_ value: Bool) throws { throw self.fail(with: value) }
func encode(_ value: String) throws { throw self.fail(with: value) }
func encode(_ value: Double) throws { throw self.fail(with: value) }
func encode(_ value: Float) throws { throw self.fail(with: value) }
func encode(_ value: Int) throws { throw self.fail(with: value) }
func encode<T>(_ value: T) throws where T : Encodable { throw self.fail(with: value) }
func nestedContainer<NestedKey>(keyedBy keyType: NestedKey.Type) -> KeyedEncodingContainer<NestedKey>
where NestedKey : CodingKey
{
let container = AsyncKeyedEncoder<NestedKey>(path: self.codingPath, encoder: self.encoder)
return KeyedEncodingContainer(container)
}
func nestedUnkeyedContainer() -> UnkeyedEncodingContainer {
return AsyncUnkeyedEncoder(encoder: self.encoder)
}
func superEncoder() -> Encoder {
return encoder
}
}

View File

@ -1,16 +0,0 @@
import Foundation
import Bits
public enum BoolEncodingStrategy {
case toInteger
case toString
case custom(`true`:Bytes,`false`:Bytes)
public func convert(_ bool: Bool) -> Bytes {
switch self {
case .toInteger: return bool ? [.one] : [.zero]
case .toString: return bool ? [.t, .r, .u, .e] : [.f, .a, .l, .s, .e]
case let .custom(`true`, `false`): return bool ? `true` : `false`
}
}
}

View File

@ -1,11 +0,0 @@
extension EncodingError {
static func unableToConvert<T>(value: T, at path: CodingPath, encoding: String.Encoding = .utf8) -> EncodingError {
return EncodingError.invalidValue(
value,
EncodingError.Context(
codingPath: path,
debugDescription: "Cannot convert \(T.self) value to data using \(encoding) encoding"
)
)
}
}

View File

@ -1,52 +0,0 @@
import Foundation
final class _CSVEncoder: Encoder {
let codingPath: [CodingKey]
let userInfo: [CodingUserInfoKey : Any]
let container: DataContainer
let boolEncoding: BoolEncodingStrategy
let stringEncoding: String.Encoding
init(
container: DataContainer,
path: CodingPath = [],
info: [CodingUserInfoKey : Any] = [:],
boolEncoding: BoolEncodingStrategy = .toString,
stringEncoding: String.Encoding = .utf8
) {
self.codingPath = path
self.userInfo = info
self.container = container
self.boolEncoding = boolEncoding
self.stringEncoding = stringEncoding
}
func container<Key>(keyedBy type: Key.Type) -> KeyedEncodingContainer<Key> where Key : CodingKey {
let container = _CSVKeyedEncoder<Key>(container: self.container, path: self.codingPath, boolEncoding: self.boolEncoding, stringEncoding: self.stringEncoding)
return KeyedEncodingContainer(container)
}
func unkeyedContainer() -> UnkeyedEncodingContainer {
return _CSVUnkeyedEncoder(container: self.container, path: self.codingPath, boolEncoding: self.boolEncoding, stringEncoding: self.stringEncoding)
}
func singleValueContainer() -> SingleValueEncodingContainer {
return _CSVSingleValueEncoder(container: self.container, path: self.codingPath, boolEncoding: self.boolEncoding, stringEncoding: self.stringEncoding)
}
static func encode<T>(_ objects: [T], boolEncoding: BoolEncodingStrategy, stringEncoding: String.Encoding)throws -> Bytes where T: Encodable {
let encoder = _CSVEncoder(container: DataContainer(), boolEncoding: boolEncoding, stringEncoding: stringEncoding)
try objects.encode(to: encoder)
return encoder.container.data
}
}
final class DataContainer {
var data: Bytes
var titlesCreated: Bool
init(data: Bytes = [], titles: Bool = false) {
self.data = data
self.titlesCreated = titles
}
}

View File

@ -1,58 +0,0 @@
import Foundation
final class _CSVKeyedEncoder<K>: KeyedEncodingContainerProtocol where K: CodingKey {
var codingPath: [CodingKey]
let container: DataContainer
let boolEncoding: BoolEncodingStrategy
let stringEncoding: String.Encoding
init(container: DataContainer, path: CodingPath, boolEncoding: BoolEncodingStrategy, stringEncoding: String.Encoding) {
self.container = container
self.codingPath = path
self.boolEncoding = boolEncoding
self.stringEncoding = stringEncoding
}
func titleEncode(for key: K, converter: ()throws -> Bytes)rethrows {
if self.container.titlesCreated {
try self.container.data.append(contentsOf: converter() + [.comma])
} else {
let lines = self.container.data.split(separator: .newLine)
let headers = lines.first == nil ? [] : lines.first! + [.comma]
let body = lines.last == nil ? [] : lines.last! + [.comma]
try self.container.data = (headers + key.stringValue.bytes) + [.newLine] + (body + converter())
}
}
func encodeNil(forKey key: K) throws { self.titleEncode(for: key) { [] } }
func encode(_ value: Bool, forKey key: K) throws { self.titleEncode(for: key) { self.boolEncoding.convert(value) } }
func encode(_ value: Double, forKey key: K) throws { self.titleEncode(for: key) { value.bytes } }
func encode(_ value: Float, forKey key: K) throws { self.titleEncode(for: key) { value.bytes } }
func encode(_ value: Int, forKey key: K) throws { self.titleEncode(for: key) { value.bytes } }
func encode(_ value: String, forKey key: K) throws { self.titleEncode(for: key) { value.bytes } }
func encode<T>(_ value: T, forKey key: K) throws where T : Encodable {
try self.titleEncode(for: key) {
let encoder = _CSVEncoder(container: DataContainer(titles: true), path: self.codingPath, boolEncoding: self.boolEncoding, stringEncoding: self.stringEncoding)
try value.encode(to: encoder)
return encoder.container.data
}
}
func nestedContainer<NestedKey>(keyedBy keyType: NestedKey.Type, forKey key: K) -> KeyedEncodingContainer<NestedKey> where NestedKey : CodingKey {
let container = _CSVKeyedEncoder<NestedKey>(container: self.container, path: self.codingPath + [key], boolEncoding: self.boolEncoding, stringEncoding: self.stringEncoding)
return KeyedEncodingContainer(container)
}
func nestedUnkeyedContainer(forKey key: K) -> UnkeyedEncodingContainer {
return _CSVUnkeyedEncoder(container: self.container, path: self.codingPath, boolEncoding: self.boolEncoding, stringEncoding: self.stringEncoding)
}
func superEncoder() -> Encoder {
return _CSVEncoder(container: self.container, path: self.codingPath, boolEncoding: self.boolEncoding, stringEncoding: self.stringEncoding)
}
func superEncoder(forKey key: K) -> Encoder {
return _CSVEncoder(container: self.container, path: self.codingPath + [key], boolEncoding: self.boolEncoding, stringEncoding: self.stringEncoding)
}
}

View File

@ -1,27 +0,0 @@
import Foundation
final class _CSVSingleValueEncoder: SingleValueEncodingContainer {
let codingPath: [CodingKey]
let container: DataContainer
let boolEncoding: BoolEncodingStrategy
let stringEncoding: String.Encoding
init(container: DataContainer, path: CodingPath, boolEncoding: BoolEncodingStrategy, stringEncoding: String.Encoding) {
self.codingPath = path
self.container = container
self.boolEncoding = boolEncoding
self.stringEncoding = stringEncoding
}
func encodeNil() throws { self.container.data = [] }
func encode(_ value: Bool) throws { self.container.data = boolEncoding.convert(value) }
func encode(_ value: String) throws { self.container.data = value.bytes }
func encode(_ value: Double) throws { self.container.data = value.bytes }
func encode(_ value: Float) throws { self.container.data = value.bytes }
func encode(_ value: Int) throws { self.container.data = value.bytes }
func encode<T>(_ value: T) throws where T : Encodable {
let column = self.codingPath.map { $0.stringValue }.joined(separator: ".")
throw EncodingError.invalidValue(value, EncodingError.Context(codingPath: self.codingPath, debugDescription: "Cannot encode nested data into cell in column '\(column)'"))
}
}

View File

@ -1,49 +0,0 @@
import Foundation
final class _CSVUnkeyedEncoder: UnkeyedEncodingContainer {
var codingPath: [CodingKey]
let container: DataContainer
let boolEncoding: BoolEncodingStrategy
let stringEncoding: String.Encoding
init(container: DataContainer, path: CodingPath, boolEncoding: BoolEncodingStrategy, stringEncoding: String.Encoding) {
self.container = container
self.codingPath = path
self.boolEncoding = boolEncoding
self.stringEncoding = stringEncoding
}
var count: Int {
return container.data.split(separator: .newLine).count
}
func fail(with value: Any) -> Error {
return EncodingError.invalidValue(value, EncodingError.Context.init(codingPath: self.codingPath, debugDescription: "Cannot encode single values to array in CSV"))
}
func encodeNil() throws { throw self.fail(with: Optional<Any>.none as Any) }
func encode(_ value: Bool) throws { throw self.fail(with: value) }
func encode(_ value: String) throws { throw self.fail(with: value) }
func encode(_ value: Double) throws { throw self.fail(with: value) }
func encode(_ value: Float) throws { throw self.fail(with: value) }
func encode(_ value: Int) throws { throw self.fail(with: value) }
func encode<T>(_ value: T) throws where T : Encodable {
let encoder = _CSVEncoder(container: DataContainer(titles: self.container.data.count > 0), path: self.codingPath, boolEncoding: self.boolEncoding, stringEncoding: self.stringEncoding)
try value.encode(to: encoder)
self.container.data.append(contentsOf: encoder.container.data.dropLast() + [.newLine])
}
func nestedContainer<NestedKey>(keyedBy keyType: NestedKey.Type) -> KeyedEncodingContainer<NestedKey> where NestedKey : CodingKey {
let container = _CSVKeyedEncoder<NestedKey>(container: self.container, path: self.codingPath, boolEncoding: self.boolEncoding, stringEncoding: self.stringEncoding)
return KeyedEncodingContainer(container)
}
func nestedUnkeyedContainer() -> UnkeyedEncodingContainer {
return _CSVUnkeyedEncoder(container: self.container, path: self.codingPath, boolEncoding: self.boolEncoding, stringEncoding: self.stringEncoding)
}
func superEncoder() -> Encoder {
return _CSVEncoder(container: self.container, path: self.codingPath, boolEncoding: self.boolEncoding, stringEncoding: self.stringEncoding)
}
}

View File

@ -1,19 +1,15 @@
import Foundation
import Core
// MARK: - String <-> Bytes conversion
extension CustomStringConvertible {
var bytes: Bytes {
var bytes: [UInt8] {
return Array(self.description.utf8)
}
}
extension String {
init(_ bytes: Bytes)throws {
guard let string = String(bytes: bytes, encoding: .utf8) else {
throw CoreError(identifier: "dataToString", reason: "Converting byte array to string using UTF-8 encoding failed")
}
self = string
init(_ bytes: [UInt8]) {
self = String(decoding: bytes, as: UTF8.self)
}
}
@ -27,30 +23,26 @@ extension Dictionary where Key == String {
}
}
// MARK: - Swift 4.2 Method Implementations
extension RangeReplaceableCollection where Self: MutableCollection {
/// Removes from the collection all elements that satisfy the given predicate.
///
/// - Parameter predicate: A closure that takes an element of the
/// sequence as its argument and returns a Boolean value indicating
/// whether the element should be removed from the collection.
///
/// - Complexity: O(*n*), where *n* is the length of the collection.
@inlinable
public mutating func removeAll(
where predicate: (Element) throws -> Bool
) rethrows {
if var i = try index(where: predicate) {
var j = index(after: i)
while j != endIndex {
if try !predicate(self[j]) {
swapAt(i, j)
formIndex(after: &i)
}
formIndex(after: &j)
}
removeSubrange(i...)
}
extension UInt8: ExpressibleByUnicodeScalarLiteral {
public init(unicodeScalarLiteral value: UnicodeScalar) {
self = UInt8(ascii: value)
}
}
extension Array: ExpressibleByUnicodeScalarLiteral where Element == UInt8 {
public init(unicodeScalarLiteral value: UnicodeScalar) {
self = [UInt8(ascii: value)]
}
}
extension Array: ExpressibleByExtendedGraphemeClusterLiteral where Element == UInt8 {
public init(extendedGraphemeClusterLiteral value: Character) {
self = value.unicodeScalars.map(UInt8.init(ascii:))
}
}
extension Array: ExpressibleByStringLiteral where Element == UInt8 {
public init(stringLiteral value: String) {
self = value.unicodeScalars.map(UInt8.init(ascii:))
}
}

240
Sources/CSV/Parser.swift Normal file
View File

@ -0,0 +1,240 @@
import Foundation
// '\n' => 10
// '\r' => 13
// '"' => 34
// ',' => 44
/// Wraps an accumulated list of errors.
public struct ErrorList: Error {
/// A list of errors from a repeating operation.
public var errors: [Error]
/// Creates a new `ErrorList` instance.
///
/// - Parameter errors: The initial errors to populate the `errors` array. Defaults to an empty array.
public init(errors: [Error] = []) {
self.errors = errors
}
/// A `Result` instance that wraps the current `ErrorList` as its error.
///
/// If the `errors` array is empty, the `Result` instance will be a void `success` case.
var result: Result<Void, ErrorList> {
return self.errors.count == 0 ? .success(()) : .failure(self)
}
}
/// A parser for streaming `CSV` data.
///
/// - Note: You should create a new `Parser` instance for each CSV document you parse.
public struct Parser {
/// The type of handler that gets called when a header is parsed.
///
/// - Parameter title: The data for the header that is parsed.
public typealias HeaderHandler = (_ title: [UInt8])throws -> ()
/// The type of handler that gets called when a cell is parsed.
///
/// - Parameters:
/// - title: The header for the cell that is parsed.
/// - contents: The data for the cell that is parsed.
public typealias CellHandler = (_ title: [UInt8], _ contents: [UInt8])throws -> ()
internal enum Position {
case headers
case cells
}
private struct State {
var headers: [[UInt8]]
var position: Position
var inQuotes: Bool
var store: [UInt8]
var headerIndex: Array<[UInt8]>.Index
var bytesLeft: Int?
init() {
self.headers = []
self.position = .headers
self.inQuotes = false
self.store = []
self.headerIndex = Array<[UInt8]>().startIndex
self.bytesLeft = nil
}
}
/// The callback that is called when a header is parsed.
public var onHeader: HeaderHandler?
/// The callback that is called when a cell is parsed.
public var onCell: CellHandler?
private var state: State
internal var currentHeader: [UInt8] {
return self.state.headers[self.state.headerIndex % self.state.headers.count]
}
/// Creates a new `Parser` instance.
///
/// - Parameters:
/// - onHeader: The callback that will be called when a header is parsed.
/// - onCell: The callback that will be called when a cell is parsed.
public init(onHeader: HeaderHandler? = nil, onCell: CellHandler? = nil) {
self.onHeader = onHeader
self.onCell = onCell
self.state = State()
}
/// Parses an arbitrary portion of a CSV document.
///
/// The data passed in should be the next slice of the document directly after the previous one.
///
/// When a header is parsed from the data, the data will be passed into the registered `.onHeader` callback.
/// When a cell is parsed from the data, the header for that given cell and the cell's data will be passed into
/// the `.onCell` callback.
///
/// - Parameters:
/// - data: The portion of the CSV document to parse.
/// - length: The full content length of the document that is being parsed.
///
/// - Returns: A `Result` instance that will have a `.failure` case with all the errors thrown from
/// the registered callbacks. If there are no errors, then the result will be a `.success` case.
@discardableResult
public mutating func parse(_ data: [UInt8], length: Int? = nil) -> Result<Void, ErrorList> {
var currentCell: [UInt8] = self.state.store
var index = data.startIndex
var updateState = false
var errors = ErrorList()
var slice: (start: Int, end: Int) = (index, index)
while index < data.endIndex {
let byte = data[index]
switch byte {
case 34:
currentCell.append(contentsOf: data[slice.start..<slice.end])
slice = (index + 1, index + 1)
switch self.state.inQuotes && index + 1 < data.endIndex && data[index + 1] == 34 {
case true: index += 1
case false: self.state.inQuotes.toggle()
}
case 13:
if self.state.inQuotes {
slice.end += 1
} else {
if index + 1 < data.endIndex, data[index + 1] == 10 {
index += 1
}
fallthrough
}
case 10:
if self.state.inQuotes {
slice.end += 1
} else {
if self.state.position == .headers { updateState = true }
fallthrough
}
case 44:
if self.state.inQuotes {
slice.end += 1
} else {
currentCell.append(contentsOf: data[slice.start..<slice.end])
switch self.state.position {
case .headers:
self.state.headers.append(currentCell)
do { try self.onHeader?(currentCell) }
catch let error { errors.errors.append(error) }
case .cells:
do { try self.onCell?(self.currentHeader, currentCell) }
catch let error { errors.errors.append(error) }
self.state.headerIndex += 1
}
currentCell = []
slice = (index + 1, index + 1)
if updateState { self.state.position = .cells }
}
default: slice.end += 1
}
index += 1
}
currentCell.append(contentsOf: data[slice.start..<slice.end])
if let length = length {
self.state.bytesLeft =
(self.state.bytesLeft ?? length) -
((self.state.store.count + data.count) - currentCell.count)
if (self.state.bytesLeft ?? 0) > currentCell.count {
self.state.store = currentCell
return errors.result
}
}
switch self.state.position {
case .headers:
self.state.headers.append(currentCell)
do { try self.onHeader?(currentCell) }
catch let error { errors.errors.append(error) }
case .cells:
do { try self.onCell?(self.currentHeader, currentCell) }
catch let error { errors.errors.append(error) }
}
return errors.result
}
}
/// A synchronous wrapper for the `Parser` type for parsing whole CSV documents at once.
public final class SyncParser {
/// Creates a new `SyncParser` instance
public init() {}
/// Parses a whole CSV document at once.
///
/// - Parameter data: The CSV data to parse.
/// - Returns: A dictionary containing the parsed CSV data. The keys are the column names
/// and the values are the column cells. A `nil` value is an empty cell.
public func parse(_ data: [UInt8]) -> [[UInt8]: [[UInt8]?]] {
var results: [[UInt8]: [[UInt8]?]] = [:]
var parser = Parser(
onHeader: { header in
results[header] = []
},
onCell: { header, cell in
results[header, default: []].append(cell.count > 0 ? cell : nil)
}
)
parser.parse(data)
return results
}
/// Parses a whole CSV document at once from a `String`.
///
/// - Parameter data: The CSV data to parse.
/// - Returns: A dictionary containing the parsed CSV data. The keys are the column names
/// and the values are the column cells. A `nil` value is an empty cell.
public func parse(_ data: String) -> [String: [String?]] {
var results: [String: [String?]] = [:]
var parser = Parser(
onHeader: { header in
results[String(decoding: header, as: UTF8.self)] = []
},
onCell: { header, cell in
let title = String(decoding: header, as: UTF8.self)
let contents = String(decoding: cell, as: UTF8.self)
results[title, default: []].append(cell.count > 0 ? contents : nil)
}
)
parser.parse(Array(data.utf8))
return results
}
}

144
Sources/CSV/Seralizer.swift Normal file
View File

@ -0,0 +1,144 @@
import Foundation
/// The type where an instance can be represented by an array of bytes (`UInt8`).
public protocol BytesRepresentable {
/// The bytes that represent the given instance of `Self`.
var bytes: [UInt8] { get }
}
/// A `Collection` type that contains keyed values.
///
/// This protocol acts as an abstraction over `Dictionary` for the `Serializer` type. It is mostly
/// for testing purposes but you can also conform your own types if you want.
public protocol KeyedCollection: Collection where Self.Element == (key: Key, value: Value) {
/// The type of a key for a given value.
associatedtype Key: Hashable
/// The collection type for a list of the collection's keys.
associatedtype Keys: Collection where Keys.Element == Key
/// The type of a value.
associatedtype Value
/// The collection type for a list of the collection's values.
associatedtype Values: Collection where Values.Element == Value
/// All the collection's keyes.
var keys: Keys { get }
/// All the collection's values.
var values: Values { get }
}
extension String: BytesRepresentable {
/// The string's UTF-* view converted to an `Array`.
public var bytes: [UInt8] {
return Array(self.utf8)
}
}
extension Array: BytesRepresentable where Element == UInt8 {
/// Returns `Self`.
public var bytes: [UInt8] {
return self
}
}
extension Optional: BytesRepresentable where Wrapped: BytesRepresentable {
/// The wrapped value's bytes or an empty `Array`.
public var bytes: [UInt8] {
return self?.bytes ?? []
}
}
extension Dictionary: KeyedCollection { }
/// Serializes dictionary data to CSV document data.
///
/// - Note: You should create a new `Serializer` dictionary you serialize.
public struct Serializer {
private var serializedHeaders: Bool
/// The callback that will be called with each row that is serialized.
public var onRow: ([UInt8])throws -> ()
/// Creates a new `Serializer` instance.
///
/// - Parameter onRow: The callback that will be called with each row that is serialized.
public init(onRow: @escaping ([UInt8])throws -> ()) {
self.serializedHeaders = false
self.onRow = onRow
}
/// Serializes a dictionary to CSV document data. Usually this will be a dictionary of type
/// `[BytesRepresentable: [BytesRepresentable]], but it can be any type you conform to the proper protocols.
///
/// You can pass multiple dictionaries of the same structure into this method. The headers will only be serialized the
/// first time it is called.
///
/// - Note: When you pass a dictionary into this method, each value collection is expect to contain the same
//// number of elements, and will crash with `index out of bounds` if that assumption is broken.
///
/// - Parameter data: The dictionary (or other object) to parse.
/// - Returns: A `Result` instance with a `.failure` case with all the errors from the the `.onRow` callback calls.
/// If there are no errors, the result will be a `.success` case.
@discardableResult
public mutating func serialize<Data>(_ data: Data) -> Result<Void, ErrorList> where
Data: KeyedCollection, Data.Key: BytesRepresentable, Data.Value: Collection, Data.Value.Element: BytesRepresentable,
Data.Value.Index: Strideable, Data.Value.Index.Stride: SignedInteger
{
var errors = ErrorList()
guard data.count > 0 else { return errors.result }
if !self.serializedHeaders {
let headers = data.keys.map { title in Array([[34], title.bytes, [34]].joined()) }
do { try self.onRow(Array(headers.joined(separator: [10]))) }
catch let error { errors.errors.append(error) }
self.serializedHeaders = true
}
guard let first = data.first?.value else { return errors.result }
(first.startIndex..<first.endIndex).forEach { index in
let cells = data.values.map { column -> [UInt8] in
return Array([[34], column[index].bytes, [34]].joined())
}
do { try onRow(Array(cells.joined(separator: [10]))) }
catch let error { errors.errors.append(error) }
}
return errors.result
}
}
/// A synchronous wrapper for the `Serializer` struct for parsing a whole CSV document.
public struct SyncSerializer {
/// Creates a new `SyncSerializer` instance.
public init () { }
/// Serializes a dictionary to CSV document data. Usually this will be a dictionary of type
/// `[BytesRepresentable: [BytesRepresentable]], but it can be any type you conform to the proper protocols.
///
/// - Note: When you pass a dictionary into this method, each value collection is expect to contain the same
//// number of elements, and will crash with `index out of bounds` if that assumption is broken.
///
/// - Parameter data: The dictionary (or other object) to parse.
/// - Returns: The serialized CSV data.
public func serialize<Data>(_ data: Data) -> [UInt8] where
Data: KeyedCollection, Data.Key: BytesRepresentable, Data.Value: Collection, Data.Value.Element: BytesRepresentable,
Data.Value.Index: Strideable, Data.Value.Index.Stride: SignedInteger
{
var rows: [[UInt8]] = []
rows.reserveCapacity(data.first?.value.count ?? 0)
var serializer = Serializer { row in rows.append(row) }
serializer.serialize(data)
return Array(rows.joined(separator: [10]))
}
}

View File

@ -1,722 +0,0 @@
import Bits
import XCTest
import Random
@testable import CSV
class CSVTests: XCTestCase {
func testParseSpeed()throws {
let url = URL(string: "file:/Users/calebkleveter/Development/developer_survey_2018.csv")!
let data = try Data(contentsOf: url)
measure {
autoreleasepool {
let _: [CSV.Column] = CSV.parse(data)
}
}
}
func testParse()throws {
let url = URL(string: "file:/Users/calebkleveter/Development/developer_survey_2018.csv")!
let data = try Data(contentsOf: url)
let parsed: [CSV.Column] = CSV.parse(data)
let lastRow = parsed.reduce(into: [:]) { result, column in
result[column.header] = column.fields.last ?? nil
}
let expected = [
"YearsCodingProf": "NA", "AgreeDisagree1": "NA", "AssessBenefits5": "NA", "FormalEducation": "NA", "StackOverflowDevStory": "NA",
"CommunicationTools": "NA", "CompanySize": "NA", "Dependents": "NA", "HypotheticalTools2": "NA", "AssessBenefits7": "NA",
"SurveyEasy": "NA", "UpdateCV": "NA", "AIInteresting": "NA", "CheckInCode": "NA", "UndergradMajor": "NA", "OpenSource": "Yes",
"JobEmailPriorities1": "NA", "SalaryType": "NA", "HypotheticalTools4": "NA", "TimeFullyProductive": "NA", "SkipMeals": "NA",
"AdsPriorities4": "NA", "YearsCoding": "NA", "AdsPriorities6": "NA", "StackOverflowJobs": "NA", "Student": "NA", "AssessJob9": "NA",
"AssessBenefits2": "NA", "Country": "Cambodia", "MilitaryUS": "NA", "AssessBenefits1": "NA", "AdsPriorities7": "NA",
"SexualOrientation": "NA", "LastNewJob": "NA", "Salary": "NA", "SurveyTooLong": "NA", "DatabaseDesireNextYear": "NA",
"ConvertedSalary": "NA", "AdsAgreeDisagree3": "NA", "AssessBenefits4": "NA", "StackOverflowRecommend": "NA", "AdBlockerReasons": "NA",
"Respondent": "101548", "HoursOutside": "NA", "CareerSatisfaction": "NA", "HopeFiveYears": "NA", "JobContactPriorities2": "NA",
"TimeAfterBootcamp": "NA", "JobContactPriorities3": "NA", "AdsPriorities3": "NA", "AssessJob2": "NA", "AssessJob6": "NA",
"AdsPriorities1": "NA", "AdsActions": "NA", "Exercise": "NA", "AssessJob8": "NA", "JobSearchStatus": "NA", "JobSatisfaction": "NA",
"JobContactPriorities4": "NA", "HackathonReasons": "NA", "RaceEthnicity": "NA", "LanguageWorkedWith": "NA", "AIFuture": "NA",
"HoursComputer": "NA", "FrameworkDesireNextYear": "NA", "HypotheticalTools1": "NA", "Currency": "NA", "AgreeDisagree2": "NA",
"Employment": "NA", "HypotheticalTools3": "NA", "IDE": "NA", "SelfTaughtTypes": "NA", "AssessJob10": "NA", "AIResponsible": "NA",
"DevType": "NA", "HypotheticalTools5": "NA", "AdsAgreeDisagree1": "NA", "EthicsResponsible": "NA", "EducationTypes": "NA",
"AdsPriorities5": "NA", "EthicalImplications": "NA", "AssessBenefits3": "NA", "JobEmailPriorities2": "NA", "EducationParents": "NA",
"WakeTime": "NA", "EthicsChoice": "NA", "StackOverflowVisit": "NA", "StackOverflowJobsRecommend": "NA", "PlatformDesireNextYear": "NA",
"StackOverflowParticipate": "NA", "Methodology": "NA", "AssessBenefits11": "NA", "StackOverflowHasAccount": "NA",
"OperatingSystem": "NA", "FrameworkWorkedWith": "NA", "EthicsReport": "NA", "StackOverflowConsiderMember": "NA",
"AdsAgreeDisagree2": "NA", "AssessBenefits10": "NA", "AssessJob4": "NA", "JobEmailPriorities7": "NA", "AssessJob7": "NA",
"AssessJob1": "NA", "Age": "NA", "Gender": "NA", "JobContactPriorities5": "NA", "AdBlockerDisable": "NA", "VersionControl": "NA",
"JobContactPriorities1": "NA", "JobEmailPriorities5": "NA", "DatabaseWorkedWith": "NA", "PlatformWorkedWith": "NA",
"AssessBenefits6": "NA", "AssessJob5": "NA", "JobEmailPriorities4": "NA", "CurrencySymbol": "NA", "ErgonomicDevices": "NA",
"LanguageDesireNextYear": "NA", "AgreeDisagree3": "NA", "AIDangerous": "NA", "JobEmailPriorities3": "NA", "NumberMonitors": "NA",
"Hobby": "Yes", "JobEmailPriorities6": "NA", "AdsPriorities2": "NA", "AdBlocker": "NA", "AssessJob3": "NA", "AssessBenefits8": "NA",
"AssessBenefits9": "NA"
]
for (parsed, expected) in zip(lastRow.sorted(by: { $0.key < $1.key }), expected.sorted(by: { $0.key < $1.key })) {
XCTAssertEqual(parsed.key, expected.key)
XCTAssertEqual(parsed.value, expected.value)
}
}
func testRowIterate()throws {
let url = URL(string: "file:/Users/calebkleveter/Development/developer_survey_2018.csv")!
let data = try Array(Data(contentsOf: url))
measure {
do {
let container = try DecoderDataContainer(data: data)
while container.row != nil {
container.incremetRow()
}
} catch let error {
XCTFail(error.localizedDescription)
}
}
}
func testCSVDecode()throws {
let url = URL(string: "file:/Users/calebkleveter/Development/developer_survey_2018.csv")!
let data = try Data(contentsOf: url)
let responses = try CSVCoder.decode(data, to: Response.self)
self.compare(responses.first, to: .first)
self.compare(responses.last, to: .last)
}
func testCSVDecodeSpeed()throws {
let url = URL(string: "file:/Users/calebkleveter/Development/developer_survey_2018.csv")!
let data = try Data(contentsOf: url)
// 18.489
measure {
do {
_ = try CSVCoder.decode(data, to: Response.self)
} catch { XCTFail(error.localizedDescription) }
}
}
func testCSVColumnSeralization()throws {
let url = URL(string: "file:/Users/calebkleveter/Development/developer_survey_2018.csv")!
let data = try Data(contentsOf: url)
let parsed: [CSV.Column] = CSV.parse(data)
let _ = parsed.seralize()
}
func testCSVColumnSeralizationSpeed()throws {
let url = URL(string: "file:/Users/calebkleveter/Development/developer_survey_2018.csv")!
let data = try Data(contentsOf: url)
let parsed: [CSV.Column] = CSV.parse(data)
measure {
_ = parsed.seralize()
}
}
func testCSVEncoding()throws {
let url = URL(string: "file:/Users/calebkleveter/Development/developer_survey_2018.csv")!
let data = try Data(contentsOf: url)
let fielders = try CSVCoder.decode(data, to: Response.self)
_ = try CSVCoder.encode(fielders, boolEncoding: .custom(true: "Yes".bytes, false: "No".bytes))
}
func testCSVEncodingSpeed()throws {
let url = URL(string: "file:/Users/calebkleveter/Development/developer_survey_2018.csv")!
let data = try Data(contentsOf: url)
let fielders = try CSVCoder.decode(data, to: Response.self)
// 7.391
measure {
do {
_ = try CSVCoder.encode(fielders)
} catch { XCTFail(error.localizedDescription) }
}
}
func testDataToIntSpeed() {
measure {
for _ in 0...1_000_000 {
guard let _ = [.one, .two, .four, .nine, .five, .seven, .six, .eight, .zero, .one, .four].int else {
XCTFail()
return
}
}
}
XCTAssertEqual([.one, .two, .four, .nine, .five, .seven, .six, .eight, .zero, .one, .four].int, 12495768014)
}
func testBytesToStringSpeed() {
let bytes: [UInt8] = [49, 50, 51, 52, 53, 54, 55, 56, 57, 48, 113, 119, 101, 114, 116, 121, 117, 105, 111, 112, 97, 115, 100, 102, 103, 104, 106, 107, 108, 122, 120, 99, 118, 98, 110, 109]
measure {
do {
for _ in 0...1_000_000 {
_ = try String(bytes)
}
} catch let error {
XCTFail(error.localizedDescription)
}
}
guard let result = String(bytes: bytes, encoding: .utf8) else {
XCTFail()
return
}
XCTAssertEqual(String(data: Data(bytes), encoding: .utf8), result)
}
func testKeyinitSpeed()throws {
let url = URL(string: "file:/Users/calebkleveter/Development/developer_survey_2018.csv")!
let data = try Array(Data(contentsOf: url))
measure {
autoreleasepool {
_ = data.split(separator: .newLine).count
}
}
}
static var allTests = [
("testParseSpeed", testParseSpeed),
("testRowIterate", testRowIterate),
("testCSVDecode", testCSVDecode),
("testCSVDecodeSpeed", testCSVDecodeSpeed),
("testCSVColumnSeralization", testCSVColumnSeralization),
("testCSVColumnSeralizationSpeed", testCSVColumnSeralizationSpeed),
("testCSVEncoding", testCSVEncoding),
("testCSVEncodingSpeed", testCSVEncodingSpeed),
("testDataToIntSpeed", testDataToIntSpeed),
("testBytesToStringSpeed", testBytesToStringSpeed)
]
func compare(_ lhs: Response?, to rhs: Response?) {
XCTAssertEqual(lhs?.Respondent, rhs?.Respondent)
XCTAssertEqual(lhs?.Hobby, rhs?.Hobby)
XCTAssertEqual(lhs?.OpenSource, rhs?.OpenSource)
XCTAssertEqual(lhs?.Country, rhs?.Country)
XCTAssertEqual(lhs?.Student, rhs?.Student)
XCTAssertEqual(lhs?.Employment, rhs?.Employment)
XCTAssertEqual(lhs?.FormalEducation, rhs?.FormalEducation)
XCTAssertEqual(lhs?.UndergradMajor, rhs?.UndergradMajor)
XCTAssertEqual(lhs?.CompanySize, rhs?.CompanySize)
XCTAssertEqual(lhs?.DevType, rhs?.DevType)
XCTAssertEqual(lhs?.YearsCoding, rhs?.YearsCoding)
XCTAssertEqual(lhs?.YearsCodingProf, rhs?.YearsCodingProf)
XCTAssertEqual(lhs?.JobSatisfaction, rhs?.JobSatisfaction)
XCTAssertEqual(lhs?.CareerSatisfaction, rhs?.CareerSatisfaction)
XCTAssertEqual(lhs?.HopeFiveYears, rhs?.HopeFiveYears)
XCTAssertEqual(lhs?.JobSearchStatus, rhs?.JobSearchStatus)
XCTAssertEqual(lhs?.LastNewJob, rhs?.LastNewJob)
XCTAssertEqual(lhs?.AssessJob1, rhs?.AssessJob1)
XCTAssertEqual(lhs?.AssessJob2, rhs?.AssessJob2)
XCTAssertEqual(lhs?.AssessJob3, rhs?.AssessJob3)
XCTAssertEqual(lhs?.AssessJob4, rhs?.AssessJob4)
XCTAssertEqual(lhs?.AssessJob5, rhs?.AssessJob5)
XCTAssertEqual(lhs?.AssessJob6, rhs?.AssessJob6)
XCTAssertEqual(lhs?.AssessJob7, rhs?.AssessJob7)
XCTAssertEqual(lhs?.AssessJob8, rhs?.AssessJob8)
XCTAssertEqual(lhs?.AssessJob9, rhs?.AssessJob9)
XCTAssertEqual(lhs?.AssessJob10, rhs?.AssessJob10)
XCTAssertEqual(lhs?.AssessBenefits1, rhs?.AssessBenefits1)
XCTAssertEqual(lhs?.AssessBenefits2, rhs?.AssessBenefits2)
XCTAssertEqual(lhs?.AssessBenefits3, rhs?.AssessBenefits3)
XCTAssertEqual(lhs?.AssessBenefits4, rhs?.AssessBenefits4)
XCTAssertEqual(lhs?.AssessBenefits5, rhs?.AssessBenefits5)
XCTAssertEqual(lhs?.AssessBenefits6, rhs?.AssessBenefits6)
XCTAssertEqual(lhs?.AssessBenefits7, rhs?.AssessBenefits7)
XCTAssertEqual(lhs?.AssessBenefits8, rhs?.AssessBenefits8)
XCTAssertEqual(lhs?.AssessBenefits9, rhs?.AssessBenefits9)
XCTAssertEqual(lhs?.AssessBenefits10, rhs?.AssessBenefits10)
XCTAssertEqual(lhs?.AssessBenefits11, rhs?.AssessBenefits11)
XCTAssertEqual(lhs?.JobContactPriorities1, rhs?.JobContactPriorities1)
XCTAssertEqual(lhs?.JobContactPriorities2, rhs?.JobContactPriorities2)
XCTAssertEqual(lhs?.JobContactPriorities3, rhs?.JobContactPriorities3)
XCTAssertEqual(lhs?.JobContactPriorities4, rhs?.JobContactPriorities4)
XCTAssertEqual(lhs?.JobContactPriorities5, rhs?.JobContactPriorities5)
XCTAssertEqual(lhs?.JobEmailPriorities1, rhs?.JobEmailPriorities1)
XCTAssertEqual(lhs?.JobEmailPriorities2, rhs?.JobEmailPriorities2)
XCTAssertEqual(lhs?.JobEmailPriorities3, rhs?.JobEmailPriorities3)
XCTAssertEqual(lhs?.JobEmailPriorities4, rhs?.JobEmailPriorities4)
XCTAssertEqual(lhs?.JobEmailPriorities5, rhs?.JobEmailPriorities5)
XCTAssertEqual(lhs?.JobEmailPriorities6, rhs?.JobEmailPriorities6)
XCTAssertEqual(lhs?.JobEmailPriorities7, rhs?.JobEmailPriorities7)
XCTAssertEqual(lhs?.UpdateCV, rhs?.UpdateCV)
XCTAssertEqual(lhs?.Currency, rhs?.Currency)
XCTAssertEqual(lhs?.Salary, rhs?.Salary)
XCTAssertEqual(lhs?.SalaryType, rhs?.SalaryType)
XCTAssertEqual(lhs?.ConvertedSalary, rhs?.ConvertedSalary)
XCTAssertEqual(lhs?.CurrencySymbol, rhs?.CurrencySymbol)
XCTAssertEqual(lhs?.CommunicationTools, rhs?.CommunicationTools)
XCTAssertEqual(lhs?.TimeFullyProductive, rhs?.TimeFullyProductive)
XCTAssertEqual(lhs?.EducationTypes, rhs?.EducationTypes)
XCTAssertEqual(lhs?.SelfTaughtTypes, rhs?.SelfTaughtTypes)
XCTAssertEqual(lhs?.TimeAfterBootcamp, rhs?.TimeAfterBootcamp)
XCTAssertEqual(lhs?.HackathonReasons, rhs?.HackathonReasons)
XCTAssertEqual(lhs?.AgreeDisagree1, rhs?.AgreeDisagree1)
XCTAssertEqual(lhs?.AgreeDisagree2, rhs?.AgreeDisagree2)
XCTAssertEqual(lhs?.AgreeDisagree3, rhs?.AgreeDisagree3)
XCTAssertEqual(lhs?.LanguageWorkedWith, rhs?.LanguageWorkedWith)
XCTAssertEqual(lhs?.LanguageDesireNextYear, rhs?.LanguageDesireNextYear)
XCTAssertEqual(lhs?.DatabaseWorkedWith, rhs?.DatabaseWorkedWith)
XCTAssertEqual(lhs?.DatabaseDesireNextYear, rhs?.DatabaseDesireNextYear)
XCTAssertEqual(lhs?.PlatformWorkedWith, rhs?.PlatformWorkedWith)
XCTAssertEqual(lhs?.PlatformDesireNextYear, rhs?.PlatformDesireNextYear)
XCTAssertEqual(lhs?.FrameworkWorkedWith, rhs?.FrameworkWorkedWith)
XCTAssertEqual(lhs?.FrameworkDesireNextYear, rhs?.FrameworkDesireNextYear)
XCTAssertEqual(lhs?.IDE, rhs?.IDE)
XCTAssertEqual(lhs?.OperatingSystem, rhs?.OperatingSystem)
XCTAssertEqual(lhs?.NumberMonitors, rhs?.NumberMonitors)
XCTAssertEqual(lhs?.Methodology, rhs?.Methodology)
XCTAssertEqual(lhs?.VersionControl, rhs?.VersionControl)
XCTAssertEqual(lhs?.CheckInCode, rhs?.CheckInCode)
XCTAssertEqual(lhs?.AdBlocker, rhs?.AdBlocker)
XCTAssertEqual(lhs?.AdBlockerDisable, rhs?.AdBlockerDisable)
XCTAssertEqual(lhs?.AdBlockerReasons, rhs?.AdBlockerReasons)
XCTAssertEqual(lhs?.AdsAgreeDisagree1, rhs?.AdsAgreeDisagree1)
XCTAssertEqual(lhs?.AdsAgreeDisagree2, rhs?.AdsAgreeDisagree2)
XCTAssertEqual(lhs?.AdsAgreeDisagree3, rhs?.AdsAgreeDisagree3)
XCTAssertEqual(lhs?.AdsActions, rhs?.AdsActions)
XCTAssertEqual(lhs?.AdsPriorities1, rhs?.AdsPriorities1)
XCTAssertEqual(lhs?.AdsPriorities2, rhs?.AdsPriorities2)
XCTAssertEqual(lhs?.AdsPriorities3, rhs?.AdsPriorities3)
XCTAssertEqual(lhs?.AdsPriorities4, rhs?.AdsPriorities4)
XCTAssertEqual(lhs?.AdsPriorities5, rhs?.AdsPriorities5)
XCTAssertEqual(lhs?.AdsPriorities6, rhs?.AdsPriorities6)
XCTAssertEqual(lhs?.AdsPriorities7, rhs?.AdsPriorities7)
XCTAssertEqual(lhs?.AIDangerous, rhs?.AIDangerous)
XCTAssertEqual(lhs?.AIInteresting, rhs?.AIInteresting)
XCTAssertEqual(lhs?.AIResponsible, rhs?.AIResponsible)
XCTAssertEqual(lhs?.AIFuture, rhs?.AIFuture)
XCTAssertEqual(lhs?.EthicsChoice, rhs?.EthicsChoice)
XCTAssertEqual(lhs?.EthicsReport, rhs?.EthicsReport)
XCTAssertEqual(lhs?.EthicsResponsible, rhs?.EthicsResponsible)
XCTAssertEqual(lhs?.EthicalImplications, rhs?.EthicalImplications)
XCTAssertEqual(lhs?.StackOverflowRecommend, rhs?.StackOverflowRecommend)
XCTAssertEqual(lhs?.StackOverflowVisit, rhs?.StackOverflowVisit)
XCTAssertEqual(lhs?.StackOverflowHasAccount, rhs?.StackOverflowHasAccount)
XCTAssertEqual(lhs?.StackOverflowParticipate, rhs?.StackOverflowParticipate)
XCTAssertEqual(lhs?.StackOverflowJobs, rhs?.StackOverflowJobs)
XCTAssertEqual(lhs?.StackOverflowDevStory, rhs?.StackOverflowDevStory)
XCTAssertEqual(lhs?.StackOverflowJobsRecommend, rhs?.StackOverflowJobsRecommend)
XCTAssertEqual(lhs?.StackOverflowConsiderMember, rhs?.StackOverflowConsiderMember)
XCTAssertEqual(lhs?.HypotheticalTools1, rhs?.HypotheticalTools1)
XCTAssertEqual(lhs?.HypotheticalTools2, rhs?.HypotheticalTools2)
XCTAssertEqual(lhs?.HypotheticalTools3, rhs?.HypotheticalTools3)
XCTAssertEqual(lhs?.HypotheticalTools4, rhs?.HypotheticalTools4)
XCTAssertEqual(lhs?.HypotheticalTools5, rhs?.HypotheticalTools5)
XCTAssertEqual(lhs?.WakeTime, rhs?.WakeTime)
XCTAssertEqual(lhs?.HoursComputer, rhs?.HoursComputer)
XCTAssertEqual(lhs?.HoursOutside, rhs?.HoursOutside)
XCTAssertEqual(lhs?.SkipMeals, rhs?.SkipMeals)
XCTAssertEqual(lhs?.ErgonomicDevices, rhs?.ErgonomicDevices)
XCTAssertEqual(lhs?.Exercise, rhs?.Exercise)
XCTAssertEqual(lhs?.Gender, rhs?.Gender)
XCTAssertEqual(lhs?.SexualOrientation, rhs?.SexualOrientation)
XCTAssertEqual(lhs?.EducationParents, rhs?.EducationParents)
XCTAssertEqual(lhs?.RaceEthnicity, rhs?.RaceEthnicity)
XCTAssertEqual(lhs?.Age, rhs?.Age)
XCTAssertEqual(lhs?.Dependents, rhs?.Dependents)
XCTAssertEqual(lhs?.MilitaryUS, rhs?.MilitaryUS)
XCTAssertEqual(lhs?.SurveyTooLong, rhs?.SurveyTooLong)
XCTAssertEqual(lhs?.SurveyEasy, rhs?.SurveyEasy)
}
}
struct Response: Codable, Equatable {
static func makeKeys(from row: [String: [Bytes?]]) -> [CodingKey] {
// return row.compactMap { cell in return Response.CodingKeys.init(stringValue: cell.key) }
return Array(row.keys).compactMap(Response.CodingKeys.init)
}
let Respondent: Int
let Hobby: Bool
let OpenSource: Bool
let Country: String
let Student: String
let Employment: String
let FormalEducation: String
let UndergradMajor: String?
let CompanySize: String
let DevType: String
let YearsCoding: String
let YearsCodingProf: String?
let JobSatisfaction: String?
let CareerSatisfaction: String?
let HopeFiveYears: String?
let JobSearchStatus: String?
let LastNewJob: String?
let AssessJob1: Int?
let AssessJob2: Int?
let AssessJob3: Int?
let AssessJob4: Int?
let AssessJob5: Int?
let AssessJob6: Int?
let AssessJob7: Int?
let AssessJob8: Int?
let AssessJob9: Int?
let AssessJob10: Int?
let AssessBenefits1: Int?
let AssessBenefits2: Int?
let AssessBenefits3: Int?
let AssessBenefits4: Int?
let AssessBenefits5: Int?
let AssessBenefits6: Int?
let AssessBenefits7: Int?
let AssessBenefits8: Int?
let AssessBenefits9: Int?
let AssessBenefits10: Int?
let AssessBenefits11: Int?
let JobContactPriorities1: Int?
let JobContactPriorities2: Int?
let JobContactPriorities3: Int?
let JobContactPriorities4: Int?
let JobContactPriorities5: Int?
let JobEmailPriorities1: Int?
let JobEmailPriorities2: Int?
let JobEmailPriorities3: Int?
let JobEmailPriorities4: Int?
let JobEmailPriorities5: Int?
let JobEmailPriorities6: Int?
let JobEmailPriorities7: Int?
let UpdateCV: String?
let Currency: String?
let Salary: Float?
let SalaryType: String?
let ConvertedSalary: String?
let CurrencySymbol: String?
let CommunicationTools: String?
let TimeFullyProductive: String?
let EducationTypes: String?
let SelfTaughtTypes: String?
let TimeAfterBootcamp: String?
let HackathonReasons: String?
let AgreeDisagree1: String?
let AgreeDisagree2: String?
let AgreeDisagree3: String?
let LanguageWorkedWith: String?
let LanguageDesireNextYear: String?
let DatabaseWorkedWith: String?
let DatabaseDesireNextYear: String?
let PlatformWorkedWith: String?
let PlatformDesireNextYear: String?
let FrameworkWorkedWith: String?
let FrameworkDesireNextYear: String?
let IDE: String?
let OperatingSystem: String?
let NumberMonitors: String?
let Methodology: String?
let VersionControl: String?
let CheckInCode: String?
let AdBlocker: String?
let AdBlockerDisable: String?
let AdBlockerReasons: String?
let AdsAgreeDisagree1: String?
let AdsAgreeDisagree2: String?
let AdsAgreeDisagree3: String?
let AdsActions: String?
let AdsPriorities1: Int?
let AdsPriorities2: Int?
let AdsPriorities3: Int?
let AdsPriorities4: Int?
let AdsPriorities5: Int?
let AdsPriorities6: Int?
let AdsPriorities7: Int?
let AIDangerous: String?
let AIInteresting: String?
let AIResponsible: String?
let AIFuture: String?
let EthicsChoice: String?
let EthicsReport: String?
let EthicsResponsible: String?
let EthicalImplications: String?
let StackOverflowRecommend: String?
let StackOverflowVisit: String?
let StackOverflowHasAccount: String?
let StackOverflowParticipate: String?
let StackOverflowJobs: String?
let StackOverflowDevStory: String?
let StackOverflowJobsRecommend: String?
let StackOverflowConsiderMember: String?
let HypotheticalTools1: String?
let HypotheticalTools2: String?
let HypotheticalTools3: String?
let HypotheticalTools4: String?
let HypotheticalTools5: String?
let WakeTime: String?
let HoursComputer: String?
let HoursOutside: String?
let SkipMeals: String?
let ErgonomicDevices: String?
let Exercise: String?
let Gender: String?
let SexualOrientation: String?
let EducationParents: String?
let RaceEthnicity: String?
let Age: String?
let Dependents: Bool?
let MilitaryUS: Bool?
let SurveyTooLong: String?
let SurveyEasy: String
static let first = Response(
Respondent: 1,
Hobby: true,
OpenSource: false,
Country: "Kenya",
Student: "No",
Employment: "Employed part-time",
FormalEducation: "Bachelors degree (BA, BS, B.Eng., etc.)",
UndergradMajor: "Mathematics or statistics",
CompanySize: "20 to 99 employees",
DevType: "Full-stack developer",
YearsCoding: "3-5 years",
YearsCodingProf: "3-5 years",
JobSatisfaction: "Extremely satisfied",
CareerSatisfaction: "Extremely satisfied",
HopeFiveYears: "Working as a founder or co-founder of my own company",
JobSearchStatus: "Im not actively looking, but I am open to new opportunities",
LastNewJob: "Less than a year ago",
AssessJob1: 10,
AssessJob2: 7,
AssessJob3: 8,
AssessJob4: 1,
AssessJob5: 2,
AssessJob6: 5,
AssessJob7: 3,
AssessJob8: 4,
AssessJob9: 9,
AssessJob10: 6,
AssessBenefits1: nil,
AssessBenefits2: nil,
AssessBenefits3: nil,
AssessBenefits4: nil,
AssessBenefits5: nil,
AssessBenefits6: nil,
AssessBenefits7: nil,
AssessBenefits8: nil,
AssessBenefits9: nil,
AssessBenefits10: nil,
AssessBenefits11: nil,
JobContactPriorities1: 3,
JobContactPriorities2: 1,
JobContactPriorities3: 4,
JobContactPriorities4: 2,
JobContactPriorities5: 5,
JobEmailPriorities1: 5,
JobEmailPriorities2: 6,
JobEmailPriorities3: 7,
JobEmailPriorities4: 2,
JobEmailPriorities5: 1,
JobEmailPriorities6: 4,
JobEmailPriorities7: 3,
UpdateCV: "My job status or other personal status changed",
Currency: nil,
Salary: nil,
SalaryType: "Monthly",
ConvertedSalary: nil,
CurrencySymbol: "KES",
CommunicationTools: "Slack",
TimeFullyProductive: "One to three months",
EducationTypes: "Taught yourself a new language, framework, or tool without taking a formal course;Participated in a hackathon",
SelfTaughtTypes: "The official documentation and/or standards for the technology;A book or e-book from OReilly, Apress, or a similar publisher;Questions & answers on Stack Overflow;Online developer communities other than Stack Overflow (ex. forums, listservs, IRC channels, etc.)",
TimeAfterBootcamp: nil,
HackathonReasons: "To build my professional network",
AgreeDisagree1: "Strongly agree",
AgreeDisagree2: "Strongly agree",
AgreeDisagree3: "Neither Agree nor Disagree",
LanguageWorkedWith: "JavaScript;Python;HTML;CSS",
LanguageDesireNextYear: "JavaScript;Python;HTML;CSS",
DatabaseWorkedWith: "Redis;SQL Server;MySQL;PostgreSQL;Amazon RDS/Aurora;Microsoft Azure (Tables, CosmosDB, SQL, etc)",
DatabaseDesireNextYear: "Redis;SQL Server;MySQL;PostgreSQL;Amazon RDS/Aurora;Microsoft Azure (Tables, CosmosDB, SQL, etc)",
PlatformWorkedWith: "AWS;Azure;Linux;Firebase",
PlatformDesireNextYear: "AWS;Azure;Linux;Firebase",
FrameworkWorkedWith: "Django;React",
FrameworkDesireNextYear: "Django;React",
IDE: "Komodo;Vim;Visual Studio Code",
OperatingSystem: "Linux-based",
NumberMonitors: "1",
Methodology: "Agile;Scrum",
VersionControl: "Git",
CheckInCode: "Multiple times per day",
AdBlocker: "Yes",
AdBlockerDisable: "No",
AdBlockerReasons: nil,
AdsAgreeDisagree1: "Strongly agree",
AdsAgreeDisagree2: "Strongly agree",
AdsAgreeDisagree3: "Strongly agree",
AdsActions: "Saw an online advertisement and then researched it (without clicking on the ad);Stopped going to a website because of their advertising",
AdsPriorities1: 1,
AdsPriorities2: 5,
AdsPriorities3: 4,
AdsPriorities4: 7,
AdsPriorities5: 2,
AdsPriorities6: 6,
AdsPriorities7: 3,
AIDangerous: "Artificial intelligence surpassing human intelligence (the singularity)",
AIInteresting: "Algorithms making important decisions",
AIResponsible: "The developers or the people creating the AI",
AIFuture: "I'm excited about the possibilities more than worried about the dangers.",
EthicsChoice: "No",
EthicsReport: "Yes, and publicly",
EthicsResponsible: "Upper management at the company/organization",
EthicalImplications: "Yes",
StackOverflowRecommend: "10 (Very Likely)",
StackOverflowVisit: "Multiple times per day",
StackOverflowHasAccount: "Yes",
StackOverflowParticipate: "I have never participated in Q&A on Stack Overflow",
StackOverflowJobs: "No, I knew that Stack Overflow had a jobs board but have never used or visited it",
StackOverflowDevStory: "Yes",
StackOverflowJobsRecommend: nil,
StackOverflowConsiderMember: "Yes",
HypotheticalTools1: "Extremely interested",
HypotheticalTools2: "Extremely interested",
HypotheticalTools3: "Extremely interested",
HypotheticalTools4: "Extremely interested",
HypotheticalTools5: "Extremely interested",
WakeTime: "Between 5:00 - 6:00 AM",
HoursComputer: "9 - 12 hours",
HoursOutside: "1 - 2 hours",
SkipMeals: "Never",
ErgonomicDevices: "Standing desk",
Exercise: "3 - 4 times per week",
Gender: "Male",
SexualOrientation: "Straight or heterosexual",
EducationParents: "Bachelors degree (BA, BS, B.Eng., etc.)",
RaceEthnicity: "Black or of African descent",
Age: "25 - 34 years old",
Dependents: true,
MilitaryUS: nil,
SurveyTooLong: "The survey was an appropriate length",
SurveyEasy: "Very easy"
)
static let last = Response(
Respondent: 101548,
Hobby: true,
OpenSource: true,
Country: "Cambodia",
Student: "NA",
Employment: "NA",
FormalEducation: "NA",
UndergradMajor: nil,
CompanySize: "NA",
DevType: "NA",
YearsCoding: "NA",
YearsCodingProf: nil,
JobSatisfaction: nil,
CareerSatisfaction: nil,
HopeFiveYears: nil,
JobSearchStatus: nil,
LastNewJob: nil,
AssessJob1: nil,
AssessJob2: nil,
AssessJob3: nil,
AssessJob4: nil,
AssessJob5: nil,
AssessJob6: nil,
AssessJob7: nil,
AssessJob8: nil,
AssessJob9: nil,
AssessJob10: nil,
AssessBenefits1: nil,
AssessBenefits2: nil,
AssessBenefits3: nil,
AssessBenefits4: nil,
AssessBenefits5: nil,
AssessBenefits6: nil,
AssessBenefits7: nil,
AssessBenefits8: nil,
AssessBenefits9: nil,
AssessBenefits10: nil,
AssessBenefits11: nil,
JobContactPriorities1: nil,
JobContactPriorities2: nil,
JobContactPriorities3: nil,
JobContactPriorities4: nil,
JobContactPriorities5: nil,
JobEmailPriorities1: nil,
JobEmailPriorities2: nil,
JobEmailPriorities3: nil,
JobEmailPriorities4: nil,
JobEmailPriorities5: nil,
JobEmailPriorities6: nil,
JobEmailPriorities7: nil,
UpdateCV: nil,
Currency: nil,
Salary: nil,
SalaryType: nil,
ConvertedSalary: nil,
CurrencySymbol: nil,
CommunicationTools: nil,
TimeFullyProductive: nil,
EducationTypes: nil,
SelfTaughtTypes: nil,
TimeAfterBootcamp: nil,
HackathonReasons: nil,
AgreeDisagree1: nil,
AgreeDisagree2: nil,
AgreeDisagree3: nil,
LanguageWorkedWith: nil,
LanguageDesireNextYear: nil,
DatabaseWorkedWith: nil,
DatabaseDesireNextYear: nil,
PlatformWorkedWith: nil,
PlatformDesireNextYear: nil,
FrameworkWorkedWith: nil,
FrameworkDesireNextYear: nil,
IDE: nil,
OperatingSystem: nil,
NumberMonitors: nil,
Methodology: nil,
VersionControl: nil,
CheckInCode: nil,
AdBlocker: nil,
AdBlockerDisable: nil,
AdBlockerReasons: nil,
AdsAgreeDisagree1: nil,
AdsAgreeDisagree2: nil,
AdsAgreeDisagree3: nil,
AdsActions: nil,
AdsPriorities1: nil,
AdsPriorities2: nil,
AdsPriorities3: nil,
AdsPriorities4: nil,
AdsPriorities5: nil,
AdsPriorities6: nil,
AdsPriorities7: nil,
AIDangerous: nil,
AIInteresting: nil,
AIResponsible: nil,
AIFuture: nil,
EthicsChoice: nil,
EthicsReport: nil,
EthicsResponsible: nil,
EthicalImplications: nil,
StackOverflowRecommend: nil,
StackOverflowVisit: nil,
StackOverflowHasAccount: nil,
StackOverflowParticipate: nil,
StackOverflowJobs: nil,
StackOverflowDevStory: nil,
StackOverflowJobsRecommend: nil,
StackOverflowConsiderMember: nil,
HypotheticalTools1: nil,
HypotheticalTools2: nil,
HypotheticalTools3: nil,
HypotheticalTools4: nil,
HypotheticalTools5: nil,
WakeTime: nil,
HoursComputer: nil,
HoursOutside: nil,
SkipMeals: nil,
ErgonomicDevices: nil,
Exercise: nil,
Gender: nil,
SexualOrientation: nil,
EducationParents: nil,
RaceEthnicity: nil,
Age: nil,
Dependents: nil,
MilitaryUS: nil,
SurveyTooLong: nil,
SurveyEasy: "NA"
)
}

View File

@ -0,0 +1,148 @@
import XCTest
import CSV
final class DecoderTests: XCTestCase {
func testAsyncDecode() throws {
var people: [Person] = []
let contentLength = chunks.reduce(0) { $0 + $1.count }
let decoder = CSVDecoder().async(for: Person.self, length: contentLength) { person in
people.append(person)
}
for chunk in chunks.map({ Array($0.utf8) }) {
try decoder.decode(chunk)
}
XCTAssertEqual(people.count, 6)
XCTAssertEqual(people[0], Person(firstName: "Caleb", lastName: "Kleveter", age: 18, gender: .male, tagLine: "😜"))
XCTAssertEqual(people[1], Person(
firstName: "Benjamin",
lastName: "Franklin",
age: 269,
gender: .male,
tagLine: "A penny saved is a penny earned"
))
XCTAssertEqual(people[2], Person(firstName: "Doc", lastName: "Holliday", age: 174, gender: .male, tagLine: "Bang"))
XCTAssertEqual(people[3], Person(firstName: "Grace", lastName: "Hopper", age: 119, gender: .female, tagLine: nil))
XCTAssertEqual(people[4], Person(
firstName: "Anne",
lastName: "Shirley",
age: 141,
gender: .female,
tagLine: "God's in His heaven,\nall's right with the world"
))
XCTAssertEqual(people[5], Person(firstName: "TinTin", lastName: nil, age: 16, gender: .male, tagLine: "Great snakes!"))
}
func testAsyncDecodeSpeed() throws {
let bytes = chunks.map { Array($0.utf8) }
let contentLength = chunks.reduce(0) { $0 + $1.count }
// Baseline: 0.062
measure {
for _ in 0..<1_000 {
let decoder = CSVDecoder().async(for: Person.self, length: contentLength) { _ in return }
do {
try bytes.forEach(decoder.decode)
} catch let error as DecodingError {
XCTFail(error.failureReason ?? "No failure reason")
error.errorDescription.map { print($0) }
error.recoverySuggestion.map { print($0) }
} catch let error {
XCTFail(error.localizedDescription)
}
}
}
}
func testSyncDecode() throws {
let decoder = CSVDecoder().sync
let people = try decoder.decode(Person.self, from: Data(data.utf8))
XCTAssertEqual(people.count, 6)
XCTAssertEqual(people[0], Person(firstName: "Caleb", lastName: "Kleveter", age: 18, gender: .male, tagLine: "😜"))
XCTAssertEqual(people[1], Person(
firstName: "Benjamin",
lastName: "Franklin",
age: 269,
gender: .male,
tagLine: "A penny saved is a penny earned"
))
XCTAssertEqual(people[2], Person(firstName: "Doc", lastName: "Holliday", age: 174, gender: .male, tagLine: "Bang"))
XCTAssertEqual(people[3], Person(firstName: "Grace", lastName: "Hopper", age: 119, gender: .female, tagLine: nil))
XCTAssertEqual(people[4], Person(
firstName: "Anne",
lastName: "Shirley",
age: 141,
gender: .female,
tagLine: "God's in His heaven,\nall's right with the world"
))
XCTAssertEqual(people[5], Person(firstName: "TinTin", lastName: nil, age: 16, gender: .male, tagLine: "Great snakes!"))
}
func testSyncDecodeSpeed() throws {
let csv = Data(data.utf8)
// Baseline: 0.066
measure {
for _ in 0..<1_000 {
let decoder = CSVDecoder().sync
do {
_ = try decoder.decode(Person.self, from: csv)
} catch let error as DecodingError {
XCTFail(error.failureReason ?? "No failure reason")
error.errorDescription.map { print($0) }
error.recoverySuggestion.map { print($0) }
} catch let error {
XCTFail(error.localizedDescription)
}
}
}
}
}
fileprivate struct Person: Codable, Equatable {
let firstName: String
let lastName: String?
let age: Int
let gender: Gender
let tagLine: String?
enum Gender: String, Codable {
case female = "F"
case male = "M"
}
enum CodingKeys: String, CodingKey {
case firstName = "first name"
case lastName = "last_name"
case age
case gender
case tagLine
}
}
fileprivate let data = """
first name,last_name,age,gender,tagLine
Caleb,Kleveter,18,M,😜\r
Benjamin,Franklin,269,M,A penny saved is a penny earned
"Doc","Holliday","174","M",Bang\r
Grace,Hopper,119,F,
Anne,Shirley,141,F,"God's in His heaven,
all's right with the world"
TinTin,,16,M,Great snakes!
"""
fileprivate let chunks: [String] = [
"first name,last_name,age",
",gender,tagLine\nCaleb,Kleveter,18,M,",
"😜\r\nBenjamin,Franklin,269,M,A penny saved is a ",
"penny earned\n\"",
#"Doc","Holliday","174","M",Bang\#r\#n"#,
"Grace,Hopper,119,F,",
#"\#nAnne,Shirley,141,F,"God's in His heaven,\#n"#,
#"all's right with the world""#,
"\nTinTin,,16,M,Great snakes!"
]

View File

@ -0,0 +1,106 @@
import XCTest
import CSV
final class EncoderTests: XCTestCase {
func testAsyncEncode() throws {
var rows: [[UInt8]] = []
let encoder = CSVEncoder().async { row in rows.append(row) }
for person in people {
try encoder.encode(person)
}
let string = String(decoding: Array(rows.joined(separator: [10])), as: UTF8.self)
XCTAssertEqual(string, expected)
}
func testMeasureAsyncEncode() {
// 0.502
measure {
for _ in 0..<10_000 {
let encoder = CSVEncoder().async { _ in return }
do {
try people.forEach(encoder.encode)
} catch let error as EncodingError {
XCTFail(error.failureReason ?? "No failure reason")
error.errorDescription.map { print($0) }
error.recoverySuggestion.map { print($0) }
} catch let error {
XCTFail(error.localizedDescription)
}
}
}
}
func testSyncEncode() throws {
let encoder = CSVEncoder().sync
let data = try encoder.encode(people)
let string = String(decoding: data, as: UTF8.self)
XCTAssertEqual(string, expected)
}
func testMeasureSyncEncode() {
// 0.583
measure {
for _ in 0..<10_000 {
let encoder = CSVEncoder().sync
do {
_ = try encoder.encode(people)
} catch let error as EncodingError {
XCTFail(error.failureReason ?? "No failure reason")
error.errorDescription.map { print($0) }
error.recoverySuggestion.map { print($0) }
} catch let error {
XCTFail(error.localizedDescription)
}
}
}
}
}
fileprivate struct Person: Codable, Equatable {
let firstName: String
let lastName: String?
let age: Int
let gender: Gender
let tagLine: String?
enum Gender: String, Codable {
case female = "F"
case male = "M"
}
enum CodingKeys: String, CodingKey {
case firstName = "first name"
case lastName = "last_name"
case age
case gender
case tagLine
}
}
fileprivate let people = [
Person(firstName: "Caleb", lastName: "Kleveter", age: 18, gender: .male, tagLine: "😜"),
Person(firstName: "Benjamin", lastName: "Franklin", age: 269, gender: .male, tagLine: "A penny saved is a penny earned"),
Person(firstName: "Doc", lastName: "Holliday", age: 174, gender: .male, tagLine: "Bang"),
Person(firstName: "Grace", lastName: "Hopper", age: 119, gender: .female, tagLine: nil),
Person(
firstName: "Anne", lastName: "Shirley", age: 141, gender: .female,
tagLine: "God's in His heaven,\nall's right with the world"
),
Person(firstName: "TinTin", lastName: nil, age: 16, gender: .male, tagLine: "Great snakes!")
]
fileprivate let expected = """
"first name","last_name","age","gender","tagLine"
"Caleb","Kleveter","18","M","😜"
"Benjamin","Franklin","269","M","A penny saved is a penny earned"
"Doc","Holliday","174","M","Bang"
"Grace","Hopper","119","F",""
"Anne","Shirley","141","F","God's in His heaven,
all's right with the world"
"TinTin","","16","M","Great snakes!"
"""

View File

@ -0,0 +1,135 @@
import CSV
import XCTest
final class ParserTests: XCTestCase {
func testParserInit() {
let parser = Parser(onHeader: nil, onCell: nil)
XCTAssert(parser.onCell == nil)
XCTAssert(parser.onHeader == nil)
}
func testParserParse() {
var headers: [String] = []
var cells: [String: [String?]] = [:]
var parser = Parser(
onHeader: { header in
if let title = String(bytes: header, encoding: .utf8) {
headers.append(title)
}
},
onCell: { header, cell in
if let title = String(bytes: header, encoding: .utf8) {
let contents = cell.count > 0 ? String(bytes: cell, encoding: .utf8) : nil
cells[title, default: []].append(contents)
}
}
)
let csv = Array(data.utf8)
parser.parse(csv)
XCTAssertEqual(headers, ["first name", "last_name", "age", "gender", "tagLine"])
XCTAssertEqual(cells["first name"], ["Caleb", "Benjamin", "Doc", "Grace", "Anne", "TinTin"])
XCTAssertEqual(cells["last_name"], ["Kleveter", "Franklin", "Holliday", "Hopper", "Shirley", nil])
XCTAssertEqual(cells["age"], ["18", "269", "174", "119", "141", "16"])
XCTAssertEqual(cells["gender"], ["M", "M", "M", "F", "F", "M"])
XCTAssertEqual(cells["tagLine"], [
"😜",
"A penny saved is a penny earned",
"Bang",
nil,
"God's in His heaven,\nall's right with the world",
"Great snakes!"
])
}
func testChunkedParsing() {
var headers: [String] = []
var cells: [String: [String?]] = [:]
var parser = Parser(
onHeader: { header in
if let title = String(bytes: header, encoding: .utf8) {
headers.append(title)
}
},
onCell: { header, cell in
if let title = String(bytes: header, encoding: .utf8) {
let contents = cell.count > 0 ? String(bytes: cell, encoding: .utf8) : nil
cells[title, default: []].append(contents)
}
}
)
for chunk in chunks {
let data = Array(chunk.utf8)
parser.parse(data, length: 270)
}
XCTAssertEqual(chunks.reduce(into: "", { $0.append($1) }), data)
XCTAssertEqual(headers, ["first name", "last_name", "age", "gender", "tagLine"])
XCTAssertEqual(cells["first name"], ["Caleb", "Benjamin", "Doc", "Grace", "Anne", "TinTin"])
XCTAssertEqual(cells["last_name"], ["Kleveter", "Franklin", "Holliday", "Hopper", "Shirley", nil])
XCTAssertEqual(cells["age"], ["18", "269", "174", "119", "141", "16"])
XCTAssertEqual(cells["gender"], ["M", "M", "M", "F", "F", "M"])
XCTAssertEqual(cells["tagLine"], [
"😜",
"A penny saved is a penny earned",
"Bang",
nil,
"God's in His heaven,\nall's right with the world",
"Great snakes!"
])
}
func testMeasureFullParse() {
var parser = Parser(onHeader: { _ in return }, onCell: { _, _ in return })
let csv = Array(data.utf8)
// 0.900
measure {
for _ in 0..<100_000 {
parser.parse(csv)
}
}
}
func testMeasureChunkedParse() {
var parser = Parser(onHeader: { _ in return }, onCell: { _, _ in return })
let chnks = chunks.map { Array($0.utf8) }
let length = chnks.reduce(0) { $0 + $1.count }
// 1.198
measure {
for _ in 0..<100_000 {
chnks.forEach { chunk in parser.parse(chunk, length: length) }
}
}
}
}
fileprivate let data = """
first name,last_name,age,gender,tagLine
Caleb,Kleveter,18,M,😜\r
Benjamin,Franklin,269,M,A penny saved is a penny earned
"Doc","Holliday","174","M",Bang\r
Grace,Hopper,119,F,
Anne,Shirley,141,F,"God's in His heaven,
all's right with the world"
TinTin,,16,M,Great snakes!
"""
fileprivate let chunks: [String] = [
"first name,last_name,age",
",gender,tagLine\nCaleb,Kleveter,18,M,",
"😜\r\nBenjamin,Franklin,269,M,A penny saved is a ",
"penny earned\n\"",
#"Doc","Holliday","174","M",Bang\#r\#n"#,
"Grace,Hopper,119,F,",
#"\#nAnne,Shirley,141,F,"God's in His heaven,\#n"#,
#"all's right with the world""#,
"\nTinTin,,16,M,Great snakes!"
]

View File

@ -0,0 +1,149 @@
import XCTest
import CSV
final class SerializerTests: XCTestCase {
func testSyncSerialize() {
let serializer = SyncSerializer()
let serialized = serializer.serialize(orderedData)
let string = String(decoding: serialized, as: UTF8.self)
XCTAssertEqual(string, expected)
}
func testMeasuerSyncSerializer() {
let serializer = SyncSerializer()
// 5.786
measure {
for _ in 0..<100_000 {
_ = serializer.serialize(data)
}
}
}
func testChunkedSerialize() throws {
var rows: [[UInt8]] = []
var serializer = Serializer { row in rows.append(row) }
for chunk in orderedChunks {
try serializer.serialize(chunk).get()
}
let string = String(decoding: Array(rows.joined(separator: [10])), as: UTF8.self)
XCTAssertEqual(string, expected)
}
func testMeasureChunkedSerialize() {
var serializer = Serializer { _ in return }
// 5.504
measure {
for _ in 0..<100_000 {
chunks.forEach { chunk in serializer.serialize(chunk) }
}
}
}
}
fileprivate let orderedData: OrderedKeyedCollection = [
"first name": ["Caleb", "Benjamin", "Doc", "Grace", "Anne", "TinTin"],
"last_name": ["Kleveter", "Franklin", "Holliday", "Hopper", "Shirley", nil],
"age": ["18", "269", "174", "119", "141", "16"],
"gender": ["M", "M", "M", "F", "F", "M"],
"tagLine": [
"😜", "A penny saved is a penny earned", "Bang", nil,
"God's in His heaven,\nall's right with the world", "Great snakes!"
]
]
fileprivate let data = [
"first name": ["Caleb", "Benjamin", "Doc", "Grace", "Anne", "TinTin"],
"last_name": ["Kleveter", "Franklin", "Holliday", "Hopper", "Shirley", nil],
"age": ["18", "269", "174", "119", "141", "16"],
"gender": ["M", "M", "M", "F", "F", "M"],
"tagLine": [
"😜", "A penny saved is a penny earned", "Bang", nil,
"God's in His heaven,\nall's right with the world", "Great snakes!"
]
]
fileprivate let orderedChunks: [OrderedKeyedCollection<String, Array<String?>>] = [
["first name": ["Caleb"], "last_name": ["Kleveter"], "age": ["18"], "gender": ["M"], "tagLine": ["😜"]],
[
"first name": ["Benjamin"], "last_name": ["Franklin"], "age": ["269"], "gender": ["M"],
"tagLine": ["A penny saved is a penny earned"]
],
["first name": ["Doc"], "last_name": ["Holliday"], "age": ["174"], "gender": ["M"], "tagLine": ["Bang"]],
["first name": ["Grace"], "last_name": ["Hopper"], "age": ["119"], "gender": ["F"], "tagLine": [nil]],
[
"first name": ["Anne"], "last_name": ["Shirley"], "age": ["141"], "gender": ["F"],
"tagLine": ["God's in His heaven,\nall's right with the world"]
],
["first name": ["TinTin"], "last_name": [nil], "age": ["16"], "gender": ["M"], "tagLine": ["Great snakes!"]]
]
fileprivate let chunks = [
["first name": ["Caleb"], "last_name": ["Kleveter"], "age": ["18"], "gender": ["M"], "tagLine": ["😜"]],
[
"first name": ["Benjamin"], "last_name": ["Franklin"], "age": ["269"], "gender": ["M"],
"tagLine": ["A penny saved is a penny earned"]
],
["first name": ["Doc"], "last_name": ["Holliday"], "age": ["174"], "gender": ["M"], "tagLine": ["Bang"]],
["first name": ["Grace"], "last_name": ["Hopper"], "age": ["119"], "gender": ["F"], "tagLine": [nil]],
[
"first name": ["Anne"], "last_name": ["Shirley"], "age": ["141"], "gender": ["F"],
"tagLine": ["God's in His heaven,\nall's right with the world"]
],
["first name": ["TinTin"], "last_name": [nil], "age": ["16"], "gender": ["M"], "tagLine": ["Great snakes!"]]
]
fileprivate let expected = """
"first name","last_name","age","gender","tagLine"
"Caleb","Kleveter","18","M","😜"
"Benjamin","Franklin","269","M","A penny saved is a penny earned"
"Doc","Holliday","174","M","Bang"
"Grace","Hopper","119","F",""
"Anne","Shirley","141","F","God's in His heaven,
all's right with the world"
"TinTin","","16","M","Great snakes!"
"""
internal struct OrderedKeyedCollection<K, V>: KeyedCollection, ExpressibleByDictionaryLiteral where K: Hashable {
typealias Index = Int
typealias Element = (key: Key, value: Value)
typealias Key = K
typealias Keys = Array<K>
typealias Value = V
typealias Values = Array<V>
private(set) var keys: Array<K>
private(set) var values: Array<V>
var startIndex: Int {
return self.keys.startIndex
}
var endIndex: Int {
return self.keys.endIndex
}
init(dictionaryLiteral elements: (Key, Value)...) {
self.keys = elements.map { $0.0 }
self.values = elements.map { $0.1 }
}
subscript(position: Int) -> (key: K, value: V) {
get {
return (self.keys[position], self.values[position])
}
set {
self.keys[position] = newValue.key
self.values[position] = newValue.value
}
}
func index(after i: Int) -> Int {
return self.keys.index(after: i)
}
}

View File

@ -0,0 +1,254 @@
import XCTest
import CSV
final class StressTests: XCTestCase {
let codingOptions = CSVCodingOptions(boolCodingStrategy: .fuzzy, nilCodingStrategy: .custom([78, 65]))
let data: Data = {
let string: String
if let envVar = ProcessInfo.processInfo.environment["CSV_STRESS_TEST_DATA"] { string = "file:" + envVar }
else { string = "https://drive.google.com/uc?export=download&id=1_9On2-nsBQIw3JiY43sWbrF8EjrqrR4U" }
let url = URL(string: string)!
return try! Data(contentsOf: url)
}()
func testMeasureAsyncParsing() {
var parser = Parser(onHeader: { _ in return }, onCell: { _, _ in return })
let csv = Array(data)
// Baseline: 4.630
measure {
parser.parse(csv)
}
}
func testMeasureSyncParsing() {
let parser = SyncParser()
let csv = Array(data)
// Baseline: 10.825
// Time to beat: 9.142
measure {
_ = parser.parse(csv)
}
}
func testMeasureAsyncSerialize() {
var serializer = Serializer(onRow: { _ in return })
let csv = Array(data)
let parsed = SyncParser().parse(csv)
// Baseline: 18.957
// Time to beat: 11.932
measure {
serializer.serialize(parsed)
}
}
func testMeasureSyncSerialize() {
let serializer = SyncSerializer()
let csv = Array(data)
let parsed = SyncParser().parse(csv)
// Baseline: 18.047
// Time to beat: 11.932
measure {
_ = serializer.serialize(parsed)
}
}
func testMeasureAsyncDecoding() {
let decoder = CSVDecoder(decodingOptions: self.codingOptions)
// Baseline: 14.347
measure {
do {
let async = decoder.async(
for: Response.self,
length: self.data.count,
{ _ in return }
)
try async.decode(data)
} catch let error {
XCTFail(error.localizedDescription)
}
}
}
func testMeasureSyncDecoding() {
let decoder = CSVDecoder(decodingOptions: self.codingOptions).sync
// Baseline: 19.736
// Time to beat: 18.489
measure {
do {
_ = try decoder.decode(Response.self, from: data)
} catch let error {
XCTFail(error.localizedDescription)
}
}
}
func testMeasureAsyncEncoding() throws {
let people = try CSVDecoder(decodingOptions: self.codingOptions).sync.decode(Response.self, from: data)
let encoder = CSVEncoder(encodingOptions: codingOptions)
// Baseline: 11.477
// Time to beat: 9.477
measure {
do {
let async = encoder.async({ _ in return })
try people.forEach(async.encode)
} catch let error {
XCTFail(error.localizedDescription)
}
}
}
func testMeasureSyncEncoding() throws {
let people = try CSVDecoder(decodingOptions: self.codingOptions).sync.decode(Response.self, from: data)
let encoder = CSVEncoder(encodingOptions: codingOptions).sync
// Baseline: 13.412
// Time to beat: 9.477
measure {
do {
_ = try encoder.encode(people)
} catch let error {
XCTFail(error.localizedDescription)
}
}
}
}
fileprivate struct Response: Codable, Equatable {
let Respondent: Int
let Hobby: Bool
let OpenSource: Bool
let Country: String
let Student: String
let Employment: String
let FormalEducation: String
let UndergradMajor: String?
let CompanySize: String
let DevType: String
let YearsCoding: String
let YearsCodingProf: String?
let JobSatisfaction: String?
let CareerSatisfaction: String?
let HopeFiveYears: String?
let JobSearchStatus: String?
let LastNewJob: String?
let AssessJob1: Int?
let AssessJob2: Int?
let AssessJob3: Int?
let AssessJob4: Int?
let AssessJob5: Int?
let AssessJob6: Int?
let AssessJob7: Int?
let AssessJob8: Int?
let AssessJob9: Int?
let AssessJob10: Int?
let AssessBenefits1: Int?
let AssessBenefits2: Int?
let AssessBenefits3: Int?
let AssessBenefits4: Int?
let AssessBenefits5: Int?
let AssessBenefits6: Int?
let AssessBenefits7: Int?
let AssessBenefits8: Int?
let AssessBenefits9: Int?
let AssessBenefits10: Int?
let AssessBenefits11: Int?
let JobContactPriorities1: Int?
let JobContactPriorities2: Int?
let JobContactPriorities3: Int?
let JobContactPriorities4: Int?
let JobContactPriorities5: Int?
let JobEmailPriorities1: Int?
let JobEmailPriorities2: Int?
let JobEmailPriorities3: Int?
let JobEmailPriorities4: Int?
let JobEmailPriorities5: Int?
let JobEmailPriorities6: Int?
let JobEmailPriorities7: Int?
let UpdateCV: String?
let Currency: String?
let Salary: Float?
let SalaryType: String?
let ConvertedSalary: String?
let CurrencySymbol: String?
let CommunicationTools: String?
let TimeFullyProductive: String?
let EducationTypes: String?
let SelfTaughtTypes: String?
let TimeAfterBootcamp: String?
let HackathonReasons: String?
let AgreeDisagree1: String?
let AgreeDisagree2: String?
let AgreeDisagree3: String?
let LanguageWorkedWith: String?
let LanguageDesireNextYear: String?
let DatabaseWorkedWith: String?
let DatabaseDesireNextYear: String?
let PlatformWorkedWith: String?
let PlatformDesireNextYear: String?
let FrameworkWorkedWith: String?
let FrameworkDesireNextYear: String?
let IDE: String?
let OperatingSystem: String?
let NumberMonitors: String?
let Methodology: String?
let VersionControl: String?
let CheckInCode: String?
let AdBlocker: String?
let AdBlockerDisable: String?
let AdBlockerReasons: String?
let AdsAgreeDisagree1: String?
let AdsAgreeDisagree2: String?
let AdsAgreeDisagree3: String?
let AdsActions: String?
let AdsPriorities1: Int?
let AdsPriorities2: Int?
let AdsPriorities3: Int?
let AdsPriorities4: Int?
let AdsPriorities5: Int?
let AdsPriorities6: Int?
let AdsPriorities7: Int?
let AIDangerous: String?
let AIInteresting: String?
let AIResponsible: String?
let AIFuture: String?
let EthicsChoice: String?
let EthicsReport: String?
let EthicsResponsible: String?
let EthicalImplications: String?
let StackOverflowRecommend: String?
let StackOverflowVisit: String?
let StackOverflowHasAccount: String?
let StackOverflowParticipate: String?
let StackOverflowJobs: String?
let StackOverflowDevStory: String?
let StackOverflowJobsRecommend: String?
let StackOverflowConsiderMember: String?
let HypotheticalTools1: String?
let HypotheticalTools2: String?
let HypotheticalTools3: String?
let HypotheticalTools4: String?
let HypotheticalTools5: String?
let WakeTime: String?
let HoursComputer: String?
let HoursOutside: String?
let SkipMeals: String?
let ErgonomicDevices: String?
let Exercise: String?
let Gender: String?
let SexualOrientation: String?
let EducationParents: String?
let RaceEthnicity: String?
let Age: String?
let Dependents: Bool?
let MilitaryUS: Bool?
let SurveyTooLong: String?
let SurveyEasy: String
}

View File

@ -0,0 +1,60 @@
@testable import CSV
import XCTest
final class UtilityTests: XCTestCase {
let intBytes = "123,456,788,103168".unicodeScalars.map(UInt8.init(ascii:))
let floatBytes = "123,456788.1415925".unicodeScalars.map(UInt8.init(ascii:))
let doubleBytes = "3.1415926535897931".unicodeScalars.map(UInt8.init(ascii:))
func testBytesToInt() {
let int = self.intBytes.int
XCTAssertNotNil(int)
XCTAssertEqual(int, 123_456_788_103_168)
XCTAssertNil(self.floatBytes.int)
XCTAssertNil(self.doubleBytes.int)
}
func testMeasureBytesToInt() {
// 0.005
measure {
for _ in 0..<100_000 {
_ = self.intBytes.int
}
}
}
func testBytesToFloat() {
XCTAssertEqual(self.intBytes.float, 123_456_788_103_168)
XCTAssertEqual(self.floatBytes.float, 123_456_788.1415925)
XCTAssertEqual(self.doubleBytes.float, 3.1415925)
}
func testMeasureBytesToFloat() {
// 0.007
measure {
for _ in 0..<100_000 {
_ = self.floatBytes.float
}
}
}
func testBytesToDouble() {
XCTAssertEqual(self.intBytes.double, 123_456_788_103_168)
XCTAssertEqual(self.floatBytes.double, 123_456_788.1415925)
XCTAssertEqual(self.doubleBytes.double, 3.1415926535897931)
}
func testMeasureBytesToDouble() {
// 0.007
measure {
for _ in 0..<100_000 {
_ = self.doubleBytes.double
}
}
}
}

421
docs/Classes.html Normal file
View File

@ -0,0 +1,421 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Classes Reference</title>
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
<meta charset='utf-8'>
<script src="js/jquery.min.js" defer></script>
<script src="js/jazzy.js" defer></script>
</head>
<body>
<a title="Classes Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="index.html"> Docs</a> (100% documented)</p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="index.html"> Reference</a>
<img id="carat" src="img/carat.png" />
Classes Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Classes/CSVAsyncDecoder.html">CSVAsyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="Classes/CSVAsyncEncoder.html">CSVAsyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="Classes/CSVCodingOptions.html">CSVCodingOptions</a>
</li>
<li class="nav-group-task">
<a href="Classes/CSVDecoder.html">CSVDecoder</a>
</li>
<li class="nav-group-task">
<a href="Classes/CSVEncoder.html">CSVEncoder</a>
</li>
<li class="nav-group-task">
<a href="Classes/CSVSyncDecoder.html">CSVSyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="Classes/CSVSyncEncoder.html">CSVSyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="Classes/SyncParser.html">SyncParser</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Enums/BoolCodingStrategy.html">BoolCodingStrategy</a>
</li>
<li class="nav-group-task">
<a href="Enums/NilCodingStrategy.html">NilCodingStrategy</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Extensions/Array.html">Array</a>
</li>
<li class="nav-group-task">
<a href="Extensions/Optional.html">Optional</a>
</li>
<li class="nav-group-task">
<a href="Extensions/String.html">String</a>
</li>
<li class="nav-group-task">
<a href="Extensions/UInt8.html">UInt8</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Protocols.html">Protocols</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Protocols/BytesRepresentable.html">BytesRepresentable</a>
</li>
<li class="nav-group-task">
<a href="Protocols/KeyedCollection.html">KeyedCollection</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Structs/ErrorList.html">ErrorList</a>
</li>
<li class="nav-group-task">
<a href="Structs/Parser.html">Parser</a>
</li>
<li class="nav-group-task">
<a href="Structs/Serializer.html">Serializer</a>
</li>
<li class="nav-group-task">
<a href="Structs/SyncSerializer.html">SyncSerializer</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>Classes</h1>
<p>The following classes are available globally.</p>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:3CSV10CSVEncoderC"></a>
<a name="//apple_ref/swift/Class/CSVEncoder" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV10CSVEncoderC">CSVEncoder</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Encodes Swift types to CSV data.</p>
<p>This exampls shows how multiple instances of a <code>Person</code> type will be encoded
to CSV data. <code>Person</code> conforms to <code>Codable</code>, so it is compatible with both the
<code>CSVEndocder</code> and <code><a href="Classes/CSVDecoder.html">CSVDecoder</a></code>.</p>
<pre class="highlight swift"><code><span class="kd">struct</span> <span class="kt">Person</span><span class="p">:</span> <span class="kt">Codable</span> <span class="p">{</span>
<span class="k">let</span> <span class="nv">firstName</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
<span class="k">let</span> <span class="nv">lastName</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
<span class="k">let</span> <span class="nv">age</span><span class="p">:</span> <span class="kt">Int</span>
<span class="p">}</span>
<span class="k">let</span> <span class="nv">people</span> <span class="o">=</span> <span class="p">[</span>
<span class="kt">Person</span><span class="p">(</span><span class="nv">firstName</span><span class="p">:</span> <span class="s">"Grace"</span><span class="p">,</span> <span class="nv">lastName</span><span class="p">:</span> <span class="s">"Hopper"</span><span class="p">,</span> <span class="nv">age</span><span class="p">:</span> <span class="mi">113</span><span class="p">),</span>
<span class="kt">Person</span><span class="p">(</span><span class="nv">firstName</span><span class="p">:</span> <span class="s">"Linus"</span><span class="p">,</span> <span class="nv">lastName</span><span class="p">:</span> <span class="s">"Torvold"</span><span class="p">,</span> <span class="nv">age</span><span class="p">:</span> <span class="mi">50</span><span class="p">)</span>
<span class="p">]</span>
<span class="k">let</span> <span class="nv">data</span> <span class="o">=</span> <span class="k">try</span> <span class="kt">CSVEncoder</span><span class="p">()</span><span class="o">.</span><span class="n">sync</span><span class="o">.</span><span class="nf">encode</span><span class="p">(</span><span class="n">people</span><span class="p">)</span>
<span class="nf">print</span><span class="p">(</span><span class="kt">String</span><span class="p">(</span><span class="nv">decoding</span><span class="p">:</span> <span class="n">data</span><span class="p">,</span> <span class="nv">as</span><span class="p">:</span> <span class="kt">UTF8</span><span class="o">.</span><span class="k">self</span><span class="p">))</span>
<span class="cm">/* Prints:
"firstName","lastName","age"
"Grace","Hopper","113"
"Linus","Torvold","50"
*/</span>
</code></pre>
<a href="Classes/CSVEncoder.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">final</span> <span class="kd">class</span> <span class="kt">CSVEncoder</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:3CSV14CSVSyncEncoderC"></a>
<a name="//apple_ref/swift/Class/CSVSyncEncoder" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV14CSVSyncEncoderC">CSVSyncEncoder</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The encoder for encoding multiple objects at once into a single CSV document.</p>
<p>You can get an instance of the <code>CSVSyncEncoder</code> with the <code><a href="Classes/CSVEncoder.html#/s:3CSV10CSVEncoderC4syncAA14CSVSyncEncoderCvp">CSVEncoder.sync</a></code> property.</p>
<a href="Classes/CSVSyncEncoder.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">final</span> <span class="kd">class</span> <span class="kt">CSVSyncEncoder</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:3CSV15CSVAsyncEncoderC"></a>
<a name="//apple_ref/swift/Class/CSVAsyncEncoder" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV15CSVAsyncEncoderC">CSVAsyncEncoder</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>An encoder for encoding multiple objects separately into a single CSV document.</p>
<p>You can get an instance of the <code>CSVAsyncEncoder</code> using the <code><a href="Classes/CSVEncoder.html#/s:3CSV10CSVEncoderC5asyncyAA15CSVAsyncEncoderCySays5UInt8VGcF">CSVEncoder.async(_:)</a></code> method.</p>
<a href="Classes/CSVAsyncEncoder.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">final</span> <span class="kd">class</span> <span class="kt">CSVAsyncEncoder</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:3CSV10CSVDecoderC"></a>
<a name="//apple_ref/swift/Class/CSVDecoder" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV10CSVDecoderC">CSVDecoder</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Decodes CSV document data to Swift types.</p>
<p>This example shows how a simple <code>Person</code> type will be decoded from a CSV document.
Person<code>conforms to</code>Codable<code>, so it is compatible with both the</code>CSVEndocder<code>and</code>CSVDecoder`.</p>
<pre class="highlight swift"><code><span class="kd">struct</span> <span class="kt">Person</span><span class="p">:</span> <span class="kt">Codable</span> <span class="p">{</span>
<span class="k">let</span> <span class="nv">firstName</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
<span class="k">let</span> <span class="nv">lastName</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
<span class="k">let</span> <span class="nv">age</span><span class="p">:</span> <span class="kt">Int</span>
<span class="p">}</span>
<span class="k">let</span> <span class="nv">csv</span> <span class="o">=</span> <span class="s">"""
"</span><span class="n">firstName</span><span class="s">","</span><span class="n">lastName</span><span class="s">","</span><span class="n">age</span><span class="s">"
"</span><span class="kt">Grace</span><span class="s">","</span><span class="kt">Hopper</span><span class="s">","</span><span class="mi">113</span><span class="s">"
"</span><span class="kt">Linus</span><span class="s">","</span><span class="kt">Torvold</span><span class="s">","</span><span class="mi">50</span><span class="s">"
"""</span>
<span class="k">let</span> <span class="nv">data</span> <span class="o">=</span> <span class="kt">Data</span><span class="p">(</span><span class="n">csv</span><span class="o">.</span><span class="n">utf8</span><span class="p">)</span>
<span class="k">let</span> <span class="nv">people</span> <span class="o">=</span> <span class="k">try</span> <span class="kt">CSVDecoder</span><span class="o">.</span><span class="n">sync</span><span class="o">.</span><span class="nf">decode</span><span class="p">(</span><span class="kt">Person</span><span class="o">.</span><span class="k">self</span><span class="p">,</span> <span class="nv">from</span><span class="p">:</span> <span class="n">data</span><span class="p">)</span>
<span class="nf">print</span><span class="p">(</span><span class="n">people</span><span class="o">.</span><span class="n">map</span> <span class="p">{</span> <span class="nv">$0</span><span class="o">.</span><span class="n">firstName</span> <span class="p">})</span> <span class="c1">// Prints: `["Grace","Linus"]`</span>
</code></pre>
<a href="Classes/CSVDecoder.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">final</span> <span class="kd">class</span> <span class="kt">CSVDecoder</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:3CSV14CSVSyncDecoderC"></a>
<a name="//apple_ref/swift/Class/CSVSyncDecoder" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV14CSVSyncDecoderC">CSVSyncDecoder</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>A decoder for decoding a single CSV document all at once.</p>
<p>You can get an instance of <code>CSVSyncDecoder</code> from the <code><a href="Classes/CSVDecoder.html#/s:3CSV10CSVDecoderC4syncAA14CSVSyncDecoderCvp">CSVDecoder.sync</a></code> property.</p>
<a href="Classes/CSVSyncDecoder.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">final</span> <span class="kd">class</span> <span class="kt">CSVSyncDecoder</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:3CSV15CSVAsyncDecoderC"></a>
<a name="//apple_ref/swift/Class/CSVAsyncDecoder" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV15CSVAsyncDecoderC">CSVAsyncDecoder</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>A decoder for decoding sections of a CSV document at different times.</p>
<p>You can get an instance of <code>CSVAsyncDecoder</code> from the <code>CSVDecoder.async(for:length_:)</code> method.</p>
<a href="Classes/CSVAsyncDecoder.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">final</span> <span class="kd">class</span> <span class="kt">CSVAsyncDecoder</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:3CSV16CSVCodingOptionsC"></a>
<a name="//apple_ref/swift/Class/CSVCodingOptions" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV16CSVCodingOptionsC">CSVCodingOptions</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The options used for encoding/decoding certin types in the <code><a href="Classes/CSVEncoder.html">CSVEncoder</a></code> and <code><a href="Classes/CSVDecoder.html">CSVDecoder</a></code>.</p>
<a href="Classes/CSVCodingOptions.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">final</span> <span class="kd">class</span> <span class="kt">CSVCodingOptions</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:3CSV10SyncParserC"></a>
<a name="//apple_ref/swift/Class/SyncParser" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV10SyncParserC">SyncParser</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>A synchronous wrapper for the <code><a href="Structs/Parser.html">Parser</a></code> type for parsing whole CSV documents at once.</p>
<a href="Classes/SyncParser.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">final</span> <span class="kd">class</span> <span class="kt">SyncParser</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>&copy; 2019 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2019-04-19)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>

View File

@ -0,0 +1,207 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>CSVAsyncDecoder Class Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Class/CSVAsyncDecoder" class="dashAnchor"></a>
<a title="CSVAsyncDecoder Class Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="../index.html"> Docs</a> (100% documented)</p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="../index.html"> Reference</a>
<img id="carat" src="../img/carat.png" />
CSVAsyncDecoder Class Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Classes/CSVAsyncDecoder.html">CSVAsyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVAsyncEncoder.html">CSVAsyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVCodingOptions.html">CSVCodingOptions</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVDecoder.html">CSVDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVEncoder.html">CSVEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncDecoder.html">CSVSyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncEncoder.html">CSVSyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/SyncParser.html">SyncParser</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Enums/BoolCodingStrategy.html">BoolCodingStrategy</a>
</li>
<li class="nav-group-task">
<a href="../Enums/NilCodingStrategy.html">NilCodingStrategy</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Extensions/Array.html">Array</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/Optional.html">Optional</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/String.html">String</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/UInt8.html">UInt8</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Protocols.html">Protocols</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Protocols/BytesRepresentable.html">BytesRepresentable</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/KeyedCollection.html">KeyedCollection</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Structs/ErrorList.html">ErrorList</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Parser.html">Parser</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Serializer.html">Serializer</a>
</li>
<li class="nav-group-task">
<a href="../Structs/SyncSerializer.html">SyncSerializer</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>CSVAsyncDecoder</h1>
<div class="declaration">
<div class="language">
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">final</span> <span class="kd">class</span> <span class="kt">CSVAsyncDecoder</span></code></pre>
</div>
</div>
<p>A decoder for decoding sections of a CSV document at different times.</p>
<p>You can get an instance of <code>CSVAsyncDecoder</code> from the <code>CSVDecoder.async(for:length_:)</code> method.</p>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:3CSV15CSVAsyncDecoderC6decodeyyxKSlRzs5UInt8V7ElementRtzlF"></a>
<a name="//apple_ref/swift/Method/decode(_:)" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV15CSVAsyncDecoderC6decodeyyxKSlRzs5UInt8V7ElementRtzlF">decode(_:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Decodes a section of a CSV document to instances of the registered <code>Decodable</code> type.</p>
<p>When a whole row has been parsed from the data passed in, it is decoded and passed into
the <code>.onInstance</code> callback that is registered.</p>
<div class="aside aside-note">
<p class="aside-title">Note</p>
<p>Each chunk of data passed in is assumed to come directly after the previous one
passed in. The chunks may not be passed in out of order.</p>
</div>
<div class="aside aside-throws">
<p class="aside-title">Throws</p>
<p>Errors that occur during the decoding process.</p>
</div>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="n">decode</span><span class="o">&lt;</span><span class="kt">C</span><span class="o">&gt;</span><span class="p">(</span><span class="n">_</span> <span class="nv">data</span><span class="p">:</span> <span class="kt">C</span><span class="p">)</span><span class="k">throws</span> <span class="k">where</span> <span class="kt">C</span><span class="p">:</span> <span class="kt">Collection</span><span class="p">,</span> <span class="kt">C</span><span class="o">.</span><span class="kt">Element</span> <span class="o">==</span> <span class="kt">UInt8</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>data</em>
</code>
</td>
<td>
<div>
<p>A section of the CSV document to decode.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>&copy; 2019 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2019-04-19)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>

View File

@ -0,0 +1,199 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>CSVAsyncEncoder Class Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Class/CSVAsyncEncoder" class="dashAnchor"></a>
<a title="CSVAsyncEncoder Class Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="../index.html"> Docs</a> (100% documented)</p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="../index.html"> Reference</a>
<img id="carat" src="../img/carat.png" />
CSVAsyncEncoder Class Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Classes/CSVAsyncDecoder.html">CSVAsyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVAsyncEncoder.html">CSVAsyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVCodingOptions.html">CSVCodingOptions</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVDecoder.html">CSVDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVEncoder.html">CSVEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncDecoder.html">CSVSyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncEncoder.html">CSVSyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/SyncParser.html">SyncParser</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Enums/BoolCodingStrategy.html">BoolCodingStrategy</a>
</li>
<li class="nav-group-task">
<a href="../Enums/NilCodingStrategy.html">NilCodingStrategy</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Extensions/Array.html">Array</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/Optional.html">Optional</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/String.html">String</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/UInt8.html">UInt8</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Protocols.html">Protocols</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Protocols/BytesRepresentable.html">BytesRepresentable</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/KeyedCollection.html">KeyedCollection</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Structs/ErrorList.html">ErrorList</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Parser.html">Parser</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Serializer.html">Serializer</a>
</li>
<li class="nav-group-task">
<a href="../Structs/SyncSerializer.html">SyncSerializer</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>CSVAsyncEncoder</h1>
<div class="declaration">
<div class="language">
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">final</span> <span class="kd">class</span> <span class="kt">CSVAsyncEncoder</span></code></pre>
</div>
</div>
<p>An encoder for encoding multiple objects separately into a single CSV document.</p>
<p>You can get an instance of the <code>CSVAsyncEncoder</code> using the <code><a href="../Classes/CSVEncoder.html#/s:3CSV10CSVEncoderC5asyncyAA15CSVAsyncEncoderCySays5UInt8VGcF">CSVEncoder.async(_:)</a></code> method.</p>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:3CSV15CSVAsyncEncoderC6encodeyyxKSERzlF"></a>
<a name="//apple_ref/swift/Method/encode(_:)" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV15CSVAsyncEncoderC6encodeyyxKSERzlF">encode(_:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Encodes an <code>Encodable</code> object into a row for a CSV document and passes it into
the <code>onRow</code> closure.</p>
<div class="aside aside-throws">
<p class="aside-title">Throws</p>
Erros that occur when encoding the object passed in.
</div>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="n">encode</span><span class="o">&lt;</span><span class="kt">T</span><span class="o">&gt;</span><span class="p">(</span><span class="n">_</span> <span class="nv">object</span><span class="p">:</span> <span class="kt">T</span><span class="p">)</span><span class="k">throws</span> <span class="k">where</span> <span class="kt">T</span><span class="p">:</span> <span class="kt">Encodable</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>object</em>
</code>
</td>
<td>
<div>
<p>The object to encode to a CSV row.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>&copy; 2019 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2019-04-19)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>

View File

@ -0,0 +1,288 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>CSVCodingOptions Class Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Class/CSVCodingOptions" class="dashAnchor"></a>
<a title="CSVCodingOptions Class Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="../index.html"> Docs</a> (100% documented)</p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="../index.html"> Reference</a>
<img id="carat" src="../img/carat.png" />
CSVCodingOptions Class Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Classes/CSVAsyncDecoder.html">CSVAsyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVAsyncEncoder.html">CSVAsyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVCodingOptions.html">CSVCodingOptions</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVDecoder.html">CSVDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVEncoder.html">CSVEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncDecoder.html">CSVSyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncEncoder.html">CSVSyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/SyncParser.html">SyncParser</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Enums/BoolCodingStrategy.html">BoolCodingStrategy</a>
</li>
<li class="nav-group-task">
<a href="../Enums/NilCodingStrategy.html">NilCodingStrategy</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Extensions/Array.html">Array</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/Optional.html">Optional</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/String.html">String</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/UInt8.html">UInt8</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Protocols.html">Protocols</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Protocols/BytesRepresentable.html">BytesRepresentable</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/KeyedCollection.html">KeyedCollection</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Structs/ErrorList.html">ErrorList</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Parser.html">Parser</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Serializer.html">Serializer</a>
</li>
<li class="nav-group-task">
<a href="../Structs/SyncSerializer.html">SyncSerializer</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>CSVCodingOptions</h1>
<div class="declaration">
<div class="language">
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">final</span> <span class="kd">class</span> <span class="kt">CSVCodingOptions</span></code></pre>
</div>
</div>
<p>The options used for encoding/decoding certin types in the <code><a href="../Classes/CSVEncoder.html">CSVEncoder</a></code> and <code><a href="../Classes/CSVDecoder.html">CSVDecoder</a></code>.</p>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:3CSV16CSVCodingOptionsC7defaultACvpZ"></a>
<a name="//apple_ref/swift/Variable/default" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV16CSVCodingOptionsC7defaultACvpZ">default</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The default coding options.</p>
<p>This option set uses <code>.string</code> for the <code><a href="../Enums/BoolCodingStrategy.html">BoolCodingStrategy</a></code> and <code>.blank</code> for
the <code><a href="../Enums/NilCodingStrategy.html">NilCodingStrategy</a></code>. This means <code>Bool</code> will be represented the value&rsquo;s textual name
and <code>nil</code> will be an empty cell.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">static</span> <span class="kd">let</span> <span class="p">`</span><span class="nv">default</span><span class="p">`</span> <span class="o">=</span> <span class="kt">CSVCodingOptions</span><span class="p">(</span><span class="nv">boolCodingStrategy</span><span class="p">:</span> <span class="o">.</span><span class="n">string</span><span class="p">,</span> <span class="nv">nilCodingStrategy</span><span class="p">:</span> <span class="o">.</span><span class="n">blank</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:3CSV16CSVCodingOptionsC18boolCodingStrategyAA04BooleF0Ovp"></a>
<a name="//apple_ref/swift/Property/boolCodingStrategy" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV16CSVCodingOptionsC18boolCodingStrategyAA04BooleF0Ovp">boolCodingStrategy</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The bool encoding/decoding strategy used for the encoder/decoder the option set is passed to.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">boolCodingStrategy</span><span class="p">:</span> <span class="kt"><a href="../Enums/BoolCodingStrategy.html">BoolCodingStrategy</a></span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:3CSV16CSVCodingOptionsC17nilCodingStrategyAA03NileF0Ovp"></a>
<a name="//apple_ref/swift/Property/nilCodingStrategy" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV16CSVCodingOptionsC17nilCodingStrategyAA03NileF0Ovp">nilCodingStrategy</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The nil encoding/decoding strategy used for the encoder/decoder the option set is passed to.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">nilCodingStrategy</span><span class="p">:</span> <span class="kt"><a href="../Enums/NilCodingStrategy.html">NilCodingStrategy</a></span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:3CSV16CSVCodingOptionsC18boolCodingStrategy03nileF0AcA04BooleF0O_AA03NileF0Otcfc"></a>
<a name="//apple_ref/swift/Method/init(boolCodingStrategy:nilCodingStrategy:)" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV16CSVCodingOptionsC18boolCodingStrategy03nileF0AcA04BooleF0O_AA03NileF0Otcfc">init(boolCodingStrategy:nilCodingStrategy:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Creates a new <code>CSVCodingOptions</code> instance.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">boolCodingStrategy</span><span class="p">:</span> <span class="kt"><a href="../Enums/BoolCodingStrategy.html">BoolCodingStrategy</a></span><span class="p">,</span> <span class="nv">nilCodingStrategy</span><span class="p">:</span> <span class="kt"><a href="../Enums/NilCodingStrategy.html">NilCodingStrategy</a></span><span class="p">)</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>boolCodingStrategy</em>
</code>
</td>
<td>
<div>
<p>The bool encoding/decoding strategy used for the encoder/decoder the option set is passed to.</p>
</div>
</td>
</tr>
<tr>
<td>
<code>
<em>nilCodingStrategy</em>
</code>
</td>
<td>
<div>
<p>The nil encoding/decoding strategy used for the encoder/decoder the option set is passed to.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>&copy; 2019 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2019-04-19)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>

View File

@ -0,0 +1,347 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>CSVDecoder Class Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Class/CSVDecoder" class="dashAnchor"></a>
<a title="CSVDecoder Class Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="../index.html"> Docs</a> (100% documented)</p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="../index.html"> Reference</a>
<img id="carat" src="../img/carat.png" />
CSVDecoder Class Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Classes/CSVAsyncDecoder.html">CSVAsyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVAsyncEncoder.html">CSVAsyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVCodingOptions.html">CSVCodingOptions</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVDecoder.html">CSVDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVEncoder.html">CSVEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncDecoder.html">CSVSyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncEncoder.html">CSVSyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/SyncParser.html">SyncParser</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Enums/BoolCodingStrategy.html">BoolCodingStrategy</a>
</li>
<li class="nav-group-task">
<a href="../Enums/NilCodingStrategy.html">NilCodingStrategy</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Extensions/Array.html">Array</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/Optional.html">Optional</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/String.html">String</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/UInt8.html">UInt8</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Protocols.html">Protocols</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Protocols/BytesRepresentable.html">BytesRepresentable</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/KeyedCollection.html">KeyedCollection</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Structs/ErrorList.html">ErrorList</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Parser.html">Parser</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Serializer.html">Serializer</a>
</li>
<li class="nav-group-task">
<a href="../Structs/SyncSerializer.html">SyncSerializer</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>CSVDecoder</h1>
<div class="declaration">
<div class="language">
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">final</span> <span class="kd">class</span> <span class="kt">CSVDecoder</span></code></pre>
</div>
</div>
<p>Decodes CSV document data to Swift types.</p>
<p>This example shows how a simple <code>Person</code> type will be decoded from a CSV document.
Person<code>conforms to</code>Codable<code>, so it is compatible with both the</code>CSVEndocder<code>and</code>CSVDecoder`.</p>
<pre class="highlight swift"><code><span class="kd">struct</span> <span class="kt">Person</span><span class="p">:</span> <span class="kt">Codable</span> <span class="p">{</span>
<span class="k">let</span> <span class="nv">firstName</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
<span class="k">let</span> <span class="nv">lastName</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
<span class="k">let</span> <span class="nv">age</span><span class="p">:</span> <span class="kt">Int</span>
<span class="p">}</span>
<span class="k">let</span> <span class="nv">csv</span> <span class="o">=</span> <span class="s">"""
"</span><span class="n">firstName</span><span class="s">","</span><span class="n">lastName</span><span class="s">","</span><span class="n">age</span><span class="s">"
"</span><span class="kt">Grace</span><span class="s">","</span><span class="kt">Hopper</span><span class="s">","</span><span class="mi">113</span><span class="s">"
"</span><span class="kt">Linus</span><span class="s">","</span><span class="kt">Torvold</span><span class="s">","</span><span class="mi">50</span><span class="s">"
"""</span>
<span class="k">let</span> <span class="nv">data</span> <span class="o">=</span> <span class="kt">Data</span><span class="p">(</span><span class="n">csv</span><span class="o">.</span><span class="n">utf8</span><span class="p">)</span>
<span class="k">let</span> <span class="nv">people</span> <span class="o">=</span> <span class="k">try</span> <span class="kt">CSVDecoder</span><span class="o">.</span><span class="n">sync</span><span class="o">.</span><span class="nf">decode</span><span class="p">(</span><span class="kt">Person</span><span class="o">.</span><span class="k">self</span><span class="p">,</span> <span class="nv">from</span><span class="p">:</span> <span class="n">data</span><span class="p">)</span>
<span class="nf">print</span><span class="p">(</span><span class="n">people</span><span class="o">.</span><span class="n">map</span> <span class="p">{</span> <span class="nv">$0</span><span class="o">.</span><span class="n">firstName</span> <span class="p">})</span> <span class="c1">// Prints: `["Grace","Linus"]`</span>
</code></pre>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:3CSV10CSVDecoderC15decodingOptionsAA09CSVCodingD0Cvp"></a>
<a name="//apple_ref/swift/Property/decodingOptions" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV10CSVDecoderC15decodingOptionsAA09CSVCodingD0Cvp">decodingOptions</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The decoding options to use when decoding data to an object.</p>
<p>This is currently used to specify how <code>nil</code> and <code>Bool</code> values should be handled.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">decodingOptions</span><span class="p">:</span> <span class="kt"><a href="../Classes/CSVCodingOptions.html">CSVCodingOptions</a></span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:3CSV10CSVDecoderC15decodingOptionsAcA09CSVCodingD0C_tcfc"></a>
<a name="//apple_ref/swift/Method/init(decodingOptions:)" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV10CSVDecoderC15decodingOptionsAcA09CSVCodingD0C_tcfc">init(decodingOptions:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Creates a new <code>CSVDecoder</code> instance.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">decodingOptions</span><span class="p">:</span> <span class="kt"><a href="../Classes/CSVCodingOptions.html">CSVCodingOptions</a></span> <span class="o">=</span> <span class="o">.</span><span class="k">default</span><span class="p">)</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>decodingOptions</em>
</code>
</td>
<td>
<div>
<p>The decoding options to use when decoding data to an object.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:3CSV10CSVDecoderC4syncAA14CSVSyncDecoderCvp"></a>
<a name="//apple_ref/swift/Property/sync" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV10CSVDecoderC4syncAA14CSVSyncDecoderCvp">sync</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Creates a <code><a href="../Classes/CSVSyncDecoder.html">CSVSyncDecoder</a></code> with the registered encoding options.</p>
<p>This decoder is for if you have whole CSV document you want to decode at once.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">sync</span><span class="p">:</span> <span class="kt"><a href="../Classes/CSVSyncDecoder.html">CSVSyncDecoder</a></span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:3CSV10CSVDecoderC5async3for6length_AA15CSVAsyncDecoderCxm_SiyxctSeRzlF"></a>
<a name="//apple_ref/swift/Method/async(for:length:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV10CSVDecoderC5async3for6length_AA15CSVAsyncDecoderCxm_SiyxctSeRzlF">async(for:length:_:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Creates a <code><a href="../Classes/CSVAsyncDecoder.html">CSVAsyncDecoder</a></code> instance with the registered encoding options.</p>
<p>This decoder is for if you have separate chunks of the same CSV document that you will
be decoding at different times.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="n">async</span><span class="o">&lt;</span><span class="kt">D</span><span class="o">&gt;</span><span class="p">(</span><span class="k">for</span> <span class="nv">type</span><span class="p">:</span> <span class="kt">D</span><span class="o">.</span><span class="k">Type</span> <span class="o">=</span> <span class="kt">D</span><span class="o">.</span><span class="k">self</span><span class="p">,</span> <span class="nv">length</span><span class="p">:</span> <span class="kt">Int</span><span class="p">,</span> <span class="n">_</span> <span class="nv">onInstance</span><span class="p">:</span> <span class="kd">@escaping</span> <span class="p">(</span><span class="kt">D</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="p">())</span> <span class="o">-&gt;</span> <span class="kt"><a href="../Classes/CSVAsyncDecoder.html">CSVAsyncDecoder</a></span>
<span class="k">where</span> <span class="kt">D</span><span class="p">:</span> <span class="kt">Decodable</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>type</em>
</code>
</td>
<td>
<div>
<p>The <code>Decodable</code> type that the rows of the CSV document will be decoded to.</p>
</div>
</td>
</tr>
<tr>
<td>
<code>
<em>length</em>
</code>
</td>
<td>
<div>
<p>The content length of the whole CSV document.</p>
</div>
</td>
</tr>
<tr>
<td>
<code>
<em>onInstance</em>
</code>
</td>
<td>
<div>
<p>The closure that is called when an instance of <code>D</code> is decoded from the data passed in.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div>
<h4>Return Value</h4>
<p>A <code><a href="../Classes/CSVAsyncDecoder.html">CSVAsyncDecoder</a></code> instance with the current encoder&rsquo;s encoding options and the
<code>.onInstance</code> closure as its callback.</p>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>&copy; 2019 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2019-04-19)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>

View File

@ -0,0 +1,329 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>CSVEncoder Class Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Class/CSVEncoder" class="dashAnchor"></a>
<a title="CSVEncoder Class Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="../index.html"> Docs</a> (100% documented)</p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="../index.html"> Reference</a>
<img id="carat" src="../img/carat.png" />
CSVEncoder Class Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Classes/CSVAsyncDecoder.html">CSVAsyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVAsyncEncoder.html">CSVAsyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVCodingOptions.html">CSVCodingOptions</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVDecoder.html">CSVDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVEncoder.html">CSVEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncDecoder.html">CSVSyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncEncoder.html">CSVSyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/SyncParser.html">SyncParser</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Enums/BoolCodingStrategy.html">BoolCodingStrategy</a>
</li>
<li class="nav-group-task">
<a href="../Enums/NilCodingStrategy.html">NilCodingStrategy</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Extensions/Array.html">Array</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/Optional.html">Optional</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/String.html">String</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/UInt8.html">UInt8</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Protocols.html">Protocols</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Protocols/BytesRepresentable.html">BytesRepresentable</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/KeyedCollection.html">KeyedCollection</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Structs/ErrorList.html">ErrorList</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Parser.html">Parser</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Serializer.html">Serializer</a>
</li>
<li class="nav-group-task">
<a href="../Structs/SyncSerializer.html">SyncSerializer</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>CSVEncoder</h1>
<div class="declaration">
<div class="language">
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">final</span> <span class="kd">class</span> <span class="kt">CSVEncoder</span></code></pre>
</div>
</div>
<p>Encodes Swift types to CSV data.</p>
<p>This exampls shows how multiple instances of a <code>Person</code> type will be encoded
to CSV data. <code>Person</code> conforms to <code>Codable</code>, so it is compatible with both the
<code>CSVEndocder</code> and <code><a href="../Classes/CSVDecoder.html">CSVDecoder</a></code>.</p>
<pre class="highlight swift"><code><span class="kd">struct</span> <span class="kt">Person</span><span class="p">:</span> <span class="kt">Codable</span> <span class="p">{</span>
<span class="k">let</span> <span class="nv">firstName</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
<span class="k">let</span> <span class="nv">lastName</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
<span class="k">let</span> <span class="nv">age</span><span class="p">:</span> <span class="kt">Int</span>
<span class="p">}</span>
<span class="k">let</span> <span class="nv">people</span> <span class="o">=</span> <span class="p">[</span>
<span class="kt">Person</span><span class="p">(</span><span class="nv">firstName</span><span class="p">:</span> <span class="s">"Grace"</span><span class="p">,</span> <span class="nv">lastName</span><span class="p">:</span> <span class="s">"Hopper"</span><span class="p">,</span> <span class="nv">age</span><span class="p">:</span> <span class="mi">113</span><span class="p">),</span>
<span class="kt">Person</span><span class="p">(</span><span class="nv">firstName</span><span class="p">:</span> <span class="s">"Linus"</span><span class="p">,</span> <span class="nv">lastName</span><span class="p">:</span> <span class="s">"Torvold"</span><span class="p">,</span> <span class="nv">age</span><span class="p">:</span> <span class="mi">50</span><span class="p">)</span>
<span class="p">]</span>
<span class="k">let</span> <span class="nv">data</span> <span class="o">=</span> <span class="k">try</span> <span class="kt">CSVEncoder</span><span class="p">()</span><span class="o">.</span><span class="n">sync</span><span class="o">.</span><span class="nf">encode</span><span class="p">(</span><span class="n">people</span><span class="p">)</span>
<span class="nf">print</span><span class="p">(</span><span class="kt">String</span><span class="p">(</span><span class="nv">decoding</span><span class="p">:</span> <span class="n">data</span><span class="p">,</span> <span class="nv">as</span><span class="p">:</span> <span class="kt">UTF8</span><span class="o">.</span><span class="k">self</span><span class="p">))</span>
<span class="cm">/* Prints:
"firstName","lastName","age"
"Grace","Hopper","113"
"Linus","Torvold","50"
*/</span>
</code></pre>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:3CSV10CSVEncoderC15encodingOptionsAA09CSVCodingD0Cvp"></a>
<a name="//apple_ref/swift/Property/encodingOptions" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV10CSVEncoderC15encodingOptionsAA09CSVCodingD0Cvp">encodingOptions</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The encoding options the use when encoding an object.</p>
<p>Currently, this decideds how <code>nil</code> and <code>bool</code> values should be handled.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">encodingOptions</span><span class="p">:</span> <span class="kt"><a href="../Classes/CSVCodingOptions.html">CSVCodingOptions</a></span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:3CSV10CSVEncoderC15encodingOptionsAcA09CSVCodingD0C_tcfc"></a>
<a name="//apple_ref/swift/Method/init(encodingOptions:)" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV10CSVEncoderC15encodingOptionsAcA09CSVCodingD0C_tcfc">init(encodingOptions:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Creates a new <code>CSVEncoder</code> instance.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">encodingOptions</span><span class="p">:</span> <span class="kt"><a href="../Classes/CSVCodingOptions.html">CSVCodingOptions</a></span> <span class="o">=</span> <span class="o">.</span><span class="k">default</span><span class="p">)</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>encodingOptions</em>
</code>
</td>
<td>
<div>
<p>The encoding options the use when encoding an object.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:3CSV10CSVEncoderC4syncAA14CSVSyncEncoderCvp"></a>
<a name="//apple_ref/swift/Property/sync" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV10CSVEncoderC4syncAA14CSVSyncEncoderCvp">sync</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Creates a <code><a href="../Classes/CSVSyncEncoder.html">CSVSyncEncoder</a></code> using the registered encoding options.</p>
<p>This encoder is for if you have several objects that you want to encode at
a single time into a single document.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">sync</span><span class="p">:</span> <span class="kt"><a href="../Classes/CSVSyncEncoder.html">CSVSyncEncoder</a></span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:3CSV10CSVEncoderC5asyncyAA15CSVAsyncEncoderCySays5UInt8VGcF"></a>
<a name="//apple_ref/swift/Method/async(_:)" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV10CSVEncoderC5asyncyAA15CSVAsyncEncoderCySays5UInt8VGcF">async(_:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Creates a new <code><a href="../Classes/CSVAsyncEncoder.html">CSVAsyncEncoder</a></code> using the registered encoding options.</p>
<p>This encoder is for if you have multiple objects that will be encoded separately,
but into a single document.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">async</span><span class="p">(</span><span class="n">_</span> <span class="nv">onRow</span><span class="p">:</span> <span class="kd">@escaping</span> <span class="p">([</span><span class="kt">UInt8</span><span class="p">])</span> <span class="o">-&gt;</span> <span class="p">())</span> <span class="o">-&gt;</span> <span class="kt"><a href="../Classes/CSVAsyncEncoder.html">CSVAsyncEncoder</a></span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>onRow</em>
</code>
</td>
<td>
<div>
<p>The closure that will be called when each object passed
into the encoder is encoded to a row.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div>
<h4>Return Value</h4>
<p>A <code><a href="../Classes/CSVAsyncEncoder.html">CSVAsyncEncoder</a></code> instance with the current encoder&rsquo;s encoding
options and the <code>onRow</code> closure as its callback.</p>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>&copy; 2019 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2019-04-19)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>

View File

@ -0,0 +1,214 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>CSVSyncDecoder Class Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Class/CSVSyncDecoder" class="dashAnchor"></a>
<a title="CSVSyncDecoder Class Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="../index.html"> Docs</a> (100% documented)</p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="../index.html"> Reference</a>
<img id="carat" src="../img/carat.png" />
CSVSyncDecoder Class Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Classes/CSVAsyncDecoder.html">CSVAsyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVAsyncEncoder.html">CSVAsyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVCodingOptions.html">CSVCodingOptions</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVDecoder.html">CSVDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVEncoder.html">CSVEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncDecoder.html">CSVSyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncEncoder.html">CSVSyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/SyncParser.html">SyncParser</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Enums/BoolCodingStrategy.html">BoolCodingStrategy</a>
</li>
<li class="nav-group-task">
<a href="../Enums/NilCodingStrategy.html">NilCodingStrategy</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Extensions/Array.html">Array</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/Optional.html">Optional</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/String.html">String</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/UInt8.html">UInt8</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Protocols.html">Protocols</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Protocols/BytesRepresentable.html">BytesRepresentable</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/KeyedCollection.html">KeyedCollection</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Structs/ErrorList.html">ErrorList</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Parser.html">Parser</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Serializer.html">Serializer</a>
</li>
<li class="nav-group-task">
<a href="../Structs/SyncSerializer.html">SyncSerializer</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>CSVSyncDecoder</h1>
<div class="declaration">
<div class="language">
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">final</span> <span class="kd">class</span> <span class="kt">CSVSyncDecoder</span></code></pre>
</div>
</div>
<p>A decoder for decoding a single CSV document all at once.</p>
<p>You can get an instance of <code>CSVSyncDecoder</code> from the <code><a href="../Classes/CSVDecoder.html#/s:3CSV10CSVDecoderC4syncAA14CSVSyncDecoderCvp">CSVDecoder.sync</a></code> property.</p>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:3CSV14CSVSyncDecoderC6decode_4fromSayxGxm_10Foundation4DataVtKSeRzlF"></a>
<a name="//apple_ref/swift/Method/decode(_:from:)" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV14CSVSyncDecoderC6decode_4fromSayxGxm_10Foundation4DataVtKSeRzlF">decode(_:from:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Decodes a whole CSV document into an array of a specified <code>Decodable</code> type.</p>
<div class="aside aside-throws">
<p class="aside-title">Throws</p>
<p>Errors that occur during the decoding proccess.</p>
</div>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="n">decode</span><span class="o">&lt;</span><span class="kt">D</span><span class="o">&gt;</span><span class="p">(</span><span class="n">_</span> <span class="nv">type</span><span class="p">:</span> <span class="kt">D</span><span class="o">.</span><span class="k">Type</span> <span class="o">=</span> <span class="kt">D</span><span class="o">.</span><span class="k">self</span><span class="p">,</span> <span class="n">from</span> <span class="nv">data</span><span class="p">:</span> <span class="kt">Data</span><span class="p">)</span><span class="k">throws</span> <span class="o">-&gt;</span> <span class="p">[</span><span class="kt">D</span><span class="p">]</span> <span class="k">where</span> <span class="kt">D</span><span class="p">:</span> <span class="kt">Decodable</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>type</em>
</code>
</td>
<td>
<div>
<p>The <code>Decodable</code> type to decode the CSV rows to.</p>
</div>
</td>
</tr>
<tr>
<td>
<code>
<em>data</em>
</code>
</td>
<td>
<div>
<p>The CSV data to decode.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div>
<h4>Return Value</h4>
<p>An array of <code>D</code> instances, decoded from the data passed in.</p>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>&copy; 2019 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2019-04-19)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>

View File

@ -0,0 +1,202 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>CSVSyncEncoder Class Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Class/CSVSyncEncoder" class="dashAnchor"></a>
<a title="CSVSyncEncoder Class Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="../index.html"> Docs</a> (100% documented)</p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="../index.html"> Reference</a>
<img id="carat" src="../img/carat.png" />
CSVSyncEncoder Class Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Classes/CSVAsyncDecoder.html">CSVAsyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVAsyncEncoder.html">CSVAsyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVCodingOptions.html">CSVCodingOptions</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVDecoder.html">CSVDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVEncoder.html">CSVEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncDecoder.html">CSVSyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncEncoder.html">CSVSyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/SyncParser.html">SyncParser</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Enums/BoolCodingStrategy.html">BoolCodingStrategy</a>
</li>
<li class="nav-group-task">
<a href="../Enums/NilCodingStrategy.html">NilCodingStrategy</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Extensions/Array.html">Array</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/Optional.html">Optional</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/String.html">String</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/UInt8.html">UInt8</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Protocols.html">Protocols</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Protocols/BytesRepresentable.html">BytesRepresentable</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/KeyedCollection.html">KeyedCollection</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Structs/ErrorList.html">ErrorList</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Parser.html">Parser</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Serializer.html">Serializer</a>
</li>
<li class="nav-group-task">
<a href="../Structs/SyncSerializer.html">SyncSerializer</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>CSVSyncEncoder</h1>
<div class="declaration">
<div class="language">
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">final</span> <span class="kd">class</span> <span class="kt">CSVSyncEncoder</span></code></pre>
</div>
</div>
<p>The encoder for encoding multiple objects at once into a single CSV document.</p>
<p>You can get an instance of the <code>CSVSyncEncoder</code> with the <code><a href="../Classes/CSVEncoder.html#/s:3CSV10CSVEncoderC4syncAA14CSVSyncEncoderCvp">CSVEncoder.sync</a></code> property.</p>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:3CSV14CSVSyncEncoderC6encodey10Foundation4DataVSayxGKSERzlF"></a>
<a name="//apple_ref/swift/Method/encode(_:)" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV14CSVSyncEncoderC6encodey10Foundation4DataVSayxGKSERzlF">encode(_:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Encodes an array of encodable objects into a single CSV document.</p>
<div class="aside aside-throws">
<p class="aside-title">Throws</p>
<p>Encoding errors that occur when encoding the given objects.</p>
</div>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="n">encode</span><span class="o">&lt;</span><span class="kt">T</span><span class="o">&gt;</span><span class="p">(</span><span class="n">_</span> <span class="nv">objects</span><span class="p">:</span> <span class="p">[</span><span class="kt">T</span><span class="p">])</span><span class="k">throws</span> <span class="o">-&gt;</span> <span class="kt">Data</span> <span class="k">where</span> <span class="kt">T</span><span class="p">:</span> <span class="kt">Encodable</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>objects</em>
</code>
</td>
<td>
<div>
<p>The objects to encode to CSV rows.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div>
<h4>Return Value</h4>
<p>The data for the CSV document.</p>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>&copy; 2019 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2019-04-19)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>

View File

@ -0,0 +1,274 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>SyncParser Class Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Class/SyncParser" class="dashAnchor"></a>
<a title="SyncParser Class Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="../index.html"> Docs</a> (100% documented)</p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="../index.html"> Reference</a>
<img id="carat" src="../img/carat.png" />
SyncParser Class Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Classes/CSVAsyncDecoder.html">CSVAsyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVAsyncEncoder.html">CSVAsyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVCodingOptions.html">CSVCodingOptions</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVDecoder.html">CSVDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVEncoder.html">CSVEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncDecoder.html">CSVSyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncEncoder.html">CSVSyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/SyncParser.html">SyncParser</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Enums/BoolCodingStrategy.html">BoolCodingStrategy</a>
</li>
<li class="nav-group-task">
<a href="../Enums/NilCodingStrategy.html">NilCodingStrategy</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Extensions/Array.html">Array</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/Optional.html">Optional</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/String.html">String</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/UInt8.html">UInt8</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Protocols.html">Protocols</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Protocols/BytesRepresentable.html">BytesRepresentable</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/KeyedCollection.html">KeyedCollection</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Structs/ErrorList.html">ErrorList</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Parser.html">Parser</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Serializer.html">Serializer</a>
</li>
<li class="nav-group-task">
<a href="../Structs/SyncSerializer.html">SyncSerializer</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>SyncParser</h1>
<div class="declaration">
<div class="language">
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">final</span> <span class="kd">class</span> <span class="kt">SyncParser</span></code></pre>
</div>
</div>
<p>A synchronous wrapper for the <code><a href="../Structs/Parser.html">Parser</a></code> type for parsing whole CSV documents at once.</p>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:3CSV10SyncParserCACycfc"></a>
<a name="//apple_ref/swift/Method/init()" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV10SyncParserCACycfc">init()</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Creates a new <code>SyncParser</code> instance</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">()</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:3CSV10SyncParserC5parseySDySays5UInt8VGSayAGSgGGAGF"></a>
<a name="//apple_ref/swift/Method/parse(_:)" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV10SyncParserC5parseySDySays5UInt8VGSayAGSgGGAGF">parse(_:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Parses a whole CSV document at once.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">parse</span><span class="p">(</span><span class="n">_</span> <span class="nv">data</span><span class="p">:</span> <span class="p">[</span><span class="kt">UInt8</span><span class="p">])</span> <span class="o">-&gt;</span> <span class="p">[[</span><span class="kt">UInt8</span><span class="p">]:</span> <span class="p">[[</span><span class="kt">UInt8</span><span class="p">]?]]</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>data</em>
</code>
</td>
<td>
<div>
<p>The CSV data to parse.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div>
<h4>Return Value</h4>
<p>A dictionary containing the parsed CSV data. The keys are the column names
and the values are the column cells. A <code>nil</code> value is an empty cell.</p>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:3CSV10SyncParserC5parseySDySSSaySSSgGGSSF"></a>
<a name="//apple_ref/swift/Method/parse(_:)" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV10SyncParserC5parseySDySSSaySSSgGGSSF">parse(_:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Parses a whole CSV document at once from a <code>String</code>.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">parse</span><span class="p">(</span><span class="n">_</span> <span class="nv">data</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="p">[</span><span class="kt">String</span><span class="p">:</span> <span class="p">[</span><span class="kt">String</span><span class="p">?]]</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>data</em>
</code>
</td>
<td>
<div>
<p>The CSV data to parse.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div>
<h4>Return Value</h4>
<p>A dictionary containing the parsed CSV data. The keys are the column names
and the values are the column cells. A <code>nil</code> value is an empty cell.</p>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>&copy; 2019 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2019-04-19)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>

194
docs/Enums.html Normal file
View File

@ -0,0 +1,194 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Enumerations Reference</title>
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
<meta charset='utf-8'>
<script src="js/jquery.min.js" defer></script>
<script src="js/jazzy.js" defer></script>
</head>
<body>
<a title="Enumerations Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="index.html"> Docs</a> (100% documented)</p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="index.html"> Reference</a>
<img id="carat" src="img/carat.png" />
Enumerations Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Classes/CSVAsyncDecoder.html">CSVAsyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="Classes/CSVAsyncEncoder.html">CSVAsyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="Classes/CSVCodingOptions.html">CSVCodingOptions</a>
</li>
<li class="nav-group-task">
<a href="Classes/CSVDecoder.html">CSVDecoder</a>
</li>
<li class="nav-group-task">
<a href="Classes/CSVEncoder.html">CSVEncoder</a>
</li>
<li class="nav-group-task">
<a href="Classes/CSVSyncDecoder.html">CSVSyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="Classes/CSVSyncEncoder.html">CSVSyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="Classes/SyncParser.html">SyncParser</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Enums/BoolCodingStrategy.html">BoolCodingStrategy</a>
</li>
<li class="nav-group-task">
<a href="Enums/NilCodingStrategy.html">NilCodingStrategy</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Extensions/Array.html">Array</a>
</li>
<li class="nav-group-task">
<a href="Extensions/Optional.html">Optional</a>
</li>
<li class="nav-group-task">
<a href="Extensions/String.html">String</a>
</li>
<li class="nav-group-task">
<a href="Extensions/UInt8.html">UInt8</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Protocols.html">Protocols</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Protocols/BytesRepresentable.html">BytesRepresentable</a>
</li>
<li class="nav-group-task">
<a href="Protocols/KeyedCollection.html">KeyedCollection</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Structs/ErrorList.html">ErrorList</a>
</li>
<li class="nav-group-task">
<a href="Structs/Parser.html">Parser</a>
</li>
<li class="nav-group-task">
<a href="Structs/Serializer.html">Serializer</a>
</li>
<li class="nav-group-task">
<a href="Structs/SyncSerializer.html">SyncSerializer</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>Enumerations</h1>
<p>The following enumerations are available globally.</p>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:3CSV18BoolCodingStrategyO"></a>
<a name="//apple_ref/swift/Enum/BoolCodingStrategy" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV18BoolCodingStrategyO">BoolCodingStrategy</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The encoding/decodig strategies used on boolean values in a CSV document.</p>
<a href="Enums/BoolCodingStrategy.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">BoolCodingStrategy</span><span class="p">:</span> <span class="kt">Hashable</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:3CSV17NilCodingStrategyO"></a>
<a name="//apple_ref/swift/Enum/NilCodingStrategy" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV17NilCodingStrategyO">NilCodingStrategy</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The encoding/decoding strategies used for <code>nil</code> values in a CSV document.</p>
<a href="Enums/NilCodingStrategy.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">NilCodingStrategy</span><span class="p">:</span> <span class="kt">Hashable</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>&copy; 2019 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2019-04-19)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>

View File

@ -0,0 +1,404 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>BoolCodingStrategy Enumeration Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Enum/BoolCodingStrategy" class="dashAnchor"></a>
<a title="BoolCodingStrategy Enumeration Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="../index.html"> Docs</a> (100% documented)</p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="../index.html"> Reference</a>
<img id="carat" src="../img/carat.png" />
BoolCodingStrategy Enumeration Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Classes/CSVAsyncDecoder.html">CSVAsyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVAsyncEncoder.html">CSVAsyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVCodingOptions.html">CSVCodingOptions</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVDecoder.html">CSVDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVEncoder.html">CSVEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncDecoder.html">CSVSyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncEncoder.html">CSVSyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/SyncParser.html">SyncParser</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Enums/BoolCodingStrategy.html">BoolCodingStrategy</a>
</li>
<li class="nav-group-task">
<a href="../Enums/NilCodingStrategy.html">NilCodingStrategy</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Extensions/Array.html">Array</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/Optional.html">Optional</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/String.html">String</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/UInt8.html">UInt8</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Protocols.html">Protocols</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Protocols/BytesRepresentable.html">BytesRepresentable</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/KeyedCollection.html">KeyedCollection</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Structs/ErrorList.html">ErrorList</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Parser.html">Parser</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Serializer.html">Serializer</a>
</li>
<li class="nav-group-task">
<a href="../Structs/SyncSerializer.html">SyncSerializer</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>BoolCodingStrategy</h1>
<div class="declaration">
<div class="language">
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">BoolCodingStrategy</span><span class="p">:</span> <span class="kt">Hashable</span></code></pre>
</div>
</div>
<p>The encoding/decodig strategies used on boolean values in a CSV document.</p>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:3CSV18BoolCodingStrategyO7integeryA2CmF"></a>
<a name="//apple_ref/swift/Element/integer" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV18BoolCodingStrategyO7integeryA2CmF">integer</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The bools are represented by their number counter part, <code>false</code> is <code>0</code> and <code>true</code> is <code>1</code>.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">integer</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:3CSV18BoolCodingStrategyO6stringyA2CmF"></a>
<a name="//apple_ref/swift/Element/string" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV18BoolCodingStrategyO6stringyA2CmF">string</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The bools are represented by their textual counter parts, <code>false</code> is <code>&quot;false&quot;</code> and <code>true</code> is <code>&quot;true&quot;</code>.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">string</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:3CSV18BoolCodingStrategyO5fuzzyyA2CmF"></a>
<a name="//apple_ref/swift/Element/fuzzy" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV18BoolCodingStrategyO5fuzzyyA2CmF">fuzzy</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The bools are checked against multiple different values when they are decoded.
They are encoded to their string values.</p>
<p>When decoding data with this strategy, the characters in the data are lowercased and it is then
checked against <code>true</code>, <code>yes</code>, <code>y</code>, <code>y</code>, and <code>1</code> for true and <code>false</code>, <code>no</code>, <code>f</code>, <code>n</code>, and <code>0</code> for false.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">fuzzy</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:3CSV18BoolCodingStrategyO6customyACSays5UInt8VG_AGtcACmF"></a>
<a name="//apple_ref/swift/Element/custom(true:false:)" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV18BoolCodingStrategyO6customyACSays5UInt8VG_AGtcACmF">custom(true:false:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>A custom coding strategy with any given representations for the <code>true</code> and <code>false</code> values.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">custom</span><span class="p">(`</span><span class="nv">true</span><span class="p">`:</span> <span class="p">[</span><span class="kt">UInt8</span><span class="p">],`</span><span class="nv">false</span><span class="p">`:</span> <span class="p">[</span><span class="kt">UInt8</span><span class="p">])</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>true</em>
</code>
</td>
<td>
<div>
<p>The value that <code>true</code> gets converted to, and that <code>true</code> is represented by in the CSV document.</p>
</div>
</td>
</tr>
<tr>
<td>
<code>
<em>false</em>
</code>
</td>
<td>
<div>
<p>The value that <code>false</code> gets converted to, and that <code>false</code> is represented by in the CSV document.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:3CSV18BoolCodingStrategyO5bytes4fromSays5UInt8VGSb_tF"></a>
<a name="//apple_ref/swift/Method/bytes(from:)" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV18BoolCodingStrategyO5bytes4fromSays5UInt8VGSb_tF">bytes(from:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Converts a <code>Bool</code> value to the bytes the reporesent it, given the current strategy.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">bytes</span><span class="p">(</span><span class="n">from</span> <span class="nv">bool</span><span class="p">:</span> <span class="kt">Bool</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="p">[</span><span class="kt">UInt8</span><span class="p">]</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>bool</em>
</code>
</td>
<td>
<div>
<p>The <code>Bool</code> instance to get the bytes for.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div>
<h4>Return Value</h4>
<p>The bytes value for the bool passed in.</p>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:3CSV18BoolCodingStrategyO4bool4fromSbSgSays5UInt8VG_tF"></a>
<a name="//apple_ref/swift/Method/bool(from:)" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV18BoolCodingStrategyO4bool4fromSbSgSays5UInt8VG_tF">bool(from:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Attempts get a <code>Bool</code> value from given bytes using the current strategy.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">bool</span><span class="p">(</span><span class="n">from</span> <span class="nv">bytes</span><span class="p">:</span> <span class="p">[</span><span class="kt">UInt8</span><span class="p">])</span> <span class="o">-&gt;</span> <span class="kt">Bool</span><span class="p">?</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>bytes</em>
</code>
</td>
<td>
<div>
<p>The bytes to chek against the expected value for the given strategy.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div>
<h4>Return Value</h4>
<p>The <code>Bool</code> value for the bytes passed in, or <code>nil</code> if no match is found.</p>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>&copy; 2019 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2019-04-19)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>

View File

@ -0,0 +1,338 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>NilCodingStrategy Enumeration Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Enum/NilCodingStrategy" class="dashAnchor"></a>
<a title="NilCodingStrategy Enumeration Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="../index.html"> Docs</a> (100% documented)</p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="../index.html"> Reference</a>
<img id="carat" src="../img/carat.png" />
NilCodingStrategy Enumeration Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Classes/CSVAsyncDecoder.html">CSVAsyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVAsyncEncoder.html">CSVAsyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVCodingOptions.html">CSVCodingOptions</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVDecoder.html">CSVDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVEncoder.html">CSVEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncDecoder.html">CSVSyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncEncoder.html">CSVSyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/SyncParser.html">SyncParser</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Enums/BoolCodingStrategy.html">BoolCodingStrategy</a>
</li>
<li class="nav-group-task">
<a href="../Enums/NilCodingStrategy.html">NilCodingStrategy</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Extensions/Array.html">Array</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/Optional.html">Optional</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/String.html">String</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/UInt8.html">UInt8</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Protocols.html">Protocols</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Protocols/BytesRepresentable.html">BytesRepresentable</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/KeyedCollection.html">KeyedCollection</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Structs/ErrorList.html">ErrorList</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Parser.html">Parser</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Serializer.html">Serializer</a>
</li>
<li class="nav-group-task">
<a href="../Structs/SyncSerializer.html">SyncSerializer</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>NilCodingStrategy</h1>
<div class="declaration">
<div class="language">
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">NilCodingStrategy</span><span class="p">:</span> <span class="kt">Hashable</span></code></pre>
</div>
</div>
<p>The encoding/decoding strategies used for <code>nil</code> values in a CSV document.</p>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:3CSV17NilCodingStrategyO5blankyA2CmF"></a>
<a name="//apple_ref/swift/Element/blank" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV17NilCodingStrategyO5blankyA2CmF">blank</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>A <code>nil</code> value is represented by an empty cell.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">blank</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:3CSV17NilCodingStrategyO2nayA2CmF"></a>
<a name="//apple_ref/swift/Element/na" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV17NilCodingStrategyO2nayA2CmF">na</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>A <code>nil</code> value is represented by <code>N/A</code> as a cell&rsquo;s contents.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">na</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:3CSV17NilCodingStrategyO6customyACSays5UInt8VGcACmF"></a>
<a name="//apple_ref/swift/Element/custom(_:)" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV17NilCodingStrategyO6customyACSays5UInt8VGcACmF">custom(_:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>A <code>nil</code> value is represented by a custom set of bytes.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">custom</span><span class="p">(</span><span class="n">_</span> <span class="nv">bytes</span><span class="p">:</span> <span class="p">[</span><span class="kt">UInt8</span><span class="p">])</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>bytes</em>
</code>
</td>
<td>
<div>
<p>The bytes that represent <code>nil</code> in the CSV document.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:3CSV17NilCodingStrategyO5bytesSays5UInt8VGyF"></a>
<a name="//apple_ref/swift/Method/bytes()" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV17NilCodingStrategyO5bytesSays5UInt8VGyF">bytes()</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Gets the bytes that represent <code>nil</code> with the current strategy.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">bytes</span><span class="p">()</span> <span class="o">-&gt;</span> <span class="p">[</span><span class="kt">UInt8</span><span class="p">]</span></code></pre>
</div>
</div>
<div>
<h4>Return Value</h4>
<p><code>nil</code>, represented by a byte array.</p>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:3CSV17NilCodingStrategyO6isNullySbSays5UInt8VGF"></a>
<a name="//apple_ref/swift/Method/isNull(_:)" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV17NilCodingStrategyO6isNullySbSays5UInt8VGF">isNull(_:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Checks to see if a given array of bytes represents <code>nil</code> with the current strategy.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">isNull</span><span class="p">(</span><span class="n">_</span> <span class="nv">bytes</span><span class="p">:</span> <span class="p">[</span><span class="kt">UInt8</span><span class="p">])</span> <span class="o">-&gt;</span> <span class="kt">Bool</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>bytes</em>
</code>
</td>
<td>
<div>
<p>The bytes to match against the current strategy.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div>
<h4>Return Value</h4>
<p>A <code>Bool</code> indicating whether the bytes passed in represent <code>nil</code> or not.</p>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>&copy; 2019 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2019-04-19)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>

257
docs/Extensions.html Normal file
View File

@ -0,0 +1,257 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Extensions Reference</title>
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
<meta charset='utf-8'>
<script src="js/jquery.min.js" defer></script>
<script src="js/jazzy.js" defer></script>
</head>
<body>
<a title="Extensions Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="index.html"> Docs</a> (100% documented)</p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="index.html"> Reference</a>
<img id="carat" src="img/carat.png" />
Extensions Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Classes/CSVAsyncDecoder.html">CSVAsyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="Classes/CSVAsyncEncoder.html">CSVAsyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="Classes/CSVCodingOptions.html">CSVCodingOptions</a>
</li>
<li class="nav-group-task">
<a href="Classes/CSVDecoder.html">CSVDecoder</a>
</li>
<li class="nav-group-task">
<a href="Classes/CSVEncoder.html">CSVEncoder</a>
</li>
<li class="nav-group-task">
<a href="Classes/CSVSyncDecoder.html">CSVSyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="Classes/CSVSyncEncoder.html">CSVSyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="Classes/SyncParser.html">SyncParser</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Enums/BoolCodingStrategy.html">BoolCodingStrategy</a>
</li>
<li class="nav-group-task">
<a href="Enums/NilCodingStrategy.html">NilCodingStrategy</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Extensions/Array.html">Array</a>
</li>
<li class="nav-group-task">
<a href="Extensions/Optional.html">Optional</a>
</li>
<li class="nav-group-task">
<a href="Extensions/String.html">String</a>
</li>
<li class="nav-group-task">
<a href="Extensions/UInt8.html">UInt8</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Protocols.html">Protocols</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Protocols/BytesRepresentable.html">BytesRepresentable</a>
</li>
<li class="nav-group-task">
<a href="Protocols/KeyedCollection.html">KeyedCollection</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Structs/ErrorList.html">ErrorList</a>
</li>
<li class="nav-group-task">
<a href="Structs/Parser.html">Parser</a>
</li>
<li class="nav-group-task">
<a href="Structs/Serializer.html">Serializer</a>
</li>
<li class="nav-group-task">
<a href="Structs/SyncSerializer.html">SyncSerializer</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>Extensions</h1>
<p>The following extensions are available globally.</p>
</section>
<section class="section task-group-section">
<div class="task-group">
<div class="task-name-container">
<a name="/Coding%20Key%20Interactions"></a>
<a name="//apple_ref/swift/Section/Coding Key Interactions" class="dashAnchor"></a>
<a href="#/Coding%20Key%20Interactions">
<h3 class="section-name">Coding Key Interactions</h3>
</a>
</div>
<ul>
<li class="item">
<div>
<code>
<a name="/s:s5UInt8V"></a>
<a name="//apple_ref/swift/Extension/UInt8" class="dashAnchor"></a>
<a class="token" href="#/s:s5UInt8V">UInt8</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<a href="Extensions/UInt8.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">struct</span> <span class="kt">UInt8</span> <span class="p">:</span> <span class="kt">FixedWidthInteger</span><span class="p">,</span> <span class="kt">UnsignedInteger</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:Sa"></a>
<a name="//apple_ref/swift/Extension/Array" class="dashAnchor"></a>
<a class="token" href="#/s:Sa">Array</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<a href="Extensions/Array.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">struct</span> <span class="kt">Array</span><span class="o">&lt;</span><span class="kt">Element</span><span class="o">&gt;</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:SS"></a>
<a name="//apple_ref/swift/Extension/String" class="dashAnchor"></a>
<a class="token" href="#/s:SS">String</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<a href="Extensions/String.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">struct</span> <span class="kt">String</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:Sq"></a>
<a name="//apple_ref/swift/Extension/Optional" class="dashAnchor"></a>
<a class="token" href="#/s:Sq">Optional</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<a href="Extensions/Optional.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">enum</span> <span class="kt">Optional</span><span class="o">&lt;</span><span class="kt">Wrapped</span><span class="o">&gt;</span> <span class="p">:</span> <span class="kt">ExpressibleByNilLiteral</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>&copy; 2019 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2019-04-19)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>

261
docs/Extensions/Array.html Normal file
View File

@ -0,0 +1,261 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Array Extension Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Extension/Array" class="dashAnchor"></a>
<a title="Array Extension Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="../index.html"> Docs</a> (100% documented)</p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="../index.html"> Reference</a>
<img id="carat" src="../img/carat.png" />
Array Extension Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Classes/CSVAsyncDecoder.html">CSVAsyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVAsyncEncoder.html">CSVAsyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVCodingOptions.html">CSVCodingOptions</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVDecoder.html">CSVDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVEncoder.html">CSVEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncDecoder.html">CSVSyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncEncoder.html">CSVSyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/SyncParser.html">SyncParser</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Enums/BoolCodingStrategy.html">BoolCodingStrategy</a>
</li>
<li class="nav-group-task">
<a href="../Enums/NilCodingStrategy.html">NilCodingStrategy</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Extensions/Array.html">Array</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/Optional.html">Optional</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/String.html">String</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/UInt8.html">UInt8</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Protocols.html">Protocols</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Protocols/BytesRepresentable.html">BytesRepresentable</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/KeyedCollection.html">KeyedCollection</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Structs/ErrorList.html">ErrorList</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Parser.html">Parser</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Serializer.html">Serializer</a>
</li>
<li class="nav-group-task">
<a href="../Structs/SyncSerializer.html">SyncSerializer</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>Array</h1>
<div class="declaration">
<div class="language">
<pre class="highlight swift"><code><span class="kd">struct</span> <span class="kt">Array</span><span class="o">&lt;</span><span class="kt">Element</span><span class="o">&gt;</span></code></pre>
</div>
</div>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:s33ExpressibleByUnicodeScalarLiteralP07unicodedE0x0cdE4TypeQz_tcfc"></a>
<a name="//apple_ref/swift/Method/init(unicodeScalarLiteral:)" class="dashAnchor"></a>
<a class="token" href="#/s:s33ExpressibleByUnicodeScalarLiteralP07unicodedE0x0cdE4TypeQz_tcfc">init(unicodeScalarLiteral:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="n">unicodeScalarLiteral</span> <span class="nv">value</span><span class="p">:</span> <span class="kt">UnicodeScalar</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:s43ExpressibleByExtendedGraphemeClusterLiteralP08extendeddeF0x0cdeF4TypeQz_tcfc"></a>
<a name="//apple_ref/swift/Method/init(extendedGraphemeClusterLiteral:)" class="dashAnchor"></a>
<a class="token" href="#/s:s43ExpressibleByExtendedGraphemeClusterLiteralP08extendeddeF0x0cdeF4TypeQz_tcfc">init(extendedGraphemeClusterLiteral:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="n">extendedGraphemeClusterLiteral</span> <span class="nv">value</span><span class="p">:</span> <span class="kt">Character</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:s26ExpressibleByStringLiteralP06stringD0x0cD4TypeQz_tcfc"></a>
<a name="//apple_ref/swift/Method/init(stringLiteral:)" class="dashAnchor"></a>
<a class="token" href="#/s:s26ExpressibleByStringLiteralP06stringD0x0cD4TypeQz_tcfc">init(stringLiteral:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="n">stringLiteral</span> <span class="nv">value</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:Sa3CSVs5UInt8VRszlE5bytesSayACGvp"></a>
<a name="//apple_ref/swift/Property/bytes" class="dashAnchor"></a>
<a class="token" href="#/s:Sa3CSVs5UInt8VRszlE5bytesSayACGvp">bytes</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Returns <code>Self</code>.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">bytes</span><span class="p">:</span> <span class="p">[</span><span class="kt">UInt8</span><span class="p">]</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>&copy; 2019 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2019-04-19)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>

View File

@ -0,0 +1,171 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Optional Extension Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Extension/Optional" class="dashAnchor"></a>
<a title="Optional Extension Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="../index.html"> Docs</a> (100% documented)</p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="../index.html"> Reference</a>
<img id="carat" src="../img/carat.png" />
Optional Extension Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Classes/CSVAsyncDecoder.html">CSVAsyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVAsyncEncoder.html">CSVAsyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVCodingOptions.html">CSVCodingOptions</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVDecoder.html">CSVDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVEncoder.html">CSVEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncDecoder.html">CSVSyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncEncoder.html">CSVSyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/SyncParser.html">SyncParser</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Enums/BoolCodingStrategy.html">BoolCodingStrategy</a>
</li>
<li class="nav-group-task">
<a href="../Enums/NilCodingStrategy.html">NilCodingStrategy</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Extensions/Array.html">Array</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/Optional.html">Optional</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/String.html">String</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/UInt8.html">UInt8</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Protocols.html">Protocols</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Protocols/BytesRepresentable.html">BytesRepresentable</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/KeyedCollection.html">KeyedCollection</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Structs/ErrorList.html">ErrorList</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Parser.html">Parser</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Serializer.html">Serializer</a>
</li>
<li class="nav-group-task">
<a href="../Structs/SyncSerializer.html">SyncSerializer</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>Optional</h1>
<div class="declaration">
<div class="language">
<pre class="highlight swift"><code><span class="kd">enum</span> <span class="kt">Optional</span><span class="o">&lt;</span><span class="kt">Wrapped</span><span class="o">&gt;</span> <span class="p">:</span> <span class="kt">ExpressibleByNilLiteral</span></code></pre>
</div>
</div>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:Sq3CSVAA18BytesRepresentableRzlE5bytesSays5UInt8VGvp"></a>
<a name="//apple_ref/swift/Property/bytes" class="dashAnchor"></a>
<a class="token" href="#/s:Sq3CSVAA18BytesRepresentableRzlE5bytesSays5UInt8VGvp">bytes</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The wrapped value&rsquo;s bytes or an empty <code>Array</code>.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">bytes</span><span class="p">:</span> <span class="p">[</span><span class="kt">UInt8</span><span class="p">]</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>&copy; 2019 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2019-04-19)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>

171
docs/Extensions/String.html Normal file
View File

@ -0,0 +1,171 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>String Extension Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Extension/String" class="dashAnchor"></a>
<a title="String Extension Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="../index.html"> Docs</a> (100% documented)</p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="../index.html"> Reference</a>
<img id="carat" src="../img/carat.png" />
String Extension Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Classes/CSVAsyncDecoder.html">CSVAsyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVAsyncEncoder.html">CSVAsyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVCodingOptions.html">CSVCodingOptions</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVDecoder.html">CSVDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVEncoder.html">CSVEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncDecoder.html">CSVSyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncEncoder.html">CSVSyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/SyncParser.html">SyncParser</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Enums/BoolCodingStrategy.html">BoolCodingStrategy</a>
</li>
<li class="nav-group-task">
<a href="../Enums/NilCodingStrategy.html">NilCodingStrategy</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Extensions/Array.html">Array</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/Optional.html">Optional</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/String.html">String</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/UInt8.html">UInt8</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Protocols.html">Protocols</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Protocols/BytesRepresentable.html">BytesRepresentable</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/KeyedCollection.html">KeyedCollection</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Structs/ErrorList.html">ErrorList</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Parser.html">Parser</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Serializer.html">Serializer</a>
</li>
<li class="nav-group-task">
<a href="../Structs/SyncSerializer.html">SyncSerializer</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>String</h1>
<div class="declaration">
<div class="language">
<pre class="highlight swift"><code><span class="kd">struct</span> <span class="kt">String</span></code></pre>
</div>
</div>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:SS3CSVE5bytesSays5UInt8VGvp"></a>
<a name="//apple_ref/swift/Property/bytes" class="dashAnchor"></a>
<a class="token" href="#/s:SS3CSVE5bytesSays5UInt8VGvp">bytes</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The string&rsquo;s UTF-* view converted to an <code>Array</code>.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">bytes</span><span class="p">:</span> <span class="p">[</span><span class="kt">UInt8</span><span class="p">]</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>&copy; 2019 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2019-04-19)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>

170
docs/Extensions/UInt8.html Normal file
View File

@ -0,0 +1,170 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>UInt8 Extension Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Extension/UInt8" class="dashAnchor"></a>
<a title="UInt8 Extension Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="../index.html"> Docs</a> (100% documented)</p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="../index.html"> Reference</a>
<img id="carat" src="../img/carat.png" />
UInt8 Extension Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Classes/CSVAsyncDecoder.html">CSVAsyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVAsyncEncoder.html">CSVAsyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVCodingOptions.html">CSVCodingOptions</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVDecoder.html">CSVDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVEncoder.html">CSVEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncDecoder.html">CSVSyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncEncoder.html">CSVSyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/SyncParser.html">SyncParser</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Enums/BoolCodingStrategy.html">BoolCodingStrategy</a>
</li>
<li class="nav-group-task">
<a href="../Enums/NilCodingStrategy.html">NilCodingStrategy</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Extensions/Array.html">Array</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/Optional.html">Optional</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/String.html">String</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/UInt8.html">UInt8</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Protocols.html">Protocols</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Protocols/BytesRepresentable.html">BytesRepresentable</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/KeyedCollection.html">KeyedCollection</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Structs/ErrorList.html">ErrorList</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Parser.html">Parser</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Serializer.html">Serializer</a>
</li>
<li class="nav-group-task">
<a href="../Structs/SyncSerializer.html">SyncSerializer</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>UInt8</h1>
<div class="declaration">
<div class="language">
<pre class="highlight swift"><code><span class="kd">struct</span> <span class="kt">UInt8</span> <span class="p">:</span> <span class="kt">FixedWidthInteger</span><span class="p">,</span> <span class="kt">UnsignedInteger</span></code></pre>
</div>
</div>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:s33ExpressibleByUnicodeScalarLiteralP07unicodedE0x0cdE4TypeQz_tcfc"></a>
<a name="//apple_ref/swift/Method/init(unicodeScalarLiteral:)" class="dashAnchor"></a>
<a class="token" href="#/s:s33ExpressibleByUnicodeScalarLiteralP07unicodedE0x0cdE4TypeQz_tcfc">init(unicodeScalarLiteral:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="n">unicodeScalarLiteral</span> <span class="nv">value</span><span class="p">:</span> <span class="kt">UnicodeScalar</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>&copy; 2019 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2019-04-19)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>

197
docs/Protocols.html Normal file
View File

@ -0,0 +1,197 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Protocols Reference</title>
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
<meta charset='utf-8'>
<script src="js/jquery.min.js" defer></script>
<script src="js/jazzy.js" defer></script>
</head>
<body>
<a title="Protocols Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="index.html"> Docs</a> (100% documented)</p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="index.html"> Reference</a>
<img id="carat" src="img/carat.png" />
Protocols Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Classes/CSVAsyncDecoder.html">CSVAsyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="Classes/CSVAsyncEncoder.html">CSVAsyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="Classes/CSVCodingOptions.html">CSVCodingOptions</a>
</li>
<li class="nav-group-task">
<a href="Classes/CSVDecoder.html">CSVDecoder</a>
</li>
<li class="nav-group-task">
<a href="Classes/CSVEncoder.html">CSVEncoder</a>
</li>
<li class="nav-group-task">
<a href="Classes/CSVSyncDecoder.html">CSVSyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="Classes/CSVSyncEncoder.html">CSVSyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="Classes/SyncParser.html">SyncParser</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Enums/BoolCodingStrategy.html">BoolCodingStrategy</a>
</li>
<li class="nav-group-task">
<a href="Enums/NilCodingStrategy.html">NilCodingStrategy</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Extensions/Array.html">Array</a>
</li>
<li class="nav-group-task">
<a href="Extensions/Optional.html">Optional</a>
</li>
<li class="nav-group-task">
<a href="Extensions/String.html">String</a>
</li>
<li class="nav-group-task">
<a href="Extensions/UInt8.html">UInt8</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Protocols.html">Protocols</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Protocols/BytesRepresentable.html">BytesRepresentable</a>
</li>
<li class="nav-group-task">
<a href="Protocols/KeyedCollection.html">KeyedCollection</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Structs/ErrorList.html">ErrorList</a>
</li>
<li class="nav-group-task">
<a href="Structs/Parser.html">Parser</a>
</li>
<li class="nav-group-task">
<a href="Structs/Serializer.html">Serializer</a>
</li>
<li class="nav-group-task">
<a href="Structs/SyncSerializer.html">SyncSerializer</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>Protocols</h1>
<p>The following protocols are available globally.</p>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:3CSV18BytesRepresentableP"></a>
<a name="//apple_ref/swift/Protocol/BytesRepresentable" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV18BytesRepresentableP">BytesRepresentable</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The type where an instance can be represented by an array of bytes (<code>UInt8</code>).</p>
<a href="Protocols/BytesRepresentable.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">BytesRepresentable</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:3CSV15KeyedCollectionP"></a>
<a name="//apple_ref/swift/Protocol/KeyedCollection" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV15KeyedCollectionP">KeyedCollection</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>A <code>Collection</code> type that contains keyed values.</p>
<p>This protocol acts as an abstraction over <code>Dictionary</code> for the <code><a href="Structs/Serializer.html">Serializer</a></code> type. It is mostly
for testing purposes but you can also conform your own types if you want.</p>
<a href="Protocols/KeyedCollection.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">KeyedCollection</span><span class="p">:</span> <span class="kt">Collection</span> <span class="k">where</span> <span class="k">Self</span><span class="o">.</span><span class="kt">Element</span> <span class="o">==</span> <span class="p">(</span><span class="nv">key</span><span class="p">:</span> <span class="kt">Key</span><span class="p">,</span> <span class="nv">value</span><span class="p">:</span> <span class="kt">Value</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>&copy; 2019 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2019-04-19)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>

View File

@ -0,0 +1,172 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>BytesRepresentable Protocol Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Protocol/BytesRepresentable" class="dashAnchor"></a>
<a title="BytesRepresentable Protocol Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="../index.html"> Docs</a> (100% documented)</p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="../index.html"> Reference</a>
<img id="carat" src="../img/carat.png" />
BytesRepresentable Protocol Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Classes/CSVAsyncDecoder.html">CSVAsyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVAsyncEncoder.html">CSVAsyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVCodingOptions.html">CSVCodingOptions</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVDecoder.html">CSVDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVEncoder.html">CSVEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncDecoder.html">CSVSyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncEncoder.html">CSVSyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/SyncParser.html">SyncParser</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Enums/BoolCodingStrategy.html">BoolCodingStrategy</a>
</li>
<li class="nav-group-task">
<a href="../Enums/NilCodingStrategy.html">NilCodingStrategy</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Extensions/Array.html">Array</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/Optional.html">Optional</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/String.html">String</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/UInt8.html">UInt8</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Protocols.html">Protocols</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Protocols/BytesRepresentable.html">BytesRepresentable</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/KeyedCollection.html">KeyedCollection</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Structs/ErrorList.html">ErrorList</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Parser.html">Parser</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Serializer.html">Serializer</a>
</li>
<li class="nav-group-task">
<a href="../Structs/SyncSerializer.html">SyncSerializer</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>BytesRepresentable</h1>
<div class="declaration">
<div class="language">
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">BytesRepresentable</span></code></pre>
</div>
</div>
<p>The type where an instance can be represented by an array of bytes (<code>UInt8</code>).</p>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:3CSV18BytesRepresentableP5bytesSays5UInt8VGvp"></a>
<a name="//apple_ref/swift/Property/bytes" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV18BytesRepresentableP5bytesSays5UInt8VGvp">bytes</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The bytes that represent the given instance of <code>Self</code>.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">var</span> <span class="nv">bytes</span><span class="p">:</span> <span class="p">[</span><span class="kt">UInt8</span><span class="p">]</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>&copy; 2019 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2019-04-19)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>

View File

@ -0,0 +1,310 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>KeyedCollection Protocol Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Protocol/KeyedCollection" class="dashAnchor"></a>
<a title="KeyedCollection Protocol Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="../index.html"> Docs</a> (100% documented)</p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="../index.html"> Reference</a>
<img id="carat" src="../img/carat.png" />
KeyedCollection Protocol Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Classes/CSVAsyncDecoder.html">CSVAsyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVAsyncEncoder.html">CSVAsyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVCodingOptions.html">CSVCodingOptions</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVDecoder.html">CSVDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVEncoder.html">CSVEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncDecoder.html">CSVSyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncEncoder.html">CSVSyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/SyncParser.html">SyncParser</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Enums/BoolCodingStrategy.html">BoolCodingStrategy</a>
</li>
<li class="nav-group-task">
<a href="../Enums/NilCodingStrategy.html">NilCodingStrategy</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Extensions/Array.html">Array</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/Optional.html">Optional</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/String.html">String</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/UInt8.html">UInt8</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Protocols.html">Protocols</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Protocols/BytesRepresentable.html">BytesRepresentable</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/KeyedCollection.html">KeyedCollection</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Structs/ErrorList.html">ErrorList</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Parser.html">Parser</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Serializer.html">Serializer</a>
</li>
<li class="nav-group-task">
<a href="../Structs/SyncSerializer.html">SyncSerializer</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>KeyedCollection</h1>
<div class="declaration">
<div class="language">
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">KeyedCollection</span><span class="p">:</span> <span class="kt">Collection</span> <span class="k">where</span> <span class="k">Self</span><span class="o">.</span><span class="kt">Element</span> <span class="o">==</span> <span class="p">(</span><span class="nv">key</span><span class="p">:</span> <span class="kt">Key</span><span class="p">,</span> <span class="nv">value</span><span class="p">:</span> <span class="kt">Value</span><span class="p">)</span></code></pre>
</div>
</div>
<p>A <code>Collection</code> type that contains keyed values.</p>
<p>This protocol acts as an abstraction over <code>Dictionary</code> for the <code><a href="../Structs/Serializer.html">Serializer</a></code> type. It is mostly
for testing purposes but you can also conform your own types if you want.</p>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:3CSV15KeyedCollectionP3KeyQa"></a>
<a name="//apple_ref/swift/Alias/Key" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV15KeyedCollectionP3KeyQa">Key</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The type of a key for a given value.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">associatedtype</span> <span class="kt">Key</span><span class="p">:</span> <span class="kt">Hashable</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:3CSV15KeyedCollectionP4KeysQa"></a>
<a name="//apple_ref/swift/Alias/Keys" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV15KeyedCollectionP4KeysQa">Keys</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The collection type for a list of the collection&rsquo;s keys.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">associatedtype</span> <span class="kt">Keys</span><span class="p">:</span> <span class="kt">Collection</span> <span class="k">where</span> <span class="kt">Keys</span><span class="o">.</span><span class="kt">Element</span> <span class="o">==</span> <span class="kt"><a href="../Protocols/KeyedCollection.html#/s:3CSV15KeyedCollectionP3KeyQa">Key</a></span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:3CSV15KeyedCollectionP5ValueQa"></a>
<a name="//apple_ref/swift/Alias/Value" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV15KeyedCollectionP5ValueQa">Value</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The type of a value.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">associatedtype</span> <span class="kt">Value</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:3CSV15KeyedCollectionP6ValuesQa"></a>
<a name="//apple_ref/swift/Alias/Values" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV15KeyedCollectionP6ValuesQa">Values</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The collection type for a list of the collection&rsquo;s values.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">associatedtype</span> <span class="kt">Values</span><span class="p">:</span> <span class="kt">Collection</span> <span class="k">where</span> <span class="kt">Values</span><span class="o">.</span><span class="kt">Element</span> <span class="o">==</span> <span class="kt"><a href="../Protocols/KeyedCollection.html#/s:3CSV15KeyedCollectionP5ValueQa">Value</a></span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:3CSV15KeyedCollectionP4keys4KeysQzvp"></a>
<a name="//apple_ref/swift/Property/keys" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV15KeyedCollectionP4keys4KeysQzvp">keys</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>All the collection&rsquo;s keyes.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">var</span> <span class="nv">keys</span><span class="p">:</span> <span class="kt"><a href="../Protocols/KeyedCollection.html#/s:3CSV15KeyedCollectionP4KeysQa">Keys</a></span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:3CSV15KeyedCollectionP6values6ValuesQzvp"></a>
<a name="//apple_ref/swift/Property/values" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV15KeyedCollectionP6values6ValuesQzvp">values</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>All the collection&rsquo;s values.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">var</span> <span class="nv">values</span><span class="p">:</span> <span class="kt"><a href="../Protocols/KeyedCollection.html#/s:3CSV15KeyedCollectionP6ValuesQa">Values</a></span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>&copy; 2019 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2019-04-19)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>

264
docs/Structs.html Normal file
View File

@ -0,0 +1,264 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Structures Reference</title>
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
<meta charset='utf-8'>
<script src="js/jquery.min.js" defer></script>
<script src="js/jazzy.js" defer></script>
</head>
<body>
<a title="Structures Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="index.html"> Docs</a> (100% documented)</p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="index.html"> Reference</a>
<img id="carat" src="img/carat.png" />
Structures Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Classes/CSVAsyncDecoder.html">CSVAsyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="Classes/CSVAsyncEncoder.html">CSVAsyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="Classes/CSVCodingOptions.html">CSVCodingOptions</a>
</li>
<li class="nav-group-task">
<a href="Classes/CSVDecoder.html">CSVDecoder</a>
</li>
<li class="nav-group-task">
<a href="Classes/CSVEncoder.html">CSVEncoder</a>
</li>
<li class="nav-group-task">
<a href="Classes/CSVSyncDecoder.html">CSVSyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="Classes/CSVSyncEncoder.html">CSVSyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="Classes/SyncParser.html">SyncParser</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Enums/BoolCodingStrategy.html">BoolCodingStrategy</a>
</li>
<li class="nav-group-task">
<a href="Enums/NilCodingStrategy.html">NilCodingStrategy</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Extensions/Array.html">Array</a>
</li>
<li class="nav-group-task">
<a href="Extensions/Optional.html">Optional</a>
</li>
<li class="nav-group-task">
<a href="Extensions/String.html">String</a>
</li>
<li class="nav-group-task">
<a href="Extensions/UInt8.html">UInt8</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Protocols.html">Protocols</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Protocols/BytesRepresentable.html">BytesRepresentable</a>
</li>
<li class="nav-group-task">
<a href="Protocols/KeyedCollection.html">KeyedCollection</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Structs/ErrorList.html">ErrorList</a>
</li>
<li class="nav-group-task">
<a href="Structs/Parser.html">Parser</a>
</li>
<li class="nav-group-task">
<a href="Structs/Serializer.html">Serializer</a>
</li>
<li class="nav-group-task">
<a href="Structs/SyncSerializer.html">SyncSerializer</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>Structures</h1>
<p>The following structures are available globally.</p>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:3CSV9ErrorListV"></a>
<a name="//apple_ref/swift/Struct/ErrorList" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV9ErrorListV">ErrorList</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Wraps an accumulated list of errors.</p>
<a href="Structs/ErrorList.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">ErrorList</span><span class="p">:</span> <span class="kt">Error</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:3CSV6ParserV"></a>
<a name="//apple_ref/swift/Struct/Parser" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV6ParserV">Parser</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>A parser for streaming <code>CSV</code> data.</p>
<div class="aside aside-note">
<p class="aside-title">Note</p>
You should create a new <code>Parser</code> instance for each CSV document you parse.
</div>
<a href="Structs/Parser.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">Parser</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:3CSV10SerializerV"></a>
<a name="//apple_ref/swift/Struct/Serializer" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV10SerializerV">Serializer</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Serializes dictionary data to CSV document data.</p>
<div class="aside aside-note">
<p class="aside-title">Note</p>
You should create a new <code>Serializer</code> dictionary you serialize.
</div>
<a href="Structs/Serializer.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">Serializer</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:3CSV14SyncSerializerV"></a>
<a name="//apple_ref/swift/Struct/SyncSerializer" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV14SyncSerializerV">SyncSerializer</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>A synchronous wrapper for the <code><a href="Structs/Serializer.html">Serializer</a></code> struct for parsing a whole CSV document.</p>
<a href="Structs/SyncSerializer.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">SyncSerializer</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>&copy; 2019 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2019-04-19)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>

218
docs/Structs/ErrorList.html Normal file
View File

@ -0,0 +1,218 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>ErrorList Structure Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Struct/ErrorList" class="dashAnchor"></a>
<a title="ErrorList Structure Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="../index.html"> Docs</a> (100% documented)</p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="../index.html"> Reference</a>
<img id="carat" src="../img/carat.png" />
ErrorList Structure Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Classes/CSVAsyncDecoder.html">CSVAsyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVAsyncEncoder.html">CSVAsyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVCodingOptions.html">CSVCodingOptions</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVDecoder.html">CSVDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVEncoder.html">CSVEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncDecoder.html">CSVSyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncEncoder.html">CSVSyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/SyncParser.html">SyncParser</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Enums/BoolCodingStrategy.html">BoolCodingStrategy</a>
</li>
<li class="nav-group-task">
<a href="../Enums/NilCodingStrategy.html">NilCodingStrategy</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Extensions/Array.html">Array</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/Optional.html">Optional</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/String.html">String</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/UInt8.html">UInt8</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Protocols.html">Protocols</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Protocols/BytesRepresentable.html">BytesRepresentable</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/KeyedCollection.html">KeyedCollection</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Structs/ErrorList.html">ErrorList</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Parser.html">Parser</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Serializer.html">Serializer</a>
</li>
<li class="nav-group-task">
<a href="../Structs/SyncSerializer.html">SyncSerializer</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>ErrorList</h1>
<div class="declaration">
<div class="language">
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">ErrorList</span><span class="p">:</span> <span class="kt">Error</span></code></pre>
</div>
</div>
<p>Wraps an accumulated list of errors.</p>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:3CSV9ErrorListV6errorsSays0B0_pGvp"></a>
<a name="//apple_ref/swift/Property/errors" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV9ErrorListV6errorsSays0B0_pGvp">errors</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>A list of errors from a repeating operation.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">errors</span><span class="p">:</span> <span class="p">[</span><span class="kt">Error</span><span class="p">]</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:3CSV9ErrorListV6errorsACSays0B0_pG_tcfc"></a>
<a name="//apple_ref/swift/Method/init(errors:)" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV9ErrorListV6errorsACSays0B0_pG_tcfc">init(errors:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Creates a new <code>ErrorList</code> instance.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">errors</span><span class="p">:</span> <span class="p">[</span><span class="kt">Error</span><span class="p">]</span> <span class="o">=</span> <span class="p">[])</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>errors</em>
</code>
</td>
<td>
<div>
<p>The initial errors to populate the <code><a href="../Structs/ErrorList.html#/s:3CSV9ErrorListV6errorsSays0B0_pGvp">errors</a></code> array. Defaults to an empty array.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>&copy; 2019 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2019-04-19)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>

435
docs/Structs/Parser.html Normal file
View File

@ -0,0 +1,435 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Parser Structure Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Struct/Parser" class="dashAnchor"></a>
<a title="Parser Structure Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="../index.html"> Docs</a> (100% documented)</p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="../index.html"> Reference</a>
<img id="carat" src="../img/carat.png" />
Parser Structure Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Classes/CSVAsyncDecoder.html">CSVAsyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVAsyncEncoder.html">CSVAsyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVCodingOptions.html">CSVCodingOptions</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVDecoder.html">CSVDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVEncoder.html">CSVEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncDecoder.html">CSVSyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncEncoder.html">CSVSyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/SyncParser.html">SyncParser</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Enums/BoolCodingStrategy.html">BoolCodingStrategy</a>
</li>
<li class="nav-group-task">
<a href="../Enums/NilCodingStrategy.html">NilCodingStrategy</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Extensions/Array.html">Array</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/Optional.html">Optional</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/String.html">String</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/UInt8.html">UInt8</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Protocols.html">Protocols</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Protocols/BytesRepresentable.html">BytesRepresentable</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/KeyedCollection.html">KeyedCollection</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Structs/ErrorList.html">ErrorList</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Parser.html">Parser</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Serializer.html">Serializer</a>
</li>
<li class="nav-group-task">
<a href="../Structs/SyncSerializer.html">SyncSerializer</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>Parser</h1>
<div class="declaration">
<div class="language">
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">Parser</span></code></pre>
</div>
</div>
<p>A parser for streaming <code>CSV</code> data.</p>
<div class="aside aside-note">
<p class="aside-title">Note</p>
You should create a new <code>Parser</code> instance for each CSV document you parse.
</div>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:3CSV6ParserV13HeaderHandlera"></a>
<a name="//apple_ref/swift/Alias/HeaderHandler" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV6ParserV13HeaderHandlera">HeaderHandler</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The type of handler that gets called when a header is parsed.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">typealias</span> <span class="kt">HeaderHandler</span> <span class="o">=</span> <span class="p">(</span><span class="n">_</span> <span class="nv">title</span><span class="p">:</span> <span class="p">[</span><span class="kt">UInt8</span><span class="p">])</span><span class="k">throws</span> <span class="o">-&gt;</span> <span class="p">()</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>title</em>
</code>
</td>
<td>
<div>
<p>The data for the header that is parsed.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:3CSV6ParserV11CellHandlera"></a>
<a name="//apple_ref/swift/Alias/CellHandler" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV6ParserV11CellHandlera">CellHandler</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The type of handler that gets called when a cell is parsed.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">typealias</span> <span class="kt">CellHandler</span> <span class="o">=</span> <span class="p">(</span><span class="n">_</span> <span class="nv">title</span><span class="p">:</span> <span class="p">[</span><span class="kt">UInt8</span><span class="p">],</span> <span class="n">_</span> <span class="nv">contents</span><span class="p">:</span> <span class="p">[</span><span class="kt">UInt8</span><span class="p">])</span><span class="k">throws</span> <span class="o">-&gt;</span> <span class="p">()</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>title</em>
</code>
</td>
<td>
<div>
<p>The header for the cell that is parsed.</p>
</div>
</td>
</tr>
<tr>
<td>
<code>
<em>contents</em>
</code>
</td>
<td>
<div>
<p>The data for the cell that is parsed.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:3CSV6ParserV8onHeaderySays5UInt8VGKcSgvp"></a>
<a name="//apple_ref/swift/Property/onHeader" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV6ParserV8onHeaderySays5UInt8VGKcSgvp">onHeader</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The callback that is called when a header is parsed.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">onHeader</span><span class="p">:</span> <span class="kt"><a href="../Structs/Parser.html#/s:3CSV6ParserV13HeaderHandlera">HeaderHandler</a></span><span class="p">?</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:3CSV6ParserV6onCellySays5UInt8VG_AGtKcSgvp"></a>
<a name="//apple_ref/swift/Property/onCell" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV6ParserV6onCellySays5UInt8VG_AGtKcSgvp">onCell</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The callback that is called when a cell is parsed.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">onCell</span><span class="p">:</span> <span class="kt"><a href="../Structs/Parser.html#/s:3CSV6ParserV11CellHandlera">CellHandler</a></span><span class="p">?</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:3CSV6ParserV8onHeader0C4CellACySays5UInt8VGKcSg_yAH_AHtKcSgtcfc"></a>
<a name="//apple_ref/swift/Method/init(onHeader:onCell:)" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV6ParserV8onHeader0C4CellACySays5UInt8VGKcSg_yAH_AHtKcSgtcfc">init(onHeader:onCell:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Creates a new <code>Parser</code> instance.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">onHeader</span><span class="p">:</span> <span class="kt"><a href="../Structs/Parser.html#/s:3CSV6ParserV13HeaderHandlera">HeaderHandler</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">onCell</span><span class="p">:</span> <span class="kt"><a href="../Structs/Parser.html#/s:3CSV6ParserV11CellHandlera">CellHandler</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>onHeader</em>
</code>
</td>
<td>
<div>
<p>The callback that will be called when a header is parsed.</p>
</div>
</td>
</tr>
<tr>
<td>
<code>
<em>onCell</em>
</code>
</td>
<td>
<div>
<p>The callback that will be called when a cell is parsed.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:3CSV6ParserV5parse_6lengths6ResultOyytAA9ErrorListVGSays5UInt8VG_SiSgtF"></a>
<a name="//apple_ref/swift/Method/parse(_:length:)" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV6ParserV5parse_6lengths6ResultOyytAA9ErrorListVGSays5UInt8VG_SiSgtF">parse(_:length:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Parses an arbitrary portion of a CSV document.</p>
<p>The data passed in should be the next slice of the document directly after the previous one.</p>
<p>When a header is parsed from the data, the data will be passed into the registered <code><a href="../Structs/Parser.html#/s:3CSV6ParserV8onHeaderySays5UInt8VGKcSgvp">.onHeader</a></code> callback.
When a cell is parsed from the data, the header for that given cell and the cell&rsquo;s data will be passed into
the <code><a href="../Structs/Parser.html#/s:3CSV6ParserV6onCellySays5UInt8VG_AGtKcSgvp">.onCell</a></code> callback.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">mutating</span> <span class="kd">func</span> <span class="nf">parse</span><span class="p">(</span><span class="n">_</span> <span class="nv">data</span><span class="p">:</span> <span class="p">[</span><span class="kt">UInt8</span><span class="p">],</span> <span class="nv">length</span><span class="p">:</span> <span class="kt">Int</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Result</span><span class="o">&lt;</span><span class="kt">Void</span><span class="p">,</span> <span class="kt"><a href="../Structs/ErrorList.html">ErrorList</a></span><span class="o">&gt;</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>data</em>
</code>
</td>
<td>
<div>
<p>The portion of the CSV document to parse.</p>
</div>
</td>
</tr>
<tr>
<td>
<code>
<em>length</em>
</code>
</td>
<td>
<div>
<p>The full content length of the document that is being parsed.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div>
<h4>Return Value</h4>
<p>A <code>Result</code> instance that will have a <code>.failure</code> case with all the errors thrown from
the registered callbacks. If there are no errors, then the result will be a <code>.success</code> case.</p>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>&copy; 2019 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2019-04-19)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>

View File

@ -0,0 +1,286 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Serializer Structure Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Struct/Serializer" class="dashAnchor"></a>
<a title="Serializer Structure Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="../index.html"> Docs</a> (100% documented)</p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="../index.html"> Reference</a>
<img id="carat" src="../img/carat.png" />
Serializer Structure Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Classes/CSVAsyncDecoder.html">CSVAsyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVAsyncEncoder.html">CSVAsyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVCodingOptions.html">CSVCodingOptions</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVDecoder.html">CSVDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVEncoder.html">CSVEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncDecoder.html">CSVSyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncEncoder.html">CSVSyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/SyncParser.html">SyncParser</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Enums/BoolCodingStrategy.html">BoolCodingStrategy</a>
</li>
<li class="nav-group-task">
<a href="../Enums/NilCodingStrategy.html">NilCodingStrategy</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Extensions/Array.html">Array</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/Optional.html">Optional</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/String.html">String</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/UInt8.html">UInt8</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Protocols.html">Protocols</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Protocols/BytesRepresentable.html">BytesRepresentable</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/KeyedCollection.html">KeyedCollection</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Structs/ErrorList.html">ErrorList</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Parser.html">Parser</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Serializer.html">Serializer</a>
</li>
<li class="nav-group-task">
<a href="../Structs/SyncSerializer.html">SyncSerializer</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>Serializer</h1>
<div class="declaration">
<div class="language">
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">Serializer</span></code></pre>
</div>
</div>
<p>Serializes dictionary data to CSV document data.</p>
<div class="aside aside-note">
<p class="aside-title">Note</p>
You should create a new <code>Serializer</code> dictionary you serialize.
</div>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:3CSV10SerializerV5onRowyySays5UInt8VGKcvp"></a>
<a name="//apple_ref/swift/Property/onRow" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV10SerializerV5onRowyySays5UInt8VGKcvp">onRow</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The callback that will be called with each row that is serialized.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">onRow</span><span class="p">:</span> <span class="p">([</span><span class="kt">UInt8</span><span class="p">])</span><span class="k">throws</span> <span class="o">-&gt;</span> <span class="p">()</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:3CSV10SerializerV5onRowACySays5UInt8VGKc_tcfc"></a>
<a name="//apple_ref/swift/Method/init(onRow:)" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV10SerializerV5onRowACySays5UInt8VGKc_tcfc">init(onRow:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Creates a new <code>Serializer</code> instance.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">onRow</span><span class="p">:</span> <span class="kd">@escaping</span> <span class="p">([</span><span class="kt">UInt8</span><span class="p">])</span><span class="k">throws</span> <span class="o">-&gt;</span> <span class="p">())</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>onRow</em>
</code>
</td>
<td>
<div>
<p>The callback that will be called with each row that is serialized.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:3CSV10SerializerV9serializeys6ResultOyytAA9ErrorListVGxAA15KeyedCollectionRzAA18BytesRepresentable3KeyRpzSl5ValueRpzAakN_7ElementRPzSxAN_5IndexRPzSZAN_AR6StrideRPzlF"></a>
<a name="//apple_ref/swift/Method/serialize(_:)" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV10SerializerV9serializeys6ResultOyytAA9ErrorListVGxAA15KeyedCollectionRzAA18BytesRepresentable3KeyRpzSl5ValueRpzAakN_7ElementRPzSxAN_5IndexRPzSZAN_AR6StrideRPzlF">serialize(_:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Serializes a dictionary to CSV document data. Usually this will be a dictionary of type
`[BytesRepresentable: [BytesRepresentable]], but it can be any type you conform to the proper protocols.</p>
<p>You can pass multiple dictionaries of the same structure into this method. The headers will only be serialized the
first time it is called.</p>
<div class="aside aside-note">
<p class="aside-title">Note</p>
<p>When you pass a dictionary into this method, each value collection is expect to contain the same
/ number of elements, and will crash with <code>index out of bounds</code> if that assumption is broken.</p>
</div>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">mutating</span> <span class="kd">func</span> <span class="n">serialize</span><span class="o">&lt;</span><span class="kt">Data</span><span class="o">&gt;</span><span class="p">(</span><span class="n">_</span> <span class="nv">data</span><span class="p">:</span> <span class="kt">Data</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Result</span><span class="o">&lt;</span><span class="kt">Void</span><span class="p">,</span> <span class="kt"><a href="../Structs/ErrorList.html">ErrorList</a></span><span class="o">&gt;</span> <span class="k">where</span>
<span class="kt">Data</span><span class="p">:</span> <span class="kt"><a href="../Protocols/KeyedCollection.html">KeyedCollection</a></span><span class="p">,</span> <span class="kt">Data</span><span class="o">.</span><span class="kt">Key</span><span class="p">:</span> <span class="kt"><a href="../Protocols/BytesRepresentable.html">BytesRepresentable</a></span><span class="p">,</span> <span class="kt">Data</span><span class="o">.</span><span class="kt">Value</span><span class="p">:</span> <span class="kt">Collection</span><span class="p">,</span> <span class="kt">Data</span><span class="o">.</span><span class="kt">Value</span><span class="o">.</span><span class="kt">Element</span><span class="p">:</span> <span class="kt"><a href="../Protocols/BytesRepresentable.html">BytesRepresentable</a></span><span class="p">,</span>
<span class="kt">Data</span><span class="o">.</span><span class="kt">Value</span><span class="o">.</span><span class="kt">Index</span><span class="p">:</span> <span class="kt">Strideable</span><span class="p">,</span> <span class="kt">Data</span><span class="o">.</span><span class="kt">Value</span><span class="o">.</span><span class="kt">Index</span><span class="o">.</span><span class="kt">Stride</span><span class="p">:</span> <span class="kt">SignedInteger</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>data</em>
</code>
</td>
<td>
<div>
<p>The dictionary (or other object) to parse.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div>
<h4>Return Value</h4>
<p>A <code>Result</code> instance with a <code>.failure</code> case with all the errors from the the <code><a href="../Structs/Serializer.html#/s:3CSV10SerializerV5onRowyySays5UInt8VGKcvp">.onRow</a></code> callback calls.
If there are no errors, the result will be a <code>.success</code> case.</p>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>&copy; 2019 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2019-04-19)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>

View File

@ -0,0 +1,231 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>SyncSerializer Structure Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Struct/SyncSerializer" class="dashAnchor"></a>
<a title="SyncSerializer Structure Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="../index.html"> Docs</a> (100% documented)</p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="../index.html"> Reference</a>
<img id="carat" src="../img/carat.png" />
SyncSerializer Structure Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Classes/CSVAsyncDecoder.html">CSVAsyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVAsyncEncoder.html">CSVAsyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVCodingOptions.html">CSVCodingOptions</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVDecoder.html">CSVDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVEncoder.html">CSVEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncDecoder.html">CSVSyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncEncoder.html">CSVSyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/SyncParser.html">SyncParser</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Enums/BoolCodingStrategy.html">BoolCodingStrategy</a>
</li>
<li class="nav-group-task">
<a href="../Enums/NilCodingStrategy.html">NilCodingStrategy</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Extensions/Array.html">Array</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/Optional.html">Optional</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/String.html">String</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/UInt8.html">UInt8</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Protocols.html">Protocols</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Protocols/BytesRepresentable.html">BytesRepresentable</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/KeyedCollection.html">KeyedCollection</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Structs/ErrorList.html">ErrorList</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Parser.html">Parser</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Serializer.html">Serializer</a>
</li>
<li class="nav-group-task">
<a href="../Structs/SyncSerializer.html">SyncSerializer</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>SyncSerializer</h1>
<div class="declaration">
<div class="language">
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">SyncSerializer</span></code></pre>
</div>
</div>
<p>A synchronous wrapper for the <code><a href="../Structs/Serializer.html">Serializer</a></code> struct for parsing a whole CSV document.</p>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:3CSV14SyncSerializerVACycfc"></a>
<a name="//apple_ref/swift/Method/init()" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV14SyncSerializerVACycfc">init()</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Creates a new <code>SyncSerializer</code> instance.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span> <span class="p">()</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:3CSV14SyncSerializerV9serializeySays5UInt8VGxAA15KeyedCollectionRzAA18BytesRepresentable3KeyRpzSl5ValueRpzAaiL_7ElementRPzSxAL_5IndexRPzSZAL_AP6StrideRPzlF"></a>
<a name="//apple_ref/swift/Method/serialize(_:)" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV14SyncSerializerV9serializeySays5UInt8VGxAA15KeyedCollectionRzAA18BytesRepresentable3KeyRpzSl5ValueRpzAaiL_7ElementRPzSxAL_5IndexRPzSZAL_AP6StrideRPzlF">serialize(_:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Serializes a dictionary to CSV document data. Usually this will be a dictionary of type
`[BytesRepresentable: [BytesRepresentable]], but it can be any type you conform to the proper protocols.</p>
<div class="aside aside-note">
<p class="aside-title">Note</p>
<p>When you pass a dictionary into this method, each value collection is expect to contain the same
/ number of elements, and will crash with <code>index out of bounds</code> if that assumption is broken.</p>
</div>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="n">serialize</span><span class="o">&lt;</span><span class="kt">Data</span><span class="o">&gt;</span><span class="p">(</span><span class="n">_</span> <span class="nv">data</span><span class="p">:</span> <span class="kt">Data</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="p">[</span><span class="kt">UInt8</span><span class="p">]</span> <span class="k">where</span>
<span class="kt">Data</span><span class="p">:</span> <span class="kt"><a href="../Protocols/KeyedCollection.html">KeyedCollection</a></span><span class="p">,</span> <span class="kt">Data</span><span class="o">.</span><span class="kt">Key</span><span class="p">:</span> <span class="kt"><a href="../Protocols/BytesRepresentable.html">BytesRepresentable</a></span><span class="p">,</span> <span class="kt">Data</span><span class="o">.</span><span class="kt">Value</span><span class="p">:</span> <span class="kt">Collection</span><span class="p">,</span> <span class="kt">Data</span><span class="o">.</span><span class="kt">Value</span><span class="o">.</span><span class="kt">Element</span><span class="p">:</span> <span class="kt"><a href="../Protocols/BytesRepresentable.html">BytesRepresentable</a></span><span class="p">,</span>
<span class="kt">Data</span><span class="o">.</span><span class="kt">Value</span><span class="o">.</span><span class="kt">Index</span><span class="p">:</span> <span class="kt">Strideable</span><span class="p">,</span> <span class="kt">Data</span><span class="o">.</span><span class="kt">Value</span><span class="o">.</span><span class="kt">Index</span><span class="o">.</span><span class="kt">Stride</span><span class="p">:</span> <span class="kt">SignedInteger</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>data</em>
</code>
</td>
<td>
<div>
<p>The dictionary (or other object) to parse.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div>
<h4>Return Value</h4>
<p>The serialized CSV data.</p>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>&copy; 2019 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2019-04-19)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>

28
docs/badge.svg Normal file
View File

@ -0,0 +1,28 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="136" height="20">
<linearGradient id="b" x2="0" y2="100%">
<stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
<stop offset="1" stop-opacity=".1"/>
</linearGradient>
<clipPath id="a">
<rect width="136" height="20" rx="3" fill="#fff"/>
</clipPath>
<g clip-path="url(#a)">
<path fill="#555" d="M0 0h93v20H0z"/>
<path fill="#4c1" d="M93 0h43v20H93z"/>
<path fill="url(#b)" d="M0 0h136v20H0z"/>
</g>
<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110">
<text x="475" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="830">
documentation
</text>
<text x="475" y="140" transform="scale(.1)" textLength="830">
documentation
</text>
<text x="1135" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="330">
100%
</text>
<text x="1135" y="140" transform="scale(.1)" textLength="330">
100%
</text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

200
docs/css/highlight.css Normal file
View File

@ -0,0 +1,200 @@
/* Credit to https://gist.github.com/wataru420/2048287 */
.highlight {
/* Comment */
/* Error */
/* Keyword */
/* Operator */
/* Comment.Multiline */
/* Comment.Preproc */
/* Comment.Single */
/* Comment.Special */
/* Generic.Deleted */
/* Generic.Deleted.Specific */
/* Generic.Emph */
/* Generic.Error */
/* Generic.Heading */
/* Generic.Inserted */
/* Generic.Inserted.Specific */
/* Generic.Output */
/* Generic.Prompt */
/* Generic.Strong */
/* Generic.Subheading */
/* Generic.Traceback */
/* Keyword.Constant */
/* Keyword.Declaration */
/* Keyword.Pseudo */
/* Keyword.Reserved */
/* Keyword.Type */
/* Literal.Number */
/* Literal.String */
/* Name.Attribute */
/* Name.Builtin */
/* Name.Class */
/* Name.Constant */
/* Name.Entity */
/* Name.Exception */
/* Name.Function */
/* Name.Namespace */
/* Name.Tag */
/* Name.Variable */
/* Operator.Word */
/* Text.Whitespace */
/* Literal.Number.Float */
/* Literal.Number.Hex */
/* Literal.Number.Integer */
/* Literal.Number.Oct */
/* Literal.String.Backtick */
/* Literal.String.Char */
/* Literal.String.Doc */
/* Literal.String.Double */
/* Literal.String.Escape */
/* Literal.String.Heredoc */
/* Literal.String.Interpol */
/* Literal.String.Other */
/* Literal.String.Regex */
/* Literal.String.Single */
/* Literal.String.Symbol */
/* Name.Builtin.Pseudo */
/* Name.Variable.Class */
/* Name.Variable.Global */
/* Name.Variable.Instance */
/* Literal.Number.Integer.Long */ }
.highlight .c {
color: #999988;
font-style: italic; }
.highlight .err {
color: #a61717;
background-color: #e3d2d2; }
.highlight .k {
color: #000000;
font-weight: bold; }
.highlight .o {
color: #000000;
font-weight: bold; }
.highlight .cm {
color: #999988;
font-style: italic; }
.highlight .cp {
color: #999999;
font-weight: bold; }
.highlight .c1 {
color: #999988;
font-style: italic; }
.highlight .cs {
color: #999999;
font-weight: bold;
font-style: italic; }
.highlight .gd {
color: #000000;
background-color: #ffdddd; }
.highlight .gd .x {
color: #000000;
background-color: #ffaaaa; }
.highlight .ge {
color: #000000;
font-style: italic; }
.highlight .gr {
color: #aa0000; }
.highlight .gh {
color: #999999; }
.highlight .gi {
color: #000000;
background-color: #ddffdd; }
.highlight .gi .x {
color: #000000;
background-color: #aaffaa; }
.highlight .go {
color: #888888; }
.highlight .gp {
color: #555555; }
.highlight .gs {
font-weight: bold; }
.highlight .gu {
color: #aaaaaa; }
.highlight .gt {
color: #aa0000; }
.highlight .kc {
color: #000000;
font-weight: bold; }
.highlight .kd {
color: #000000;
font-weight: bold; }
.highlight .kp {
color: #000000;
font-weight: bold; }
.highlight .kr {
color: #000000;
font-weight: bold; }
.highlight .kt {
color: #445588; }
.highlight .m {
color: #009999; }
.highlight .s {
color: #d14; }
.highlight .na {
color: #008080; }
.highlight .nb {
color: #0086B3; }
.highlight .nc {
color: #445588;
font-weight: bold; }
.highlight .no {
color: #008080; }
.highlight .ni {
color: #800080; }
.highlight .ne {
color: #990000;
font-weight: bold; }
.highlight .nf {
color: #990000; }
.highlight .nn {
color: #555555; }
.highlight .nt {
color: #000080; }
.highlight .nv {
color: #008080; }
.highlight .ow {
color: #000000;
font-weight: bold; }
.highlight .w {
color: #bbbbbb; }
.highlight .mf {
color: #009999; }
.highlight .mh {
color: #009999; }
.highlight .mi {
color: #009999; }
.highlight .mo {
color: #009999; }
.highlight .sb {
color: #d14; }
.highlight .sc {
color: #d14; }
.highlight .sd {
color: #d14; }
.highlight .s2 {
color: #d14; }
.highlight .se {
color: #d14; }
.highlight .sh {
color: #d14; }
.highlight .si {
color: #d14; }
.highlight .sx {
color: #d14; }
.highlight .sr {
color: #009926; }
.highlight .s1 {
color: #d14; }
.highlight .ss {
color: #990073; }
.highlight .bp {
color: #999999; }
.highlight .vc {
color: #008080; }
.highlight .vg {
color: #008080; }
.highlight .vi {
color: #008080; }
.highlight .il {
color: #009999; }

337
docs/css/jazzy.css Normal file
View File

@ -0,0 +1,337 @@
html, body, div, span, h1, h3, h4, p, a, code, em, img, ul, li, table, tbody, tr, td {
background: transparent;
border: 0;
margin: 0;
outline: 0;
padding: 0;
vertical-align: baseline; }
body {
background-color: #f2f2f2;
font-family: Helvetica, freesans, Arial, sans-serif;
font-size: 14px;
-webkit-font-smoothing: subpixel-antialiased;
word-wrap: break-word; }
h1, h2, h3 {
margin-top: 0.8em;
margin-bottom: 0.3em;
font-weight: 100;
color: black; }
h1 {
font-size: 2.5em; }
h2 {
font-size: 2em;
border-bottom: 1px solid #e2e2e2; }
h4 {
font-size: 13px;
line-height: 1.5;
margin-top: 21px; }
h5 {
font-size: 1.1em; }
h6 {
font-size: 1.1em;
color: #777; }
.section-name {
color: gray;
display: block;
font-family: Helvetica;
font-size: 22px;
font-weight: 100;
margin-bottom: 15px; }
pre, code {
font: 0.95em Menlo, monospace;
color: #777;
word-wrap: normal; }
p code, li code {
background-color: #eee;
padding: 2px 4px;
border-radius: 4px; }
a {
color: #0088cc;
text-decoration: none; }
ul {
padding-left: 15px; }
li {
line-height: 1.8em; }
img {
max-width: 100%; }
blockquote {
margin-left: 0;
padding: 0 10px;
border-left: 4px solid #ccc; }
.content-wrapper {
margin: 0 auto;
width: 980px; }
header {
font-size: 0.85em;
line-height: 26px;
background-color: #414141;
position: fixed;
width: 100%;
z-index: 1; }
header img {
padding-right: 6px;
vertical-align: -4px;
height: 16px; }
header a {
color: #fff; }
header p {
float: left;
color: #999; }
header .header-right {
float: right;
margin-left: 16px; }
#breadcrumbs {
background-color: #f2f2f2;
height: 27px;
padding-top: 17px;
position: fixed;
width: 100%;
z-index: 1;
margin-top: 26px; }
#breadcrumbs #carat {
height: 10px;
margin: 0 5px; }
.sidebar {
background-color: #f9f9f9;
border: 1px solid #e2e2e2;
overflow-y: auto;
overflow-x: hidden;
position: fixed;
top: 70px;
bottom: 0;
width: 230px;
word-wrap: normal; }
.nav-groups {
list-style-type: none;
background: #fff;
padding-left: 0; }
.nav-group-name {
border-bottom: 1px solid #e2e2e2;
font-size: 1.1em;
font-weight: 100;
padding: 15px 0 15px 20px; }
.nav-group-name > a {
color: #333; }
.nav-group-tasks {
margin-top: 5px; }
.nav-group-task {
font-size: 0.9em;
list-style-type: none;
white-space: nowrap; }
.nav-group-task a {
color: #888; }
.main-content {
background-color: #fff;
border: 1px solid #e2e2e2;
margin-left: 246px;
position: absolute;
overflow: hidden;
padding-bottom: 60px;
top: 70px;
width: 734px; }
.main-content p, .main-content a, .main-content code, .main-content em, .main-content ul, .main-content table, .main-content blockquote {
margin-bottom: 1em; }
.main-content p {
line-height: 1.8em; }
.main-content section .section:first-child {
margin-top: 0;
padding-top: 0; }
.main-content section .task-group-section .task-group:first-of-type {
padding-top: 10px; }
.main-content section .task-group-section .task-group:first-of-type .section-name {
padding-top: 15px; }
.main-content section .heading:before {
content: "";
display: block;
padding-top: 70px;
margin: -70px 0 0; }
.section {
padding: 0 25px; }
.highlight {
background-color: #eee;
padding: 10px 12px;
border: 1px solid #e2e2e2;
border-radius: 4px;
overflow-x: auto; }
.declaration .highlight {
overflow-x: initial;
padding: 0 40px 40px 0;
margin-bottom: -25px;
background-color: transparent;
border: none; }
.section-name {
margin: 0;
margin-left: 18px; }
.task-group-section {
padding-left: 6px;
border-top: 1px solid #e2e2e2; }
.task-group {
padding-top: 0px; }
.task-name-container a[name]:before {
content: "";
display: block;
padding-top: 70px;
margin: -70px 0 0; }
.item {
padding-top: 8px;
width: 100%;
list-style-type: none; }
.item a[name]:before {
content: "";
display: block;
padding-top: 70px;
margin: -70px 0 0; }
.item code {
background-color: transparent;
padding: 0; }
.item .token {
padding-left: 3px;
margin-left: 15px;
font-size: 11.9px; }
.item .declaration-note {
font-size: .85em;
color: gray;
font-style: italic; }
.pointer-container {
border-bottom: 1px solid #e2e2e2;
left: -23px;
padding-bottom: 13px;
position: relative;
width: 110%; }
.pointer {
background: #f9f9f9;
border-left: 1px solid #e2e2e2;
border-top: 1px solid #e2e2e2;
height: 12px;
left: 21px;
top: -7px;
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
-o-transform: rotate(45deg);
transform: rotate(45deg);
position: absolute;
width: 12px; }
.height-container {
display: none;
left: -25px;
padding: 0 25px;
position: relative;
width: 100%;
overflow: hidden; }
.height-container .section {
background: #f9f9f9;
border-bottom: 1px solid #e2e2e2;
left: -25px;
position: relative;
width: 100%;
padding-top: 10px;
padding-bottom: 5px; }
.aside, .language {
padding: 6px 12px;
margin: 12px 0;
border-left: 5px solid #dddddd;
overflow-y: hidden; }
.aside .aside-title, .language .aside-title {
font-size: 9px;
letter-spacing: 2px;
text-transform: uppercase;
padding-bottom: 0;
margin: 0;
color: #aaa;
-webkit-user-select: none; }
.aside p:last-child, .language p:last-child {
margin-bottom: 0; }
.language {
border-left: 5px solid #cde9f4; }
.language .aside-title {
color: #4b8afb; }
.aside-warning {
border-left: 5px solid #ff6666; }
.aside-warning .aside-title {
color: #ff0000; }
.graybox {
border-collapse: collapse;
width: 100%; }
.graybox p {
margin: 0;
word-break: break-word;
min-width: 50px; }
.graybox td {
border: 1px solid #e2e2e2;
padding: 5px 25px 5px 10px;
vertical-align: middle; }
.graybox tr td:first-of-type {
text-align: right;
padding: 7px;
vertical-align: top;
word-break: normal;
width: 40px; }
.slightly-smaller {
font-size: 0.9em; }
#footer {
position: absolute;
bottom: 10px;
margin-left: 25px; }
#footer p {
margin: 0;
color: #aaa;
font-size: 0.8em; }
html.dash header, html.dash #breadcrumbs, html.dash .sidebar {
display: none; }
html.dash .main-content {
width: 980px;
margin-left: 0;
border: none;
width: 100%;
top: 0;
padding-bottom: 0; }
html.dash .height-container {
display: block; }
html.dash .item .token {
margin-left: 0; }
html.dash .content-wrapper {
width: auto; }
html.dash #footer {
position: static; }

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleIdentifier</key>
<string>com.jazzy.</string>
<key>CFBundleName</key>
<string></string>
<key>DocSetPlatformFamily</key>
<string></string>
<key>isDashDocset</key>
<true/>
<key>dashIndexFilePath</key>
<string>index.html</string>
<key>isJavaScriptEnabled</key>
<true/>
<key>DashDocSetFamily</key>
<string>dashtoc</string>
</dict>
</plist>

View File

@ -0,0 +1,421 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Classes Reference</title>
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
<meta charset='utf-8'>
<script src="js/jquery.min.js" defer></script>
<script src="js/jazzy.js" defer></script>
</head>
<body>
<a title="Classes Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="index.html"> Docs</a> (100% documented)</p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="index.html"> Reference</a>
<img id="carat" src="img/carat.png" />
Classes Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Classes/CSVAsyncDecoder.html">CSVAsyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="Classes/CSVAsyncEncoder.html">CSVAsyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="Classes/CSVCodingOptions.html">CSVCodingOptions</a>
</li>
<li class="nav-group-task">
<a href="Classes/CSVDecoder.html">CSVDecoder</a>
</li>
<li class="nav-group-task">
<a href="Classes/CSVEncoder.html">CSVEncoder</a>
</li>
<li class="nav-group-task">
<a href="Classes/CSVSyncDecoder.html">CSVSyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="Classes/CSVSyncEncoder.html">CSVSyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="Classes/SyncParser.html">SyncParser</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Enums/BoolCodingStrategy.html">BoolCodingStrategy</a>
</li>
<li class="nav-group-task">
<a href="Enums/NilCodingStrategy.html">NilCodingStrategy</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Extensions/Array.html">Array</a>
</li>
<li class="nav-group-task">
<a href="Extensions/Optional.html">Optional</a>
</li>
<li class="nav-group-task">
<a href="Extensions/String.html">String</a>
</li>
<li class="nav-group-task">
<a href="Extensions/UInt8.html">UInt8</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Protocols.html">Protocols</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Protocols/BytesRepresentable.html">BytesRepresentable</a>
</li>
<li class="nav-group-task">
<a href="Protocols/KeyedCollection.html">KeyedCollection</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Structs/ErrorList.html">ErrorList</a>
</li>
<li class="nav-group-task">
<a href="Structs/Parser.html">Parser</a>
</li>
<li class="nav-group-task">
<a href="Structs/Serializer.html">Serializer</a>
</li>
<li class="nav-group-task">
<a href="Structs/SyncSerializer.html">SyncSerializer</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>Classes</h1>
<p>The following classes are available globally.</p>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:3CSV10CSVEncoderC"></a>
<a name="//apple_ref/swift/Class/CSVEncoder" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV10CSVEncoderC">CSVEncoder</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Encodes Swift types to CSV data.</p>
<p>This exampls shows how multiple instances of a <code>Person</code> type will be encoded
to CSV data. <code>Person</code> conforms to <code>Codable</code>, so it is compatible with both the
<code>CSVEndocder</code> and <code><a href="Classes/CSVDecoder.html">CSVDecoder</a></code>.</p>
<pre class="highlight swift"><code><span class="kd">struct</span> <span class="kt">Person</span><span class="p">:</span> <span class="kt">Codable</span> <span class="p">{</span>
<span class="k">let</span> <span class="nv">firstName</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
<span class="k">let</span> <span class="nv">lastName</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
<span class="k">let</span> <span class="nv">age</span><span class="p">:</span> <span class="kt">Int</span>
<span class="p">}</span>
<span class="k">let</span> <span class="nv">people</span> <span class="o">=</span> <span class="p">[</span>
<span class="kt">Person</span><span class="p">(</span><span class="nv">firstName</span><span class="p">:</span> <span class="s">"Grace"</span><span class="p">,</span> <span class="nv">lastName</span><span class="p">:</span> <span class="s">"Hopper"</span><span class="p">,</span> <span class="nv">age</span><span class="p">:</span> <span class="mi">113</span><span class="p">),</span>
<span class="kt">Person</span><span class="p">(</span><span class="nv">firstName</span><span class="p">:</span> <span class="s">"Linus"</span><span class="p">,</span> <span class="nv">lastName</span><span class="p">:</span> <span class="s">"Torvold"</span><span class="p">,</span> <span class="nv">age</span><span class="p">:</span> <span class="mi">50</span><span class="p">)</span>
<span class="p">]</span>
<span class="k">let</span> <span class="nv">data</span> <span class="o">=</span> <span class="k">try</span> <span class="kt">CSVEncoder</span><span class="p">()</span><span class="o">.</span><span class="n">sync</span><span class="o">.</span><span class="nf">encode</span><span class="p">(</span><span class="n">people</span><span class="p">)</span>
<span class="nf">print</span><span class="p">(</span><span class="kt">String</span><span class="p">(</span><span class="nv">decoding</span><span class="p">:</span> <span class="n">data</span><span class="p">,</span> <span class="nv">as</span><span class="p">:</span> <span class="kt">UTF8</span><span class="o">.</span><span class="k">self</span><span class="p">))</span>
<span class="cm">/* Prints:
"firstName","lastName","age"
"Grace","Hopper","113"
"Linus","Torvold","50"
*/</span>
</code></pre>
<a href="Classes/CSVEncoder.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">final</span> <span class="kd">class</span> <span class="kt">CSVEncoder</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:3CSV14CSVSyncEncoderC"></a>
<a name="//apple_ref/swift/Class/CSVSyncEncoder" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV14CSVSyncEncoderC">CSVSyncEncoder</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The encoder for encoding multiple objects at once into a single CSV document.</p>
<p>You can get an instance of the <code>CSVSyncEncoder</code> with the <code><a href="Classes/CSVEncoder.html#/s:3CSV10CSVEncoderC4syncAA14CSVSyncEncoderCvp">CSVEncoder.sync</a></code> property.</p>
<a href="Classes/CSVSyncEncoder.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">final</span> <span class="kd">class</span> <span class="kt">CSVSyncEncoder</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:3CSV15CSVAsyncEncoderC"></a>
<a name="//apple_ref/swift/Class/CSVAsyncEncoder" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV15CSVAsyncEncoderC">CSVAsyncEncoder</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>An encoder for encoding multiple objects separately into a single CSV document.</p>
<p>You can get an instance of the <code>CSVAsyncEncoder</code> using the <code><a href="Classes/CSVEncoder.html#/s:3CSV10CSVEncoderC5asyncyAA15CSVAsyncEncoderCySays5UInt8VGcF">CSVEncoder.async(_:)</a></code> method.</p>
<a href="Classes/CSVAsyncEncoder.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">final</span> <span class="kd">class</span> <span class="kt">CSVAsyncEncoder</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:3CSV10CSVDecoderC"></a>
<a name="//apple_ref/swift/Class/CSVDecoder" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV10CSVDecoderC">CSVDecoder</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Decodes CSV document data to Swift types.</p>
<p>This example shows how a simple <code>Person</code> type will be decoded from a CSV document.
Person<code>conforms to</code>Codable<code>, so it is compatible with both the</code>CSVEndocder<code>and</code>CSVDecoder`.</p>
<pre class="highlight swift"><code><span class="kd">struct</span> <span class="kt">Person</span><span class="p">:</span> <span class="kt">Codable</span> <span class="p">{</span>
<span class="k">let</span> <span class="nv">firstName</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
<span class="k">let</span> <span class="nv">lastName</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
<span class="k">let</span> <span class="nv">age</span><span class="p">:</span> <span class="kt">Int</span>
<span class="p">}</span>
<span class="k">let</span> <span class="nv">csv</span> <span class="o">=</span> <span class="s">"""
"</span><span class="n">firstName</span><span class="s">","</span><span class="n">lastName</span><span class="s">","</span><span class="n">age</span><span class="s">"
"</span><span class="kt">Grace</span><span class="s">","</span><span class="kt">Hopper</span><span class="s">","</span><span class="mi">113</span><span class="s">"
"</span><span class="kt">Linus</span><span class="s">","</span><span class="kt">Torvold</span><span class="s">","</span><span class="mi">50</span><span class="s">"
"""</span>
<span class="k">let</span> <span class="nv">data</span> <span class="o">=</span> <span class="kt">Data</span><span class="p">(</span><span class="n">csv</span><span class="o">.</span><span class="n">utf8</span><span class="p">)</span>
<span class="k">let</span> <span class="nv">people</span> <span class="o">=</span> <span class="k">try</span> <span class="kt">CSVDecoder</span><span class="o">.</span><span class="n">sync</span><span class="o">.</span><span class="nf">decode</span><span class="p">(</span><span class="kt">Person</span><span class="o">.</span><span class="k">self</span><span class="p">,</span> <span class="nv">from</span><span class="p">:</span> <span class="n">data</span><span class="p">)</span>
<span class="nf">print</span><span class="p">(</span><span class="n">people</span><span class="o">.</span><span class="n">map</span> <span class="p">{</span> <span class="nv">$0</span><span class="o">.</span><span class="n">firstName</span> <span class="p">})</span> <span class="c1">// Prints: `["Grace","Linus"]`</span>
</code></pre>
<a href="Classes/CSVDecoder.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">final</span> <span class="kd">class</span> <span class="kt">CSVDecoder</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:3CSV14CSVSyncDecoderC"></a>
<a name="//apple_ref/swift/Class/CSVSyncDecoder" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV14CSVSyncDecoderC">CSVSyncDecoder</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>A decoder for decoding a single CSV document all at once.</p>
<p>You can get an instance of <code>CSVSyncDecoder</code> from the <code><a href="Classes/CSVDecoder.html#/s:3CSV10CSVDecoderC4syncAA14CSVSyncDecoderCvp">CSVDecoder.sync</a></code> property.</p>
<a href="Classes/CSVSyncDecoder.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">final</span> <span class="kd">class</span> <span class="kt">CSVSyncDecoder</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:3CSV15CSVAsyncDecoderC"></a>
<a name="//apple_ref/swift/Class/CSVAsyncDecoder" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV15CSVAsyncDecoderC">CSVAsyncDecoder</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>A decoder for decoding sections of a CSV document at different times.</p>
<p>You can get an instance of <code>CSVAsyncDecoder</code> from the <code>CSVDecoder.async(for:length_:)</code> method.</p>
<a href="Classes/CSVAsyncDecoder.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">final</span> <span class="kd">class</span> <span class="kt">CSVAsyncDecoder</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:3CSV16CSVCodingOptionsC"></a>
<a name="//apple_ref/swift/Class/CSVCodingOptions" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV16CSVCodingOptionsC">CSVCodingOptions</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The options used for encoding/decoding certin types in the <code><a href="Classes/CSVEncoder.html">CSVEncoder</a></code> and <code><a href="Classes/CSVDecoder.html">CSVDecoder</a></code>.</p>
<a href="Classes/CSVCodingOptions.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">final</span> <span class="kd">class</span> <span class="kt">CSVCodingOptions</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:3CSV10SyncParserC"></a>
<a name="//apple_ref/swift/Class/SyncParser" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV10SyncParserC">SyncParser</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>A synchronous wrapper for the <code><a href="Structs/Parser.html">Parser</a></code> type for parsing whole CSV documents at once.</p>
<a href="Classes/SyncParser.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">final</span> <span class="kd">class</span> <span class="kt">SyncParser</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>&copy; 2019 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2019-04-19)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>

View File

@ -0,0 +1,207 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>CSVAsyncDecoder Class Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Class/CSVAsyncDecoder" class="dashAnchor"></a>
<a title="CSVAsyncDecoder Class Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="../index.html"> Docs</a> (100% documented)</p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="../index.html"> Reference</a>
<img id="carat" src="../img/carat.png" />
CSVAsyncDecoder Class Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Classes/CSVAsyncDecoder.html">CSVAsyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVAsyncEncoder.html">CSVAsyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVCodingOptions.html">CSVCodingOptions</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVDecoder.html">CSVDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVEncoder.html">CSVEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncDecoder.html">CSVSyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncEncoder.html">CSVSyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/SyncParser.html">SyncParser</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Enums/BoolCodingStrategy.html">BoolCodingStrategy</a>
</li>
<li class="nav-group-task">
<a href="../Enums/NilCodingStrategy.html">NilCodingStrategy</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Extensions/Array.html">Array</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/Optional.html">Optional</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/String.html">String</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/UInt8.html">UInt8</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Protocols.html">Protocols</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Protocols/BytesRepresentable.html">BytesRepresentable</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/KeyedCollection.html">KeyedCollection</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Structs/ErrorList.html">ErrorList</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Parser.html">Parser</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Serializer.html">Serializer</a>
</li>
<li class="nav-group-task">
<a href="../Structs/SyncSerializer.html">SyncSerializer</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>CSVAsyncDecoder</h1>
<div class="declaration">
<div class="language">
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">final</span> <span class="kd">class</span> <span class="kt">CSVAsyncDecoder</span></code></pre>
</div>
</div>
<p>A decoder for decoding sections of a CSV document at different times.</p>
<p>You can get an instance of <code>CSVAsyncDecoder</code> from the <code>CSVDecoder.async(for:length_:)</code> method.</p>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:3CSV15CSVAsyncDecoderC6decodeyyxKSlRzs5UInt8V7ElementRtzlF"></a>
<a name="//apple_ref/swift/Method/decode(_:)" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV15CSVAsyncDecoderC6decodeyyxKSlRzs5UInt8V7ElementRtzlF">decode(_:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Decodes a section of a CSV document to instances of the registered <code>Decodable</code> type.</p>
<p>When a whole row has been parsed from the data passed in, it is decoded and passed into
the <code>.onInstance</code> callback that is registered.</p>
<div class="aside aside-note">
<p class="aside-title">Note</p>
<p>Each chunk of data passed in is assumed to come directly after the previous one
passed in. The chunks may not be passed in out of order.</p>
</div>
<div class="aside aside-throws">
<p class="aside-title">Throws</p>
<p>Errors that occur during the decoding process.</p>
</div>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="n">decode</span><span class="o">&lt;</span><span class="kt">C</span><span class="o">&gt;</span><span class="p">(</span><span class="n">_</span> <span class="nv">data</span><span class="p">:</span> <span class="kt">C</span><span class="p">)</span><span class="k">throws</span> <span class="k">where</span> <span class="kt">C</span><span class="p">:</span> <span class="kt">Collection</span><span class="p">,</span> <span class="kt">C</span><span class="o">.</span><span class="kt">Element</span> <span class="o">==</span> <span class="kt">UInt8</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>data</em>
</code>
</td>
<td>
<div>
<p>A section of the CSV document to decode.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>&copy; 2019 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2019-04-19)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>

View File

@ -0,0 +1,199 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>CSVAsyncEncoder Class Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Class/CSVAsyncEncoder" class="dashAnchor"></a>
<a title="CSVAsyncEncoder Class Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="../index.html"> Docs</a> (100% documented)</p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="../index.html"> Reference</a>
<img id="carat" src="../img/carat.png" />
CSVAsyncEncoder Class Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Classes/CSVAsyncDecoder.html">CSVAsyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVAsyncEncoder.html">CSVAsyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVCodingOptions.html">CSVCodingOptions</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVDecoder.html">CSVDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVEncoder.html">CSVEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncDecoder.html">CSVSyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncEncoder.html">CSVSyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/SyncParser.html">SyncParser</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Enums/BoolCodingStrategy.html">BoolCodingStrategy</a>
</li>
<li class="nav-group-task">
<a href="../Enums/NilCodingStrategy.html">NilCodingStrategy</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Extensions/Array.html">Array</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/Optional.html">Optional</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/String.html">String</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/UInt8.html">UInt8</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Protocols.html">Protocols</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Protocols/BytesRepresentable.html">BytesRepresentable</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/KeyedCollection.html">KeyedCollection</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Structs/ErrorList.html">ErrorList</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Parser.html">Parser</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Serializer.html">Serializer</a>
</li>
<li class="nav-group-task">
<a href="../Structs/SyncSerializer.html">SyncSerializer</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>CSVAsyncEncoder</h1>
<div class="declaration">
<div class="language">
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">final</span> <span class="kd">class</span> <span class="kt">CSVAsyncEncoder</span></code></pre>
</div>
</div>
<p>An encoder for encoding multiple objects separately into a single CSV document.</p>
<p>You can get an instance of the <code>CSVAsyncEncoder</code> using the <code><a href="../Classes/CSVEncoder.html#/s:3CSV10CSVEncoderC5asyncyAA15CSVAsyncEncoderCySays5UInt8VGcF">CSVEncoder.async(_:)</a></code> method.</p>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:3CSV15CSVAsyncEncoderC6encodeyyxKSERzlF"></a>
<a name="//apple_ref/swift/Method/encode(_:)" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV15CSVAsyncEncoderC6encodeyyxKSERzlF">encode(_:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Encodes an <code>Encodable</code> object into a row for a CSV document and passes it into
the <code>onRow</code> closure.</p>
<div class="aside aside-throws">
<p class="aside-title">Throws</p>
Erros that occur when encoding the object passed in.
</div>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="n">encode</span><span class="o">&lt;</span><span class="kt">T</span><span class="o">&gt;</span><span class="p">(</span><span class="n">_</span> <span class="nv">object</span><span class="p">:</span> <span class="kt">T</span><span class="p">)</span><span class="k">throws</span> <span class="k">where</span> <span class="kt">T</span><span class="p">:</span> <span class="kt">Encodable</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>object</em>
</code>
</td>
<td>
<div>
<p>The object to encode to a CSV row.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>&copy; 2019 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2019-04-19)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>

View File

@ -0,0 +1,288 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>CSVCodingOptions Class Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Class/CSVCodingOptions" class="dashAnchor"></a>
<a title="CSVCodingOptions Class Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="../index.html"> Docs</a> (100% documented)</p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="../index.html"> Reference</a>
<img id="carat" src="../img/carat.png" />
CSVCodingOptions Class Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Classes/CSVAsyncDecoder.html">CSVAsyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVAsyncEncoder.html">CSVAsyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVCodingOptions.html">CSVCodingOptions</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVDecoder.html">CSVDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVEncoder.html">CSVEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncDecoder.html">CSVSyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncEncoder.html">CSVSyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/SyncParser.html">SyncParser</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Enums/BoolCodingStrategy.html">BoolCodingStrategy</a>
</li>
<li class="nav-group-task">
<a href="../Enums/NilCodingStrategy.html">NilCodingStrategy</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Extensions/Array.html">Array</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/Optional.html">Optional</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/String.html">String</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/UInt8.html">UInt8</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Protocols.html">Protocols</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Protocols/BytesRepresentable.html">BytesRepresentable</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/KeyedCollection.html">KeyedCollection</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Structs/ErrorList.html">ErrorList</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Parser.html">Parser</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Serializer.html">Serializer</a>
</li>
<li class="nav-group-task">
<a href="../Structs/SyncSerializer.html">SyncSerializer</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>CSVCodingOptions</h1>
<div class="declaration">
<div class="language">
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">final</span> <span class="kd">class</span> <span class="kt">CSVCodingOptions</span></code></pre>
</div>
</div>
<p>The options used for encoding/decoding certin types in the <code><a href="../Classes/CSVEncoder.html">CSVEncoder</a></code> and <code><a href="../Classes/CSVDecoder.html">CSVDecoder</a></code>.</p>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:3CSV16CSVCodingOptionsC7defaultACvpZ"></a>
<a name="//apple_ref/swift/Variable/default" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV16CSVCodingOptionsC7defaultACvpZ">default</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The default coding options.</p>
<p>This option set uses <code>.string</code> for the <code><a href="../Enums/BoolCodingStrategy.html">BoolCodingStrategy</a></code> and <code>.blank</code> for
the <code><a href="../Enums/NilCodingStrategy.html">NilCodingStrategy</a></code>. This means <code>Bool</code> will be represented the value&rsquo;s textual name
and <code>nil</code> will be an empty cell.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">static</span> <span class="kd">let</span> <span class="p">`</span><span class="nv">default</span><span class="p">`</span> <span class="o">=</span> <span class="kt">CSVCodingOptions</span><span class="p">(</span><span class="nv">boolCodingStrategy</span><span class="p">:</span> <span class="o">.</span><span class="n">string</span><span class="p">,</span> <span class="nv">nilCodingStrategy</span><span class="p">:</span> <span class="o">.</span><span class="n">blank</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:3CSV16CSVCodingOptionsC18boolCodingStrategyAA04BooleF0Ovp"></a>
<a name="//apple_ref/swift/Property/boolCodingStrategy" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV16CSVCodingOptionsC18boolCodingStrategyAA04BooleF0Ovp">boolCodingStrategy</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The bool encoding/decoding strategy used for the encoder/decoder the option set is passed to.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">boolCodingStrategy</span><span class="p">:</span> <span class="kt"><a href="../Enums/BoolCodingStrategy.html">BoolCodingStrategy</a></span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:3CSV16CSVCodingOptionsC17nilCodingStrategyAA03NileF0Ovp"></a>
<a name="//apple_ref/swift/Property/nilCodingStrategy" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV16CSVCodingOptionsC17nilCodingStrategyAA03NileF0Ovp">nilCodingStrategy</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The nil encoding/decoding strategy used for the encoder/decoder the option set is passed to.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">nilCodingStrategy</span><span class="p">:</span> <span class="kt"><a href="../Enums/NilCodingStrategy.html">NilCodingStrategy</a></span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:3CSV16CSVCodingOptionsC18boolCodingStrategy03nileF0AcA04BooleF0O_AA03NileF0Otcfc"></a>
<a name="//apple_ref/swift/Method/init(boolCodingStrategy:nilCodingStrategy:)" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV16CSVCodingOptionsC18boolCodingStrategy03nileF0AcA04BooleF0O_AA03NileF0Otcfc">init(boolCodingStrategy:nilCodingStrategy:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Creates a new <code>CSVCodingOptions</code> instance.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">boolCodingStrategy</span><span class="p">:</span> <span class="kt"><a href="../Enums/BoolCodingStrategy.html">BoolCodingStrategy</a></span><span class="p">,</span> <span class="nv">nilCodingStrategy</span><span class="p">:</span> <span class="kt"><a href="../Enums/NilCodingStrategy.html">NilCodingStrategy</a></span><span class="p">)</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>boolCodingStrategy</em>
</code>
</td>
<td>
<div>
<p>The bool encoding/decoding strategy used for the encoder/decoder the option set is passed to.</p>
</div>
</td>
</tr>
<tr>
<td>
<code>
<em>nilCodingStrategy</em>
</code>
</td>
<td>
<div>
<p>The nil encoding/decoding strategy used for the encoder/decoder the option set is passed to.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>&copy; 2019 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2019-04-19)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>

View File

@ -0,0 +1,347 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>CSVDecoder Class Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Class/CSVDecoder" class="dashAnchor"></a>
<a title="CSVDecoder Class Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="../index.html"> Docs</a> (100% documented)</p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="../index.html"> Reference</a>
<img id="carat" src="../img/carat.png" />
CSVDecoder Class Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Classes/CSVAsyncDecoder.html">CSVAsyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVAsyncEncoder.html">CSVAsyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVCodingOptions.html">CSVCodingOptions</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVDecoder.html">CSVDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVEncoder.html">CSVEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncDecoder.html">CSVSyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncEncoder.html">CSVSyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/SyncParser.html">SyncParser</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Enums/BoolCodingStrategy.html">BoolCodingStrategy</a>
</li>
<li class="nav-group-task">
<a href="../Enums/NilCodingStrategy.html">NilCodingStrategy</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Extensions/Array.html">Array</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/Optional.html">Optional</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/String.html">String</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/UInt8.html">UInt8</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Protocols.html">Protocols</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Protocols/BytesRepresentable.html">BytesRepresentable</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/KeyedCollection.html">KeyedCollection</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Structs/ErrorList.html">ErrorList</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Parser.html">Parser</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Serializer.html">Serializer</a>
</li>
<li class="nav-group-task">
<a href="../Structs/SyncSerializer.html">SyncSerializer</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>CSVDecoder</h1>
<div class="declaration">
<div class="language">
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">final</span> <span class="kd">class</span> <span class="kt">CSVDecoder</span></code></pre>
</div>
</div>
<p>Decodes CSV document data to Swift types.</p>
<p>This example shows how a simple <code>Person</code> type will be decoded from a CSV document.
Person<code>conforms to</code>Codable<code>, so it is compatible with both the</code>CSVEndocder<code>and</code>CSVDecoder`.</p>
<pre class="highlight swift"><code><span class="kd">struct</span> <span class="kt">Person</span><span class="p">:</span> <span class="kt">Codable</span> <span class="p">{</span>
<span class="k">let</span> <span class="nv">firstName</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
<span class="k">let</span> <span class="nv">lastName</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
<span class="k">let</span> <span class="nv">age</span><span class="p">:</span> <span class="kt">Int</span>
<span class="p">}</span>
<span class="k">let</span> <span class="nv">csv</span> <span class="o">=</span> <span class="s">"""
"</span><span class="n">firstName</span><span class="s">","</span><span class="n">lastName</span><span class="s">","</span><span class="n">age</span><span class="s">"
"</span><span class="kt">Grace</span><span class="s">","</span><span class="kt">Hopper</span><span class="s">","</span><span class="mi">113</span><span class="s">"
"</span><span class="kt">Linus</span><span class="s">","</span><span class="kt">Torvold</span><span class="s">","</span><span class="mi">50</span><span class="s">"
"""</span>
<span class="k">let</span> <span class="nv">data</span> <span class="o">=</span> <span class="kt">Data</span><span class="p">(</span><span class="n">csv</span><span class="o">.</span><span class="n">utf8</span><span class="p">)</span>
<span class="k">let</span> <span class="nv">people</span> <span class="o">=</span> <span class="k">try</span> <span class="kt">CSVDecoder</span><span class="o">.</span><span class="n">sync</span><span class="o">.</span><span class="nf">decode</span><span class="p">(</span><span class="kt">Person</span><span class="o">.</span><span class="k">self</span><span class="p">,</span> <span class="nv">from</span><span class="p">:</span> <span class="n">data</span><span class="p">)</span>
<span class="nf">print</span><span class="p">(</span><span class="n">people</span><span class="o">.</span><span class="n">map</span> <span class="p">{</span> <span class="nv">$0</span><span class="o">.</span><span class="n">firstName</span> <span class="p">})</span> <span class="c1">// Prints: `["Grace","Linus"]`</span>
</code></pre>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:3CSV10CSVDecoderC15decodingOptionsAA09CSVCodingD0Cvp"></a>
<a name="//apple_ref/swift/Property/decodingOptions" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV10CSVDecoderC15decodingOptionsAA09CSVCodingD0Cvp">decodingOptions</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The decoding options to use when decoding data to an object.</p>
<p>This is currently used to specify how <code>nil</code> and <code>Bool</code> values should be handled.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">decodingOptions</span><span class="p">:</span> <span class="kt"><a href="../Classes/CSVCodingOptions.html">CSVCodingOptions</a></span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:3CSV10CSVDecoderC15decodingOptionsAcA09CSVCodingD0C_tcfc"></a>
<a name="//apple_ref/swift/Method/init(decodingOptions:)" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV10CSVDecoderC15decodingOptionsAcA09CSVCodingD0C_tcfc">init(decodingOptions:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Creates a new <code>CSVDecoder</code> instance.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">decodingOptions</span><span class="p">:</span> <span class="kt"><a href="../Classes/CSVCodingOptions.html">CSVCodingOptions</a></span> <span class="o">=</span> <span class="o">.</span><span class="k">default</span><span class="p">)</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>decodingOptions</em>
</code>
</td>
<td>
<div>
<p>The decoding options to use when decoding data to an object.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:3CSV10CSVDecoderC4syncAA14CSVSyncDecoderCvp"></a>
<a name="//apple_ref/swift/Property/sync" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV10CSVDecoderC4syncAA14CSVSyncDecoderCvp">sync</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Creates a <code><a href="../Classes/CSVSyncDecoder.html">CSVSyncDecoder</a></code> with the registered encoding options.</p>
<p>This decoder is for if you have whole CSV document you want to decode at once.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">sync</span><span class="p">:</span> <span class="kt"><a href="../Classes/CSVSyncDecoder.html">CSVSyncDecoder</a></span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:3CSV10CSVDecoderC5async3for6length_AA15CSVAsyncDecoderCxm_SiyxctSeRzlF"></a>
<a name="//apple_ref/swift/Method/async(for:length:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV10CSVDecoderC5async3for6length_AA15CSVAsyncDecoderCxm_SiyxctSeRzlF">async(for:length:_:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Creates a <code><a href="../Classes/CSVAsyncDecoder.html">CSVAsyncDecoder</a></code> instance with the registered encoding options.</p>
<p>This decoder is for if you have separate chunks of the same CSV document that you will
be decoding at different times.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="n">async</span><span class="o">&lt;</span><span class="kt">D</span><span class="o">&gt;</span><span class="p">(</span><span class="k">for</span> <span class="nv">type</span><span class="p">:</span> <span class="kt">D</span><span class="o">.</span><span class="k">Type</span> <span class="o">=</span> <span class="kt">D</span><span class="o">.</span><span class="k">self</span><span class="p">,</span> <span class="nv">length</span><span class="p">:</span> <span class="kt">Int</span><span class="p">,</span> <span class="n">_</span> <span class="nv">onInstance</span><span class="p">:</span> <span class="kd">@escaping</span> <span class="p">(</span><span class="kt">D</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="p">())</span> <span class="o">-&gt;</span> <span class="kt"><a href="../Classes/CSVAsyncDecoder.html">CSVAsyncDecoder</a></span>
<span class="k">where</span> <span class="kt">D</span><span class="p">:</span> <span class="kt">Decodable</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>type</em>
</code>
</td>
<td>
<div>
<p>The <code>Decodable</code> type that the rows of the CSV document will be decoded to.</p>
</div>
</td>
</tr>
<tr>
<td>
<code>
<em>length</em>
</code>
</td>
<td>
<div>
<p>The content length of the whole CSV document.</p>
</div>
</td>
</tr>
<tr>
<td>
<code>
<em>onInstance</em>
</code>
</td>
<td>
<div>
<p>The closure that is called when an instance of <code>D</code> is decoded from the data passed in.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div>
<h4>Return Value</h4>
<p>A <code><a href="../Classes/CSVAsyncDecoder.html">CSVAsyncDecoder</a></code> instance with the current encoder&rsquo;s encoding options and the
<code>.onInstance</code> closure as its callback.</p>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>&copy; 2019 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2019-04-19)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>

View File

@ -0,0 +1,329 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>CSVEncoder Class Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Class/CSVEncoder" class="dashAnchor"></a>
<a title="CSVEncoder Class Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="../index.html"> Docs</a> (100% documented)</p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="../index.html"> Reference</a>
<img id="carat" src="../img/carat.png" />
CSVEncoder Class Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Classes/CSVAsyncDecoder.html">CSVAsyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVAsyncEncoder.html">CSVAsyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVCodingOptions.html">CSVCodingOptions</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVDecoder.html">CSVDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVEncoder.html">CSVEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncDecoder.html">CSVSyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncEncoder.html">CSVSyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/SyncParser.html">SyncParser</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Enums/BoolCodingStrategy.html">BoolCodingStrategy</a>
</li>
<li class="nav-group-task">
<a href="../Enums/NilCodingStrategy.html">NilCodingStrategy</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Extensions/Array.html">Array</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/Optional.html">Optional</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/String.html">String</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/UInt8.html">UInt8</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Protocols.html">Protocols</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Protocols/BytesRepresentable.html">BytesRepresentable</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/KeyedCollection.html">KeyedCollection</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Structs/ErrorList.html">ErrorList</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Parser.html">Parser</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Serializer.html">Serializer</a>
</li>
<li class="nav-group-task">
<a href="../Structs/SyncSerializer.html">SyncSerializer</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>CSVEncoder</h1>
<div class="declaration">
<div class="language">
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">final</span> <span class="kd">class</span> <span class="kt">CSVEncoder</span></code></pre>
</div>
</div>
<p>Encodes Swift types to CSV data.</p>
<p>This exampls shows how multiple instances of a <code>Person</code> type will be encoded
to CSV data. <code>Person</code> conforms to <code>Codable</code>, so it is compatible with both the
<code>CSVEndocder</code> and <code><a href="../Classes/CSVDecoder.html">CSVDecoder</a></code>.</p>
<pre class="highlight swift"><code><span class="kd">struct</span> <span class="kt">Person</span><span class="p">:</span> <span class="kt">Codable</span> <span class="p">{</span>
<span class="k">let</span> <span class="nv">firstName</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
<span class="k">let</span> <span class="nv">lastName</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
<span class="k">let</span> <span class="nv">age</span><span class="p">:</span> <span class="kt">Int</span>
<span class="p">}</span>
<span class="k">let</span> <span class="nv">people</span> <span class="o">=</span> <span class="p">[</span>
<span class="kt">Person</span><span class="p">(</span><span class="nv">firstName</span><span class="p">:</span> <span class="s">"Grace"</span><span class="p">,</span> <span class="nv">lastName</span><span class="p">:</span> <span class="s">"Hopper"</span><span class="p">,</span> <span class="nv">age</span><span class="p">:</span> <span class="mi">113</span><span class="p">),</span>
<span class="kt">Person</span><span class="p">(</span><span class="nv">firstName</span><span class="p">:</span> <span class="s">"Linus"</span><span class="p">,</span> <span class="nv">lastName</span><span class="p">:</span> <span class="s">"Torvold"</span><span class="p">,</span> <span class="nv">age</span><span class="p">:</span> <span class="mi">50</span><span class="p">)</span>
<span class="p">]</span>
<span class="k">let</span> <span class="nv">data</span> <span class="o">=</span> <span class="k">try</span> <span class="kt">CSVEncoder</span><span class="p">()</span><span class="o">.</span><span class="n">sync</span><span class="o">.</span><span class="nf">encode</span><span class="p">(</span><span class="n">people</span><span class="p">)</span>
<span class="nf">print</span><span class="p">(</span><span class="kt">String</span><span class="p">(</span><span class="nv">decoding</span><span class="p">:</span> <span class="n">data</span><span class="p">,</span> <span class="nv">as</span><span class="p">:</span> <span class="kt">UTF8</span><span class="o">.</span><span class="k">self</span><span class="p">))</span>
<span class="cm">/* Prints:
"firstName","lastName","age"
"Grace","Hopper","113"
"Linus","Torvold","50"
*/</span>
</code></pre>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:3CSV10CSVEncoderC15encodingOptionsAA09CSVCodingD0Cvp"></a>
<a name="//apple_ref/swift/Property/encodingOptions" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV10CSVEncoderC15encodingOptionsAA09CSVCodingD0Cvp">encodingOptions</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The encoding options the use when encoding an object.</p>
<p>Currently, this decideds how <code>nil</code> and <code>bool</code> values should be handled.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">encodingOptions</span><span class="p">:</span> <span class="kt"><a href="../Classes/CSVCodingOptions.html">CSVCodingOptions</a></span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:3CSV10CSVEncoderC15encodingOptionsAcA09CSVCodingD0C_tcfc"></a>
<a name="//apple_ref/swift/Method/init(encodingOptions:)" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV10CSVEncoderC15encodingOptionsAcA09CSVCodingD0C_tcfc">init(encodingOptions:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Creates a new <code>CSVEncoder</code> instance.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">encodingOptions</span><span class="p">:</span> <span class="kt"><a href="../Classes/CSVCodingOptions.html">CSVCodingOptions</a></span> <span class="o">=</span> <span class="o">.</span><span class="k">default</span><span class="p">)</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>encodingOptions</em>
</code>
</td>
<td>
<div>
<p>The encoding options the use when encoding an object.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:3CSV10CSVEncoderC4syncAA14CSVSyncEncoderCvp"></a>
<a name="//apple_ref/swift/Property/sync" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV10CSVEncoderC4syncAA14CSVSyncEncoderCvp">sync</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Creates a <code><a href="../Classes/CSVSyncEncoder.html">CSVSyncEncoder</a></code> using the registered encoding options.</p>
<p>This encoder is for if you have several objects that you want to encode at
a single time into a single document.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">sync</span><span class="p">:</span> <span class="kt"><a href="../Classes/CSVSyncEncoder.html">CSVSyncEncoder</a></span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:3CSV10CSVEncoderC5asyncyAA15CSVAsyncEncoderCySays5UInt8VGcF"></a>
<a name="//apple_ref/swift/Method/async(_:)" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV10CSVEncoderC5asyncyAA15CSVAsyncEncoderCySays5UInt8VGcF">async(_:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Creates a new <code><a href="../Classes/CSVAsyncEncoder.html">CSVAsyncEncoder</a></code> using the registered encoding options.</p>
<p>This encoder is for if you have multiple objects that will be encoded separately,
but into a single document.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">async</span><span class="p">(</span><span class="n">_</span> <span class="nv">onRow</span><span class="p">:</span> <span class="kd">@escaping</span> <span class="p">([</span><span class="kt">UInt8</span><span class="p">])</span> <span class="o">-&gt;</span> <span class="p">())</span> <span class="o">-&gt;</span> <span class="kt"><a href="../Classes/CSVAsyncEncoder.html">CSVAsyncEncoder</a></span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>onRow</em>
</code>
</td>
<td>
<div>
<p>The closure that will be called when each object passed
into the encoder is encoded to a row.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div>
<h4>Return Value</h4>
<p>A <code><a href="../Classes/CSVAsyncEncoder.html">CSVAsyncEncoder</a></code> instance with the current encoder&rsquo;s encoding
options and the <code>onRow</code> closure as its callback.</p>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>&copy; 2019 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2019-04-19)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>

View File

@ -0,0 +1,214 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>CSVSyncDecoder Class Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Class/CSVSyncDecoder" class="dashAnchor"></a>
<a title="CSVSyncDecoder Class Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="../index.html"> Docs</a> (100% documented)</p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="../index.html"> Reference</a>
<img id="carat" src="../img/carat.png" />
CSVSyncDecoder Class Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Classes/CSVAsyncDecoder.html">CSVAsyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVAsyncEncoder.html">CSVAsyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVCodingOptions.html">CSVCodingOptions</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVDecoder.html">CSVDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVEncoder.html">CSVEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncDecoder.html">CSVSyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncEncoder.html">CSVSyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/SyncParser.html">SyncParser</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Enums/BoolCodingStrategy.html">BoolCodingStrategy</a>
</li>
<li class="nav-group-task">
<a href="../Enums/NilCodingStrategy.html">NilCodingStrategy</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Extensions/Array.html">Array</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/Optional.html">Optional</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/String.html">String</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/UInt8.html">UInt8</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Protocols.html">Protocols</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Protocols/BytesRepresentable.html">BytesRepresentable</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/KeyedCollection.html">KeyedCollection</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Structs/ErrorList.html">ErrorList</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Parser.html">Parser</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Serializer.html">Serializer</a>
</li>
<li class="nav-group-task">
<a href="../Structs/SyncSerializer.html">SyncSerializer</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>CSVSyncDecoder</h1>
<div class="declaration">
<div class="language">
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">final</span> <span class="kd">class</span> <span class="kt">CSVSyncDecoder</span></code></pre>
</div>
</div>
<p>A decoder for decoding a single CSV document all at once.</p>
<p>You can get an instance of <code>CSVSyncDecoder</code> from the <code><a href="../Classes/CSVDecoder.html#/s:3CSV10CSVDecoderC4syncAA14CSVSyncDecoderCvp">CSVDecoder.sync</a></code> property.</p>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:3CSV14CSVSyncDecoderC6decode_4fromSayxGxm_10Foundation4DataVtKSeRzlF"></a>
<a name="//apple_ref/swift/Method/decode(_:from:)" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV14CSVSyncDecoderC6decode_4fromSayxGxm_10Foundation4DataVtKSeRzlF">decode(_:from:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Decodes a whole CSV document into an array of a specified <code>Decodable</code> type.</p>
<div class="aside aside-throws">
<p class="aside-title">Throws</p>
<p>Errors that occur during the decoding proccess.</p>
</div>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="n">decode</span><span class="o">&lt;</span><span class="kt">D</span><span class="o">&gt;</span><span class="p">(</span><span class="n">_</span> <span class="nv">type</span><span class="p">:</span> <span class="kt">D</span><span class="o">.</span><span class="k">Type</span> <span class="o">=</span> <span class="kt">D</span><span class="o">.</span><span class="k">self</span><span class="p">,</span> <span class="n">from</span> <span class="nv">data</span><span class="p">:</span> <span class="kt">Data</span><span class="p">)</span><span class="k">throws</span> <span class="o">-&gt;</span> <span class="p">[</span><span class="kt">D</span><span class="p">]</span> <span class="k">where</span> <span class="kt">D</span><span class="p">:</span> <span class="kt">Decodable</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>type</em>
</code>
</td>
<td>
<div>
<p>The <code>Decodable</code> type to decode the CSV rows to.</p>
</div>
</td>
</tr>
<tr>
<td>
<code>
<em>data</em>
</code>
</td>
<td>
<div>
<p>The CSV data to decode.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div>
<h4>Return Value</h4>
<p>An array of <code>D</code> instances, decoded from the data passed in.</p>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>&copy; 2019 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2019-04-19)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>

View File

@ -0,0 +1,202 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>CSVSyncEncoder Class Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Class/CSVSyncEncoder" class="dashAnchor"></a>
<a title="CSVSyncEncoder Class Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="../index.html"> Docs</a> (100% documented)</p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="../index.html"> Reference</a>
<img id="carat" src="../img/carat.png" />
CSVSyncEncoder Class Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Classes/CSVAsyncDecoder.html">CSVAsyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVAsyncEncoder.html">CSVAsyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVCodingOptions.html">CSVCodingOptions</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVDecoder.html">CSVDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVEncoder.html">CSVEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncDecoder.html">CSVSyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncEncoder.html">CSVSyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/SyncParser.html">SyncParser</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Enums/BoolCodingStrategy.html">BoolCodingStrategy</a>
</li>
<li class="nav-group-task">
<a href="../Enums/NilCodingStrategy.html">NilCodingStrategy</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Extensions/Array.html">Array</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/Optional.html">Optional</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/String.html">String</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/UInt8.html">UInt8</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Protocols.html">Protocols</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Protocols/BytesRepresentable.html">BytesRepresentable</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/KeyedCollection.html">KeyedCollection</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Structs/ErrorList.html">ErrorList</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Parser.html">Parser</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Serializer.html">Serializer</a>
</li>
<li class="nav-group-task">
<a href="../Structs/SyncSerializer.html">SyncSerializer</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>CSVSyncEncoder</h1>
<div class="declaration">
<div class="language">
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">final</span> <span class="kd">class</span> <span class="kt">CSVSyncEncoder</span></code></pre>
</div>
</div>
<p>The encoder for encoding multiple objects at once into a single CSV document.</p>
<p>You can get an instance of the <code>CSVSyncEncoder</code> with the <code><a href="../Classes/CSVEncoder.html#/s:3CSV10CSVEncoderC4syncAA14CSVSyncEncoderCvp">CSVEncoder.sync</a></code> property.</p>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:3CSV14CSVSyncEncoderC6encodey10Foundation4DataVSayxGKSERzlF"></a>
<a name="//apple_ref/swift/Method/encode(_:)" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV14CSVSyncEncoderC6encodey10Foundation4DataVSayxGKSERzlF">encode(_:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Encodes an array of encodable objects into a single CSV document.</p>
<div class="aside aside-throws">
<p class="aside-title">Throws</p>
<p>Encoding errors that occur when encoding the given objects.</p>
</div>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="n">encode</span><span class="o">&lt;</span><span class="kt">T</span><span class="o">&gt;</span><span class="p">(</span><span class="n">_</span> <span class="nv">objects</span><span class="p">:</span> <span class="p">[</span><span class="kt">T</span><span class="p">])</span><span class="k">throws</span> <span class="o">-&gt;</span> <span class="kt">Data</span> <span class="k">where</span> <span class="kt">T</span><span class="p">:</span> <span class="kt">Encodable</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>objects</em>
</code>
</td>
<td>
<div>
<p>The objects to encode to CSV rows.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div>
<h4>Return Value</h4>
<p>The data for the CSV document.</p>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>&copy; 2019 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2019-04-19)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>

View File

@ -0,0 +1,274 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>SyncParser Class Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Class/SyncParser" class="dashAnchor"></a>
<a title="SyncParser Class Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="../index.html"> Docs</a> (100% documented)</p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="../index.html"> Reference</a>
<img id="carat" src="../img/carat.png" />
SyncParser Class Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Classes/CSVAsyncDecoder.html">CSVAsyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVAsyncEncoder.html">CSVAsyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVCodingOptions.html">CSVCodingOptions</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVDecoder.html">CSVDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVEncoder.html">CSVEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncDecoder.html">CSVSyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncEncoder.html">CSVSyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/SyncParser.html">SyncParser</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Enums/BoolCodingStrategy.html">BoolCodingStrategy</a>
</li>
<li class="nav-group-task">
<a href="../Enums/NilCodingStrategy.html">NilCodingStrategy</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Extensions/Array.html">Array</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/Optional.html">Optional</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/String.html">String</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/UInt8.html">UInt8</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Protocols.html">Protocols</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Protocols/BytesRepresentable.html">BytesRepresentable</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/KeyedCollection.html">KeyedCollection</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Structs/ErrorList.html">ErrorList</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Parser.html">Parser</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Serializer.html">Serializer</a>
</li>
<li class="nav-group-task">
<a href="../Structs/SyncSerializer.html">SyncSerializer</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>SyncParser</h1>
<div class="declaration">
<div class="language">
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">final</span> <span class="kd">class</span> <span class="kt">SyncParser</span></code></pre>
</div>
</div>
<p>A synchronous wrapper for the <code><a href="../Structs/Parser.html">Parser</a></code> type for parsing whole CSV documents at once.</p>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:3CSV10SyncParserCACycfc"></a>
<a name="//apple_ref/swift/Method/init()" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV10SyncParserCACycfc">init()</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Creates a new <code>SyncParser</code> instance</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">()</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:3CSV10SyncParserC5parseySDySays5UInt8VGSayAGSgGGAGF"></a>
<a name="//apple_ref/swift/Method/parse(_:)" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV10SyncParserC5parseySDySays5UInt8VGSayAGSgGGAGF">parse(_:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Parses a whole CSV document at once.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">parse</span><span class="p">(</span><span class="n">_</span> <span class="nv">data</span><span class="p">:</span> <span class="p">[</span><span class="kt">UInt8</span><span class="p">])</span> <span class="o">-&gt;</span> <span class="p">[[</span><span class="kt">UInt8</span><span class="p">]:</span> <span class="p">[[</span><span class="kt">UInt8</span><span class="p">]?]]</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>data</em>
</code>
</td>
<td>
<div>
<p>The CSV data to parse.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div>
<h4>Return Value</h4>
<p>A dictionary containing the parsed CSV data. The keys are the column names
and the values are the column cells. A <code>nil</code> value is an empty cell.</p>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:3CSV10SyncParserC5parseySDySSSaySSSgGGSSF"></a>
<a name="//apple_ref/swift/Method/parse(_:)" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV10SyncParserC5parseySDySSSaySSSgGGSSF">parse(_:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Parses a whole CSV document at once from a <code>String</code>.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">parse</span><span class="p">(</span><span class="n">_</span> <span class="nv">data</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="p">[</span><span class="kt">String</span><span class="p">:</span> <span class="p">[</span><span class="kt">String</span><span class="p">?]]</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>data</em>
</code>
</td>
<td>
<div>
<p>The CSV data to parse.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div>
<h4>Return Value</h4>
<p>A dictionary containing the parsed CSV data. The keys are the column names
and the values are the column cells. A <code>nil</code> value is an empty cell.</p>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>&copy; 2019 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2019-04-19)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>

View File

@ -0,0 +1,194 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Enumerations Reference</title>
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
<meta charset='utf-8'>
<script src="js/jquery.min.js" defer></script>
<script src="js/jazzy.js" defer></script>
</head>
<body>
<a title="Enumerations Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="index.html"> Docs</a> (100% documented)</p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="index.html"> Reference</a>
<img id="carat" src="img/carat.png" />
Enumerations Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Classes/CSVAsyncDecoder.html">CSVAsyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="Classes/CSVAsyncEncoder.html">CSVAsyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="Classes/CSVCodingOptions.html">CSVCodingOptions</a>
</li>
<li class="nav-group-task">
<a href="Classes/CSVDecoder.html">CSVDecoder</a>
</li>
<li class="nav-group-task">
<a href="Classes/CSVEncoder.html">CSVEncoder</a>
</li>
<li class="nav-group-task">
<a href="Classes/CSVSyncDecoder.html">CSVSyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="Classes/CSVSyncEncoder.html">CSVSyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="Classes/SyncParser.html">SyncParser</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Enums/BoolCodingStrategy.html">BoolCodingStrategy</a>
</li>
<li class="nav-group-task">
<a href="Enums/NilCodingStrategy.html">NilCodingStrategy</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Extensions/Array.html">Array</a>
</li>
<li class="nav-group-task">
<a href="Extensions/Optional.html">Optional</a>
</li>
<li class="nav-group-task">
<a href="Extensions/String.html">String</a>
</li>
<li class="nav-group-task">
<a href="Extensions/UInt8.html">UInt8</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Protocols.html">Protocols</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Protocols/BytesRepresentable.html">BytesRepresentable</a>
</li>
<li class="nav-group-task">
<a href="Protocols/KeyedCollection.html">KeyedCollection</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Structs/ErrorList.html">ErrorList</a>
</li>
<li class="nav-group-task">
<a href="Structs/Parser.html">Parser</a>
</li>
<li class="nav-group-task">
<a href="Structs/Serializer.html">Serializer</a>
</li>
<li class="nav-group-task">
<a href="Structs/SyncSerializer.html">SyncSerializer</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>Enumerations</h1>
<p>The following enumerations are available globally.</p>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:3CSV18BoolCodingStrategyO"></a>
<a name="//apple_ref/swift/Enum/BoolCodingStrategy" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV18BoolCodingStrategyO">BoolCodingStrategy</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The encoding/decodig strategies used on boolean values in a CSV document.</p>
<a href="Enums/BoolCodingStrategy.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">BoolCodingStrategy</span><span class="p">:</span> <span class="kt">Hashable</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:3CSV17NilCodingStrategyO"></a>
<a name="//apple_ref/swift/Enum/NilCodingStrategy" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV17NilCodingStrategyO">NilCodingStrategy</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The encoding/decoding strategies used for <code>nil</code> values in a CSV document.</p>
<a href="Enums/NilCodingStrategy.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">NilCodingStrategy</span><span class="p">:</span> <span class="kt">Hashable</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>&copy; 2019 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2019-04-19)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>

View File

@ -0,0 +1,404 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>BoolCodingStrategy Enumeration Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Enum/BoolCodingStrategy" class="dashAnchor"></a>
<a title="BoolCodingStrategy Enumeration Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="../index.html"> Docs</a> (100% documented)</p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="../index.html"> Reference</a>
<img id="carat" src="../img/carat.png" />
BoolCodingStrategy Enumeration Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Classes/CSVAsyncDecoder.html">CSVAsyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVAsyncEncoder.html">CSVAsyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVCodingOptions.html">CSVCodingOptions</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVDecoder.html">CSVDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVEncoder.html">CSVEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncDecoder.html">CSVSyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncEncoder.html">CSVSyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/SyncParser.html">SyncParser</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Enums/BoolCodingStrategy.html">BoolCodingStrategy</a>
</li>
<li class="nav-group-task">
<a href="../Enums/NilCodingStrategy.html">NilCodingStrategy</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Extensions/Array.html">Array</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/Optional.html">Optional</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/String.html">String</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/UInt8.html">UInt8</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Protocols.html">Protocols</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Protocols/BytesRepresentable.html">BytesRepresentable</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/KeyedCollection.html">KeyedCollection</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Structs/ErrorList.html">ErrorList</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Parser.html">Parser</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Serializer.html">Serializer</a>
</li>
<li class="nav-group-task">
<a href="../Structs/SyncSerializer.html">SyncSerializer</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>BoolCodingStrategy</h1>
<div class="declaration">
<div class="language">
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">BoolCodingStrategy</span><span class="p">:</span> <span class="kt">Hashable</span></code></pre>
</div>
</div>
<p>The encoding/decodig strategies used on boolean values in a CSV document.</p>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:3CSV18BoolCodingStrategyO7integeryA2CmF"></a>
<a name="//apple_ref/swift/Element/integer" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV18BoolCodingStrategyO7integeryA2CmF">integer</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The bools are represented by their number counter part, <code>false</code> is <code>0</code> and <code>true</code> is <code>1</code>.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">integer</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:3CSV18BoolCodingStrategyO6stringyA2CmF"></a>
<a name="//apple_ref/swift/Element/string" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV18BoolCodingStrategyO6stringyA2CmF">string</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The bools are represented by their textual counter parts, <code>false</code> is <code>&quot;false&quot;</code> and <code>true</code> is <code>&quot;true&quot;</code>.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">string</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:3CSV18BoolCodingStrategyO5fuzzyyA2CmF"></a>
<a name="//apple_ref/swift/Element/fuzzy" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV18BoolCodingStrategyO5fuzzyyA2CmF">fuzzy</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The bools are checked against multiple different values when they are decoded.
They are encoded to their string values.</p>
<p>When decoding data with this strategy, the characters in the data are lowercased and it is then
checked against <code>true</code>, <code>yes</code>, <code>y</code>, <code>y</code>, and <code>1</code> for true and <code>false</code>, <code>no</code>, <code>f</code>, <code>n</code>, and <code>0</code> for false.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">fuzzy</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:3CSV18BoolCodingStrategyO6customyACSays5UInt8VG_AGtcACmF"></a>
<a name="//apple_ref/swift/Element/custom(true:false:)" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV18BoolCodingStrategyO6customyACSays5UInt8VG_AGtcACmF">custom(true:false:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>A custom coding strategy with any given representations for the <code>true</code> and <code>false</code> values.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">custom</span><span class="p">(`</span><span class="nv">true</span><span class="p">`:</span> <span class="p">[</span><span class="kt">UInt8</span><span class="p">],`</span><span class="nv">false</span><span class="p">`:</span> <span class="p">[</span><span class="kt">UInt8</span><span class="p">])</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>true</em>
</code>
</td>
<td>
<div>
<p>The value that <code>true</code> gets converted to, and that <code>true</code> is represented by in the CSV document.</p>
</div>
</td>
</tr>
<tr>
<td>
<code>
<em>false</em>
</code>
</td>
<td>
<div>
<p>The value that <code>false</code> gets converted to, and that <code>false</code> is represented by in the CSV document.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:3CSV18BoolCodingStrategyO5bytes4fromSays5UInt8VGSb_tF"></a>
<a name="//apple_ref/swift/Method/bytes(from:)" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV18BoolCodingStrategyO5bytes4fromSays5UInt8VGSb_tF">bytes(from:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Converts a <code>Bool</code> value to the bytes the reporesent it, given the current strategy.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">bytes</span><span class="p">(</span><span class="n">from</span> <span class="nv">bool</span><span class="p">:</span> <span class="kt">Bool</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="p">[</span><span class="kt">UInt8</span><span class="p">]</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>bool</em>
</code>
</td>
<td>
<div>
<p>The <code>Bool</code> instance to get the bytes for.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div>
<h4>Return Value</h4>
<p>The bytes value for the bool passed in.</p>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:3CSV18BoolCodingStrategyO4bool4fromSbSgSays5UInt8VG_tF"></a>
<a name="//apple_ref/swift/Method/bool(from:)" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV18BoolCodingStrategyO4bool4fromSbSgSays5UInt8VG_tF">bool(from:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Attempts get a <code>Bool</code> value from given bytes using the current strategy.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">bool</span><span class="p">(</span><span class="n">from</span> <span class="nv">bytes</span><span class="p">:</span> <span class="p">[</span><span class="kt">UInt8</span><span class="p">])</span> <span class="o">-&gt;</span> <span class="kt">Bool</span><span class="p">?</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>bytes</em>
</code>
</td>
<td>
<div>
<p>The bytes to chek against the expected value for the given strategy.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div>
<h4>Return Value</h4>
<p>The <code>Bool</code> value for the bytes passed in, or <code>nil</code> if no match is found.</p>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>&copy; 2019 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2019-04-19)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>

View File

@ -0,0 +1,338 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>NilCodingStrategy Enumeration Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Enum/NilCodingStrategy" class="dashAnchor"></a>
<a title="NilCodingStrategy Enumeration Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="../index.html"> Docs</a> (100% documented)</p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="../index.html"> Reference</a>
<img id="carat" src="../img/carat.png" />
NilCodingStrategy Enumeration Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Classes/CSVAsyncDecoder.html">CSVAsyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVAsyncEncoder.html">CSVAsyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVCodingOptions.html">CSVCodingOptions</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVDecoder.html">CSVDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVEncoder.html">CSVEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncDecoder.html">CSVSyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncEncoder.html">CSVSyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/SyncParser.html">SyncParser</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Enums/BoolCodingStrategy.html">BoolCodingStrategy</a>
</li>
<li class="nav-group-task">
<a href="../Enums/NilCodingStrategy.html">NilCodingStrategy</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Extensions/Array.html">Array</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/Optional.html">Optional</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/String.html">String</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/UInt8.html">UInt8</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Protocols.html">Protocols</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Protocols/BytesRepresentable.html">BytesRepresentable</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/KeyedCollection.html">KeyedCollection</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Structs/ErrorList.html">ErrorList</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Parser.html">Parser</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Serializer.html">Serializer</a>
</li>
<li class="nav-group-task">
<a href="../Structs/SyncSerializer.html">SyncSerializer</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>NilCodingStrategy</h1>
<div class="declaration">
<div class="language">
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">NilCodingStrategy</span><span class="p">:</span> <span class="kt">Hashable</span></code></pre>
</div>
</div>
<p>The encoding/decoding strategies used for <code>nil</code> values in a CSV document.</p>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:3CSV17NilCodingStrategyO5blankyA2CmF"></a>
<a name="//apple_ref/swift/Element/blank" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV17NilCodingStrategyO5blankyA2CmF">blank</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>A <code>nil</code> value is represented by an empty cell.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">blank</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:3CSV17NilCodingStrategyO2nayA2CmF"></a>
<a name="//apple_ref/swift/Element/na" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV17NilCodingStrategyO2nayA2CmF">na</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>A <code>nil</code> value is represented by <code>N/A</code> as a cell&rsquo;s contents.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">na</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:3CSV17NilCodingStrategyO6customyACSays5UInt8VGcACmF"></a>
<a name="//apple_ref/swift/Element/custom(_:)" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV17NilCodingStrategyO6customyACSays5UInt8VGcACmF">custom(_:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>A <code>nil</code> value is represented by a custom set of bytes.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">custom</span><span class="p">(</span><span class="n">_</span> <span class="nv">bytes</span><span class="p">:</span> <span class="p">[</span><span class="kt">UInt8</span><span class="p">])</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>bytes</em>
</code>
</td>
<td>
<div>
<p>The bytes that represent <code>nil</code> in the CSV document.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:3CSV17NilCodingStrategyO5bytesSays5UInt8VGyF"></a>
<a name="//apple_ref/swift/Method/bytes()" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV17NilCodingStrategyO5bytesSays5UInt8VGyF">bytes()</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Gets the bytes that represent <code>nil</code> with the current strategy.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">bytes</span><span class="p">()</span> <span class="o">-&gt;</span> <span class="p">[</span><span class="kt">UInt8</span><span class="p">]</span></code></pre>
</div>
</div>
<div>
<h4>Return Value</h4>
<p><code>nil</code>, represented by a byte array.</p>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:3CSV17NilCodingStrategyO6isNullySbSays5UInt8VGF"></a>
<a name="//apple_ref/swift/Method/isNull(_:)" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV17NilCodingStrategyO6isNullySbSays5UInt8VGF">isNull(_:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Checks to see if a given array of bytes represents <code>nil</code> with the current strategy.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">isNull</span><span class="p">(</span><span class="n">_</span> <span class="nv">bytes</span><span class="p">:</span> <span class="p">[</span><span class="kt">UInt8</span><span class="p">])</span> <span class="o">-&gt;</span> <span class="kt">Bool</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>bytes</em>
</code>
</td>
<td>
<div>
<p>The bytes to match against the current strategy.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div>
<h4>Return Value</h4>
<p>A <code>Bool</code> indicating whether the bytes passed in represent <code>nil</code> or not.</p>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>&copy; 2019 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2019-04-19)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>

View File

@ -0,0 +1,257 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Extensions Reference</title>
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
<meta charset='utf-8'>
<script src="js/jquery.min.js" defer></script>
<script src="js/jazzy.js" defer></script>
</head>
<body>
<a title="Extensions Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="index.html"> Docs</a> (100% documented)</p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="index.html"> Reference</a>
<img id="carat" src="img/carat.png" />
Extensions Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Classes/CSVAsyncDecoder.html">CSVAsyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="Classes/CSVAsyncEncoder.html">CSVAsyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="Classes/CSVCodingOptions.html">CSVCodingOptions</a>
</li>
<li class="nav-group-task">
<a href="Classes/CSVDecoder.html">CSVDecoder</a>
</li>
<li class="nav-group-task">
<a href="Classes/CSVEncoder.html">CSVEncoder</a>
</li>
<li class="nav-group-task">
<a href="Classes/CSVSyncDecoder.html">CSVSyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="Classes/CSVSyncEncoder.html">CSVSyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="Classes/SyncParser.html">SyncParser</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Enums/BoolCodingStrategy.html">BoolCodingStrategy</a>
</li>
<li class="nav-group-task">
<a href="Enums/NilCodingStrategy.html">NilCodingStrategy</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Extensions/Array.html">Array</a>
</li>
<li class="nav-group-task">
<a href="Extensions/Optional.html">Optional</a>
</li>
<li class="nav-group-task">
<a href="Extensions/String.html">String</a>
</li>
<li class="nav-group-task">
<a href="Extensions/UInt8.html">UInt8</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Protocols.html">Protocols</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Protocols/BytesRepresentable.html">BytesRepresentable</a>
</li>
<li class="nav-group-task">
<a href="Protocols/KeyedCollection.html">KeyedCollection</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Structs/ErrorList.html">ErrorList</a>
</li>
<li class="nav-group-task">
<a href="Structs/Parser.html">Parser</a>
</li>
<li class="nav-group-task">
<a href="Structs/Serializer.html">Serializer</a>
</li>
<li class="nav-group-task">
<a href="Structs/SyncSerializer.html">SyncSerializer</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>Extensions</h1>
<p>The following extensions are available globally.</p>
</section>
<section class="section task-group-section">
<div class="task-group">
<div class="task-name-container">
<a name="/Coding%20Key%20Interactions"></a>
<a name="//apple_ref/swift/Section/Coding Key Interactions" class="dashAnchor"></a>
<a href="#/Coding%20Key%20Interactions">
<h3 class="section-name">Coding Key Interactions</h3>
</a>
</div>
<ul>
<li class="item">
<div>
<code>
<a name="/s:s5UInt8V"></a>
<a name="//apple_ref/swift/Extension/UInt8" class="dashAnchor"></a>
<a class="token" href="#/s:s5UInt8V">UInt8</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<a href="Extensions/UInt8.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">struct</span> <span class="kt">UInt8</span> <span class="p">:</span> <span class="kt">FixedWidthInteger</span><span class="p">,</span> <span class="kt">UnsignedInteger</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:Sa"></a>
<a name="//apple_ref/swift/Extension/Array" class="dashAnchor"></a>
<a class="token" href="#/s:Sa">Array</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<a href="Extensions/Array.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">struct</span> <span class="kt">Array</span><span class="o">&lt;</span><span class="kt">Element</span><span class="o">&gt;</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:SS"></a>
<a name="//apple_ref/swift/Extension/String" class="dashAnchor"></a>
<a class="token" href="#/s:SS">String</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<a href="Extensions/String.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">struct</span> <span class="kt">String</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:Sq"></a>
<a name="//apple_ref/swift/Extension/Optional" class="dashAnchor"></a>
<a class="token" href="#/s:Sq">Optional</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<a href="Extensions/Optional.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">enum</span> <span class="kt">Optional</span><span class="o">&lt;</span><span class="kt">Wrapped</span><span class="o">&gt;</span> <span class="p">:</span> <span class="kt">ExpressibleByNilLiteral</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>&copy; 2019 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2019-04-19)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>

View File

@ -0,0 +1,261 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Array Extension Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Extension/Array" class="dashAnchor"></a>
<a title="Array Extension Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="../index.html"> Docs</a> (100% documented)</p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="../index.html"> Reference</a>
<img id="carat" src="../img/carat.png" />
Array Extension Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Classes/CSVAsyncDecoder.html">CSVAsyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVAsyncEncoder.html">CSVAsyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVCodingOptions.html">CSVCodingOptions</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVDecoder.html">CSVDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVEncoder.html">CSVEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncDecoder.html">CSVSyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncEncoder.html">CSVSyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/SyncParser.html">SyncParser</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Enums/BoolCodingStrategy.html">BoolCodingStrategy</a>
</li>
<li class="nav-group-task">
<a href="../Enums/NilCodingStrategy.html">NilCodingStrategy</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Extensions/Array.html">Array</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/Optional.html">Optional</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/String.html">String</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/UInt8.html">UInt8</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Protocols.html">Protocols</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Protocols/BytesRepresentable.html">BytesRepresentable</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/KeyedCollection.html">KeyedCollection</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Structs/ErrorList.html">ErrorList</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Parser.html">Parser</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Serializer.html">Serializer</a>
</li>
<li class="nav-group-task">
<a href="../Structs/SyncSerializer.html">SyncSerializer</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>Array</h1>
<div class="declaration">
<div class="language">
<pre class="highlight swift"><code><span class="kd">struct</span> <span class="kt">Array</span><span class="o">&lt;</span><span class="kt">Element</span><span class="o">&gt;</span></code></pre>
</div>
</div>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:s33ExpressibleByUnicodeScalarLiteralP07unicodedE0x0cdE4TypeQz_tcfc"></a>
<a name="//apple_ref/swift/Method/init(unicodeScalarLiteral:)" class="dashAnchor"></a>
<a class="token" href="#/s:s33ExpressibleByUnicodeScalarLiteralP07unicodedE0x0cdE4TypeQz_tcfc">init(unicodeScalarLiteral:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="n">unicodeScalarLiteral</span> <span class="nv">value</span><span class="p">:</span> <span class="kt">UnicodeScalar</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:s43ExpressibleByExtendedGraphemeClusterLiteralP08extendeddeF0x0cdeF4TypeQz_tcfc"></a>
<a name="//apple_ref/swift/Method/init(extendedGraphemeClusterLiteral:)" class="dashAnchor"></a>
<a class="token" href="#/s:s43ExpressibleByExtendedGraphemeClusterLiteralP08extendeddeF0x0cdeF4TypeQz_tcfc">init(extendedGraphemeClusterLiteral:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="n">extendedGraphemeClusterLiteral</span> <span class="nv">value</span><span class="p">:</span> <span class="kt">Character</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:s26ExpressibleByStringLiteralP06stringD0x0cD4TypeQz_tcfc"></a>
<a name="//apple_ref/swift/Method/init(stringLiteral:)" class="dashAnchor"></a>
<a class="token" href="#/s:s26ExpressibleByStringLiteralP06stringD0x0cD4TypeQz_tcfc">init(stringLiteral:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="n">stringLiteral</span> <span class="nv">value</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:Sa3CSVs5UInt8VRszlE5bytesSayACGvp"></a>
<a name="//apple_ref/swift/Property/bytes" class="dashAnchor"></a>
<a class="token" href="#/s:Sa3CSVs5UInt8VRszlE5bytesSayACGvp">bytes</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Returns <code>Self</code>.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">bytes</span><span class="p">:</span> <span class="p">[</span><span class="kt">UInt8</span><span class="p">]</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>&copy; 2019 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2019-04-19)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>

View File

@ -0,0 +1,171 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Optional Extension Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Extension/Optional" class="dashAnchor"></a>
<a title="Optional Extension Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="../index.html"> Docs</a> (100% documented)</p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="../index.html"> Reference</a>
<img id="carat" src="../img/carat.png" />
Optional Extension Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Classes/CSVAsyncDecoder.html">CSVAsyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVAsyncEncoder.html">CSVAsyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVCodingOptions.html">CSVCodingOptions</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVDecoder.html">CSVDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVEncoder.html">CSVEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncDecoder.html">CSVSyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncEncoder.html">CSVSyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/SyncParser.html">SyncParser</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Enums/BoolCodingStrategy.html">BoolCodingStrategy</a>
</li>
<li class="nav-group-task">
<a href="../Enums/NilCodingStrategy.html">NilCodingStrategy</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Extensions/Array.html">Array</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/Optional.html">Optional</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/String.html">String</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/UInt8.html">UInt8</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Protocols.html">Protocols</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Protocols/BytesRepresentable.html">BytesRepresentable</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/KeyedCollection.html">KeyedCollection</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Structs/ErrorList.html">ErrorList</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Parser.html">Parser</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Serializer.html">Serializer</a>
</li>
<li class="nav-group-task">
<a href="../Structs/SyncSerializer.html">SyncSerializer</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>Optional</h1>
<div class="declaration">
<div class="language">
<pre class="highlight swift"><code><span class="kd">enum</span> <span class="kt">Optional</span><span class="o">&lt;</span><span class="kt">Wrapped</span><span class="o">&gt;</span> <span class="p">:</span> <span class="kt">ExpressibleByNilLiteral</span></code></pre>
</div>
</div>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:Sq3CSVAA18BytesRepresentableRzlE5bytesSays5UInt8VGvp"></a>
<a name="//apple_ref/swift/Property/bytes" class="dashAnchor"></a>
<a class="token" href="#/s:Sq3CSVAA18BytesRepresentableRzlE5bytesSays5UInt8VGvp">bytes</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The wrapped value&rsquo;s bytes or an empty <code>Array</code>.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">bytes</span><span class="p">:</span> <span class="p">[</span><span class="kt">UInt8</span><span class="p">]</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>&copy; 2019 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2019-04-19)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>

View File

@ -0,0 +1,171 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>String Extension Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Extension/String" class="dashAnchor"></a>
<a title="String Extension Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="../index.html"> Docs</a> (100% documented)</p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="../index.html"> Reference</a>
<img id="carat" src="../img/carat.png" />
String Extension Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Classes/CSVAsyncDecoder.html">CSVAsyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVAsyncEncoder.html">CSVAsyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVCodingOptions.html">CSVCodingOptions</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVDecoder.html">CSVDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVEncoder.html">CSVEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncDecoder.html">CSVSyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncEncoder.html">CSVSyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/SyncParser.html">SyncParser</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Enums/BoolCodingStrategy.html">BoolCodingStrategy</a>
</li>
<li class="nav-group-task">
<a href="../Enums/NilCodingStrategy.html">NilCodingStrategy</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Extensions/Array.html">Array</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/Optional.html">Optional</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/String.html">String</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/UInt8.html">UInt8</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Protocols.html">Protocols</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Protocols/BytesRepresentable.html">BytesRepresentable</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/KeyedCollection.html">KeyedCollection</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Structs/ErrorList.html">ErrorList</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Parser.html">Parser</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Serializer.html">Serializer</a>
</li>
<li class="nav-group-task">
<a href="../Structs/SyncSerializer.html">SyncSerializer</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>String</h1>
<div class="declaration">
<div class="language">
<pre class="highlight swift"><code><span class="kd">struct</span> <span class="kt">String</span></code></pre>
</div>
</div>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:SS3CSVE5bytesSays5UInt8VGvp"></a>
<a name="//apple_ref/swift/Property/bytes" class="dashAnchor"></a>
<a class="token" href="#/s:SS3CSVE5bytesSays5UInt8VGvp">bytes</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The string&rsquo;s UTF-* view converted to an <code>Array</code>.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">bytes</span><span class="p">:</span> <span class="p">[</span><span class="kt">UInt8</span><span class="p">]</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>&copy; 2019 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2019-04-19)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>

View File

@ -0,0 +1,170 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>UInt8 Extension Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Extension/UInt8" class="dashAnchor"></a>
<a title="UInt8 Extension Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="../index.html"> Docs</a> (100% documented)</p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="../index.html"> Reference</a>
<img id="carat" src="../img/carat.png" />
UInt8 Extension Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Classes/CSVAsyncDecoder.html">CSVAsyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVAsyncEncoder.html">CSVAsyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVCodingOptions.html">CSVCodingOptions</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVDecoder.html">CSVDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVEncoder.html">CSVEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncDecoder.html">CSVSyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncEncoder.html">CSVSyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/SyncParser.html">SyncParser</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Enums/BoolCodingStrategy.html">BoolCodingStrategy</a>
</li>
<li class="nav-group-task">
<a href="../Enums/NilCodingStrategy.html">NilCodingStrategy</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Extensions/Array.html">Array</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/Optional.html">Optional</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/String.html">String</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/UInt8.html">UInt8</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Protocols.html">Protocols</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Protocols/BytesRepresentable.html">BytesRepresentable</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/KeyedCollection.html">KeyedCollection</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Structs/ErrorList.html">ErrorList</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Parser.html">Parser</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Serializer.html">Serializer</a>
</li>
<li class="nav-group-task">
<a href="../Structs/SyncSerializer.html">SyncSerializer</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>UInt8</h1>
<div class="declaration">
<div class="language">
<pre class="highlight swift"><code><span class="kd">struct</span> <span class="kt">UInt8</span> <span class="p">:</span> <span class="kt">FixedWidthInteger</span><span class="p">,</span> <span class="kt">UnsignedInteger</span></code></pre>
</div>
</div>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:s33ExpressibleByUnicodeScalarLiteralP07unicodedE0x0cdE4TypeQz_tcfc"></a>
<a name="//apple_ref/swift/Method/init(unicodeScalarLiteral:)" class="dashAnchor"></a>
<a class="token" href="#/s:s33ExpressibleByUnicodeScalarLiteralP07unicodedE0x0cdE4TypeQz_tcfc">init(unicodeScalarLiteral:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="n">unicodeScalarLiteral</span> <span class="nv">value</span><span class="p">:</span> <span class="kt">UnicodeScalar</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>&copy; 2019 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2019-04-19)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>

View File

@ -0,0 +1,197 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Protocols Reference</title>
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
<meta charset='utf-8'>
<script src="js/jquery.min.js" defer></script>
<script src="js/jazzy.js" defer></script>
</head>
<body>
<a title="Protocols Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="index.html"> Docs</a> (100% documented)</p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="index.html"> Reference</a>
<img id="carat" src="img/carat.png" />
Protocols Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Classes/CSVAsyncDecoder.html">CSVAsyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="Classes/CSVAsyncEncoder.html">CSVAsyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="Classes/CSVCodingOptions.html">CSVCodingOptions</a>
</li>
<li class="nav-group-task">
<a href="Classes/CSVDecoder.html">CSVDecoder</a>
</li>
<li class="nav-group-task">
<a href="Classes/CSVEncoder.html">CSVEncoder</a>
</li>
<li class="nav-group-task">
<a href="Classes/CSVSyncDecoder.html">CSVSyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="Classes/CSVSyncEncoder.html">CSVSyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="Classes/SyncParser.html">SyncParser</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Enums/BoolCodingStrategy.html">BoolCodingStrategy</a>
</li>
<li class="nav-group-task">
<a href="Enums/NilCodingStrategy.html">NilCodingStrategy</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Extensions/Array.html">Array</a>
</li>
<li class="nav-group-task">
<a href="Extensions/Optional.html">Optional</a>
</li>
<li class="nav-group-task">
<a href="Extensions/String.html">String</a>
</li>
<li class="nav-group-task">
<a href="Extensions/UInt8.html">UInt8</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Protocols.html">Protocols</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Protocols/BytesRepresentable.html">BytesRepresentable</a>
</li>
<li class="nav-group-task">
<a href="Protocols/KeyedCollection.html">KeyedCollection</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Structs/ErrorList.html">ErrorList</a>
</li>
<li class="nav-group-task">
<a href="Structs/Parser.html">Parser</a>
</li>
<li class="nav-group-task">
<a href="Structs/Serializer.html">Serializer</a>
</li>
<li class="nav-group-task">
<a href="Structs/SyncSerializer.html">SyncSerializer</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>Protocols</h1>
<p>The following protocols are available globally.</p>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:3CSV18BytesRepresentableP"></a>
<a name="//apple_ref/swift/Protocol/BytesRepresentable" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV18BytesRepresentableP">BytesRepresentable</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The type where an instance can be represented by an array of bytes (<code>UInt8</code>).</p>
<a href="Protocols/BytesRepresentable.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">BytesRepresentable</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:3CSV15KeyedCollectionP"></a>
<a name="//apple_ref/swift/Protocol/KeyedCollection" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV15KeyedCollectionP">KeyedCollection</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>A <code>Collection</code> type that contains keyed values.</p>
<p>This protocol acts as an abstraction over <code>Dictionary</code> for the <code><a href="Structs/Serializer.html">Serializer</a></code> type. It is mostly
for testing purposes but you can also conform your own types if you want.</p>
<a href="Protocols/KeyedCollection.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">KeyedCollection</span><span class="p">:</span> <span class="kt">Collection</span> <span class="k">where</span> <span class="k">Self</span><span class="o">.</span><span class="kt">Element</span> <span class="o">==</span> <span class="p">(</span><span class="nv">key</span><span class="p">:</span> <span class="kt">Key</span><span class="p">,</span> <span class="nv">value</span><span class="p">:</span> <span class="kt">Value</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>&copy; 2019 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2019-04-19)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>

View File

@ -0,0 +1,172 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>BytesRepresentable Protocol Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Protocol/BytesRepresentable" class="dashAnchor"></a>
<a title="BytesRepresentable Protocol Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="../index.html"> Docs</a> (100% documented)</p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="../index.html"> Reference</a>
<img id="carat" src="../img/carat.png" />
BytesRepresentable Protocol Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Classes/CSVAsyncDecoder.html">CSVAsyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVAsyncEncoder.html">CSVAsyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVCodingOptions.html">CSVCodingOptions</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVDecoder.html">CSVDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVEncoder.html">CSVEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncDecoder.html">CSVSyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncEncoder.html">CSVSyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/SyncParser.html">SyncParser</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Enums/BoolCodingStrategy.html">BoolCodingStrategy</a>
</li>
<li class="nav-group-task">
<a href="../Enums/NilCodingStrategy.html">NilCodingStrategy</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Extensions/Array.html">Array</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/Optional.html">Optional</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/String.html">String</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/UInt8.html">UInt8</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Protocols.html">Protocols</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Protocols/BytesRepresentable.html">BytesRepresentable</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/KeyedCollection.html">KeyedCollection</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Structs/ErrorList.html">ErrorList</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Parser.html">Parser</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Serializer.html">Serializer</a>
</li>
<li class="nav-group-task">
<a href="../Structs/SyncSerializer.html">SyncSerializer</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>BytesRepresentable</h1>
<div class="declaration">
<div class="language">
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">BytesRepresentable</span></code></pre>
</div>
</div>
<p>The type where an instance can be represented by an array of bytes (<code>UInt8</code>).</p>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:3CSV18BytesRepresentableP5bytesSays5UInt8VGvp"></a>
<a name="//apple_ref/swift/Property/bytes" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV18BytesRepresentableP5bytesSays5UInt8VGvp">bytes</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The bytes that represent the given instance of <code>Self</code>.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">var</span> <span class="nv">bytes</span><span class="p">:</span> <span class="p">[</span><span class="kt">UInt8</span><span class="p">]</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>&copy; 2019 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2019-04-19)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>

View File

@ -0,0 +1,310 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>KeyedCollection Protocol Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Protocol/KeyedCollection" class="dashAnchor"></a>
<a title="KeyedCollection Protocol Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="../index.html"> Docs</a> (100% documented)</p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="../index.html"> Reference</a>
<img id="carat" src="../img/carat.png" />
KeyedCollection Protocol Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Classes/CSVAsyncDecoder.html">CSVAsyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVAsyncEncoder.html">CSVAsyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVCodingOptions.html">CSVCodingOptions</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVDecoder.html">CSVDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVEncoder.html">CSVEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncDecoder.html">CSVSyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncEncoder.html">CSVSyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/SyncParser.html">SyncParser</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Enums/BoolCodingStrategy.html">BoolCodingStrategy</a>
</li>
<li class="nav-group-task">
<a href="../Enums/NilCodingStrategy.html">NilCodingStrategy</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Extensions/Array.html">Array</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/Optional.html">Optional</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/String.html">String</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/UInt8.html">UInt8</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Protocols.html">Protocols</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Protocols/BytesRepresentable.html">BytesRepresentable</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/KeyedCollection.html">KeyedCollection</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Structs/ErrorList.html">ErrorList</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Parser.html">Parser</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Serializer.html">Serializer</a>
</li>
<li class="nav-group-task">
<a href="../Structs/SyncSerializer.html">SyncSerializer</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>KeyedCollection</h1>
<div class="declaration">
<div class="language">
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">KeyedCollection</span><span class="p">:</span> <span class="kt">Collection</span> <span class="k">where</span> <span class="k">Self</span><span class="o">.</span><span class="kt">Element</span> <span class="o">==</span> <span class="p">(</span><span class="nv">key</span><span class="p">:</span> <span class="kt">Key</span><span class="p">,</span> <span class="nv">value</span><span class="p">:</span> <span class="kt">Value</span><span class="p">)</span></code></pre>
</div>
</div>
<p>A <code>Collection</code> type that contains keyed values.</p>
<p>This protocol acts as an abstraction over <code>Dictionary</code> for the <code><a href="../Structs/Serializer.html">Serializer</a></code> type. It is mostly
for testing purposes but you can also conform your own types if you want.</p>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:3CSV15KeyedCollectionP3KeyQa"></a>
<a name="//apple_ref/swift/Alias/Key" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV15KeyedCollectionP3KeyQa">Key</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The type of a key for a given value.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">associatedtype</span> <span class="kt">Key</span><span class="p">:</span> <span class="kt">Hashable</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:3CSV15KeyedCollectionP4KeysQa"></a>
<a name="//apple_ref/swift/Alias/Keys" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV15KeyedCollectionP4KeysQa">Keys</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The collection type for a list of the collection&rsquo;s keys.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">associatedtype</span> <span class="kt">Keys</span><span class="p">:</span> <span class="kt">Collection</span> <span class="k">where</span> <span class="kt">Keys</span><span class="o">.</span><span class="kt">Element</span> <span class="o">==</span> <span class="kt"><a href="../Protocols/KeyedCollection.html#/s:3CSV15KeyedCollectionP3KeyQa">Key</a></span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:3CSV15KeyedCollectionP5ValueQa"></a>
<a name="//apple_ref/swift/Alias/Value" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV15KeyedCollectionP5ValueQa">Value</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The type of a value.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">associatedtype</span> <span class="kt">Value</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:3CSV15KeyedCollectionP6ValuesQa"></a>
<a name="//apple_ref/swift/Alias/Values" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV15KeyedCollectionP6ValuesQa">Values</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The collection type for a list of the collection&rsquo;s values.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">associatedtype</span> <span class="kt">Values</span><span class="p">:</span> <span class="kt">Collection</span> <span class="k">where</span> <span class="kt">Values</span><span class="o">.</span><span class="kt">Element</span> <span class="o">==</span> <span class="kt"><a href="../Protocols/KeyedCollection.html#/s:3CSV15KeyedCollectionP5ValueQa">Value</a></span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:3CSV15KeyedCollectionP4keys4KeysQzvp"></a>
<a name="//apple_ref/swift/Property/keys" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV15KeyedCollectionP4keys4KeysQzvp">keys</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>All the collection&rsquo;s keyes.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">var</span> <span class="nv">keys</span><span class="p">:</span> <span class="kt"><a href="../Protocols/KeyedCollection.html#/s:3CSV15KeyedCollectionP4KeysQa">Keys</a></span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:3CSV15KeyedCollectionP6values6ValuesQzvp"></a>
<a name="//apple_ref/swift/Property/values" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV15KeyedCollectionP6values6ValuesQzvp">values</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>All the collection&rsquo;s values.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">var</span> <span class="nv">values</span><span class="p">:</span> <span class="kt"><a href="../Protocols/KeyedCollection.html#/s:3CSV15KeyedCollectionP6ValuesQa">Values</a></span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>&copy; 2019 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2019-04-19)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>

View File

@ -0,0 +1,264 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Structures Reference</title>
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
<meta charset='utf-8'>
<script src="js/jquery.min.js" defer></script>
<script src="js/jazzy.js" defer></script>
</head>
<body>
<a title="Structures Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="index.html"> Docs</a> (100% documented)</p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="index.html"> Reference</a>
<img id="carat" src="img/carat.png" />
Structures Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Classes/CSVAsyncDecoder.html">CSVAsyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="Classes/CSVAsyncEncoder.html">CSVAsyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="Classes/CSVCodingOptions.html">CSVCodingOptions</a>
</li>
<li class="nav-group-task">
<a href="Classes/CSVDecoder.html">CSVDecoder</a>
</li>
<li class="nav-group-task">
<a href="Classes/CSVEncoder.html">CSVEncoder</a>
</li>
<li class="nav-group-task">
<a href="Classes/CSVSyncDecoder.html">CSVSyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="Classes/CSVSyncEncoder.html">CSVSyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="Classes/SyncParser.html">SyncParser</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Enums/BoolCodingStrategy.html">BoolCodingStrategy</a>
</li>
<li class="nav-group-task">
<a href="Enums/NilCodingStrategy.html">NilCodingStrategy</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Extensions/Array.html">Array</a>
</li>
<li class="nav-group-task">
<a href="Extensions/Optional.html">Optional</a>
</li>
<li class="nav-group-task">
<a href="Extensions/String.html">String</a>
</li>
<li class="nav-group-task">
<a href="Extensions/UInt8.html">UInt8</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Protocols.html">Protocols</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Protocols/BytesRepresentable.html">BytesRepresentable</a>
</li>
<li class="nav-group-task">
<a href="Protocols/KeyedCollection.html">KeyedCollection</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Structs/ErrorList.html">ErrorList</a>
</li>
<li class="nav-group-task">
<a href="Structs/Parser.html">Parser</a>
</li>
<li class="nav-group-task">
<a href="Structs/Serializer.html">Serializer</a>
</li>
<li class="nav-group-task">
<a href="Structs/SyncSerializer.html">SyncSerializer</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>Structures</h1>
<p>The following structures are available globally.</p>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:3CSV9ErrorListV"></a>
<a name="//apple_ref/swift/Struct/ErrorList" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV9ErrorListV">ErrorList</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Wraps an accumulated list of errors.</p>
<a href="Structs/ErrorList.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">ErrorList</span><span class="p">:</span> <span class="kt">Error</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:3CSV6ParserV"></a>
<a name="//apple_ref/swift/Struct/Parser" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV6ParserV">Parser</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>A parser for streaming <code>CSV</code> data.</p>
<div class="aside aside-note">
<p class="aside-title">Note</p>
You should create a new <code>Parser</code> instance for each CSV document you parse.
</div>
<a href="Structs/Parser.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">Parser</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:3CSV10SerializerV"></a>
<a name="//apple_ref/swift/Struct/Serializer" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV10SerializerV">Serializer</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Serializes dictionary data to CSV document data.</p>
<div class="aside aside-note">
<p class="aside-title">Note</p>
You should create a new <code>Serializer</code> dictionary you serialize.
</div>
<a href="Structs/Serializer.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">Serializer</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:3CSV14SyncSerializerV"></a>
<a name="//apple_ref/swift/Struct/SyncSerializer" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV14SyncSerializerV">SyncSerializer</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>A synchronous wrapper for the <code><a href="Structs/Serializer.html">Serializer</a></code> struct for parsing a whole CSV document.</p>
<a href="Structs/SyncSerializer.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">SyncSerializer</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>&copy; 2019 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2019-04-19)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>

View File

@ -0,0 +1,218 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>ErrorList Structure Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Struct/ErrorList" class="dashAnchor"></a>
<a title="ErrorList Structure Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="../index.html"> Docs</a> (100% documented)</p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="../index.html"> Reference</a>
<img id="carat" src="../img/carat.png" />
ErrorList Structure Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Classes/CSVAsyncDecoder.html">CSVAsyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVAsyncEncoder.html">CSVAsyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVCodingOptions.html">CSVCodingOptions</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVDecoder.html">CSVDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVEncoder.html">CSVEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncDecoder.html">CSVSyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncEncoder.html">CSVSyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/SyncParser.html">SyncParser</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Enums/BoolCodingStrategy.html">BoolCodingStrategy</a>
</li>
<li class="nav-group-task">
<a href="../Enums/NilCodingStrategy.html">NilCodingStrategy</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Extensions/Array.html">Array</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/Optional.html">Optional</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/String.html">String</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/UInt8.html">UInt8</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Protocols.html">Protocols</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Protocols/BytesRepresentable.html">BytesRepresentable</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/KeyedCollection.html">KeyedCollection</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Structs/ErrorList.html">ErrorList</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Parser.html">Parser</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Serializer.html">Serializer</a>
</li>
<li class="nav-group-task">
<a href="../Structs/SyncSerializer.html">SyncSerializer</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>ErrorList</h1>
<div class="declaration">
<div class="language">
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">ErrorList</span><span class="p">:</span> <span class="kt">Error</span></code></pre>
</div>
</div>
<p>Wraps an accumulated list of errors.</p>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:3CSV9ErrorListV6errorsSays0B0_pGvp"></a>
<a name="//apple_ref/swift/Property/errors" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV9ErrorListV6errorsSays0B0_pGvp">errors</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>A list of errors from a repeating operation.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">errors</span><span class="p">:</span> <span class="p">[</span><span class="kt">Error</span><span class="p">]</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:3CSV9ErrorListV6errorsACSays0B0_pG_tcfc"></a>
<a name="//apple_ref/swift/Method/init(errors:)" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV9ErrorListV6errorsACSays0B0_pG_tcfc">init(errors:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Creates a new <code>ErrorList</code> instance.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">errors</span><span class="p">:</span> <span class="p">[</span><span class="kt">Error</span><span class="p">]</span> <span class="o">=</span> <span class="p">[])</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>errors</em>
</code>
</td>
<td>
<div>
<p>The initial errors to populate the <code><a href="../Structs/ErrorList.html#/s:3CSV9ErrorListV6errorsSays0B0_pGvp">errors</a></code> array. Defaults to an empty array.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>&copy; 2019 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2019-04-19)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>

View File

@ -0,0 +1,435 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Parser Structure Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Struct/Parser" class="dashAnchor"></a>
<a title="Parser Structure Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="../index.html"> Docs</a> (100% documented)</p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="../index.html"> Reference</a>
<img id="carat" src="../img/carat.png" />
Parser Structure Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Classes/CSVAsyncDecoder.html">CSVAsyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVAsyncEncoder.html">CSVAsyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVCodingOptions.html">CSVCodingOptions</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVDecoder.html">CSVDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVEncoder.html">CSVEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncDecoder.html">CSVSyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncEncoder.html">CSVSyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/SyncParser.html">SyncParser</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Enums/BoolCodingStrategy.html">BoolCodingStrategy</a>
</li>
<li class="nav-group-task">
<a href="../Enums/NilCodingStrategy.html">NilCodingStrategy</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Extensions/Array.html">Array</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/Optional.html">Optional</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/String.html">String</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/UInt8.html">UInt8</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Protocols.html">Protocols</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Protocols/BytesRepresentable.html">BytesRepresentable</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/KeyedCollection.html">KeyedCollection</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Structs/ErrorList.html">ErrorList</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Parser.html">Parser</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Serializer.html">Serializer</a>
</li>
<li class="nav-group-task">
<a href="../Structs/SyncSerializer.html">SyncSerializer</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>Parser</h1>
<div class="declaration">
<div class="language">
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">Parser</span></code></pre>
</div>
</div>
<p>A parser for streaming <code>CSV</code> data.</p>
<div class="aside aside-note">
<p class="aside-title">Note</p>
You should create a new <code>Parser</code> instance for each CSV document you parse.
</div>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:3CSV6ParserV13HeaderHandlera"></a>
<a name="//apple_ref/swift/Alias/HeaderHandler" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV6ParserV13HeaderHandlera">HeaderHandler</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The type of handler that gets called when a header is parsed.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">typealias</span> <span class="kt">HeaderHandler</span> <span class="o">=</span> <span class="p">(</span><span class="n">_</span> <span class="nv">title</span><span class="p">:</span> <span class="p">[</span><span class="kt">UInt8</span><span class="p">])</span><span class="k">throws</span> <span class="o">-&gt;</span> <span class="p">()</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>title</em>
</code>
</td>
<td>
<div>
<p>The data for the header that is parsed.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:3CSV6ParserV11CellHandlera"></a>
<a name="//apple_ref/swift/Alias/CellHandler" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV6ParserV11CellHandlera">CellHandler</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The type of handler that gets called when a cell is parsed.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">typealias</span> <span class="kt">CellHandler</span> <span class="o">=</span> <span class="p">(</span><span class="n">_</span> <span class="nv">title</span><span class="p">:</span> <span class="p">[</span><span class="kt">UInt8</span><span class="p">],</span> <span class="n">_</span> <span class="nv">contents</span><span class="p">:</span> <span class="p">[</span><span class="kt">UInt8</span><span class="p">])</span><span class="k">throws</span> <span class="o">-&gt;</span> <span class="p">()</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>title</em>
</code>
</td>
<td>
<div>
<p>The header for the cell that is parsed.</p>
</div>
</td>
</tr>
<tr>
<td>
<code>
<em>contents</em>
</code>
</td>
<td>
<div>
<p>The data for the cell that is parsed.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:3CSV6ParserV8onHeaderySays5UInt8VGKcSgvp"></a>
<a name="//apple_ref/swift/Property/onHeader" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV6ParserV8onHeaderySays5UInt8VGKcSgvp">onHeader</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The callback that is called when a header is parsed.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">onHeader</span><span class="p">:</span> <span class="kt"><a href="../Structs/Parser.html#/s:3CSV6ParserV13HeaderHandlera">HeaderHandler</a></span><span class="p">?</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:3CSV6ParserV6onCellySays5UInt8VG_AGtKcSgvp"></a>
<a name="//apple_ref/swift/Property/onCell" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV6ParserV6onCellySays5UInt8VG_AGtKcSgvp">onCell</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The callback that is called when a cell is parsed.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">onCell</span><span class="p">:</span> <span class="kt"><a href="../Structs/Parser.html#/s:3CSV6ParserV11CellHandlera">CellHandler</a></span><span class="p">?</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:3CSV6ParserV8onHeader0C4CellACySays5UInt8VGKcSg_yAH_AHtKcSgtcfc"></a>
<a name="//apple_ref/swift/Method/init(onHeader:onCell:)" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV6ParserV8onHeader0C4CellACySays5UInt8VGKcSg_yAH_AHtKcSgtcfc">init(onHeader:onCell:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Creates a new <code>Parser</code> instance.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">onHeader</span><span class="p">:</span> <span class="kt"><a href="../Structs/Parser.html#/s:3CSV6ParserV13HeaderHandlera">HeaderHandler</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">onCell</span><span class="p">:</span> <span class="kt"><a href="../Structs/Parser.html#/s:3CSV6ParserV11CellHandlera">CellHandler</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>onHeader</em>
</code>
</td>
<td>
<div>
<p>The callback that will be called when a header is parsed.</p>
</div>
</td>
</tr>
<tr>
<td>
<code>
<em>onCell</em>
</code>
</td>
<td>
<div>
<p>The callback that will be called when a cell is parsed.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:3CSV6ParserV5parse_6lengths6ResultOyytAA9ErrorListVGSays5UInt8VG_SiSgtF"></a>
<a name="//apple_ref/swift/Method/parse(_:length:)" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV6ParserV5parse_6lengths6ResultOyytAA9ErrorListVGSays5UInt8VG_SiSgtF">parse(_:length:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Parses an arbitrary portion of a CSV document.</p>
<p>The data passed in should be the next slice of the document directly after the previous one.</p>
<p>When a header is parsed from the data, the data will be passed into the registered <code><a href="../Structs/Parser.html#/s:3CSV6ParserV8onHeaderySays5UInt8VGKcSgvp">.onHeader</a></code> callback.
When a cell is parsed from the data, the header for that given cell and the cell&rsquo;s data will be passed into
the <code><a href="../Structs/Parser.html#/s:3CSV6ParserV6onCellySays5UInt8VG_AGtKcSgvp">.onCell</a></code> callback.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">mutating</span> <span class="kd">func</span> <span class="nf">parse</span><span class="p">(</span><span class="n">_</span> <span class="nv">data</span><span class="p">:</span> <span class="p">[</span><span class="kt">UInt8</span><span class="p">],</span> <span class="nv">length</span><span class="p">:</span> <span class="kt">Int</span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Result</span><span class="o">&lt;</span><span class="kt">Void</span><span class="p">,</span> <span class="kt"><a href="../Structs/ErrorList.html">ErrorList</a></span><span class="o">&gt;</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>data</em>
</code>
</td>
<td>
<div>
<p>The portion of the CSV document to parse.</p>
</div>
</td>
</tr>
<tr>
<td>
<code>
<em>length</em>
</code>
</td>
<td>
<div>
<p>The full content length of the document that is being parsed.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div>
<h4>Return Value</h4>
<p>A <code>Result</code> instance that will have a <code>.failure</code> case with all the errors thrown from
the registered callbacks. If there are no errors, then the result will be a <code>.success</code> case.</p>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>&copy; 2019 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2019-04-19)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>

View File

@ -0,0 +1,286 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Serializer Structure Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Struct/Serializer" class="dashAnchor"></a>
<a title="Serializer Structure Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="../index.html"> Docs</a> (100% documented)</p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="../index.html"> Reference</a>
<img id="carat" src="../img/carat.png" />
Serializer Structure Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Classes/CSVAsyncDecoder.html">CSVAsyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVAsyncEncoder.html">CSVAsyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVCodingOptions.html">CSVCodingOptions</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVDecoder.html">CSVDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVEncoder.html">CSVEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncDecoder.html">CSVSyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncEncoder.html">CSVSyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/SyncParser.html">SyncParser</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Enums/BoolCodingStrategy.html">BoolCodingStrategy</a>
</li>
<li class="nav-group-task">
<a href="../Enums/NilCodingStrategy.html">NilCodingStrategy</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Extensions/Array.html">Array</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/Optional.html">Optional</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/String.html">String</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/UInt8.html">UInt8</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Protocols.html">Protocols</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Protocols/BytesRepresentable.html">BytesRepresentable</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/KeyedCollection.html">KeyedCollection</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Structs/ErrorList.html">ErrorList</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Parser.html">Parser</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Serializer.html">Serializer</a>
</li>
<li class="nav-group-task">
<a href="../Structs/SyncSerializer.html">SyncSerializer</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>Serializer</h1>
<div class="declaration">
<div class="language">
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">Serializer</span></code></pre>
</div>
</div>
<p>Serializes dictionary data to CSV document data.</p>
<div class="aside aside-note">
<p class="aside-title">Note</p>
You should create a new <code>Serializer</code> dictionary you serialize.
</div>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:3CSV10SerializerV5onRowyySays5UInt8VGKcvp"></a>
<a name="//apple_ref/swift/Property/onRow" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV10SerializerV5onRowyySays5UInt8VGKcvp">onRow</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The callback that will be called with each row that is serialized.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">onRow</span><span class="p">:</span> <span class="p">([</span><span class="kt">UInt8</span><span class="p">])</span><span class="k">throws</span> <span class="o">-&gt;</span> <span class="p">()</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:3CSV10SerializerV5onRowACySays5UInt8VGKc_tcfc"></a>
<a name="//apple_ref/swift/Method/init(onRow:)" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV10SerializerV5onRowACySays5UInt8VGKc_tcfc">init(onRow:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Creates a new <code>Serializer</code> instance.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">onRow</span><span class="p">:</span> <span class="kd">@escaping</span> <span class="p">([</span><span class="kt">UInt8</span><span class="p">])</span><span class="k">throws</span> <span class="o">-&gt;</span> <span class="p">())</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>onRow</em>
</code>
</td>
<td>
<div>
<p>The callback that will be called with each row that is serialized.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:3CSV10SerializerV9serializeys6ResultOyytAA9ErrorListVGxAA15KeyedCollectionRzAA18BytesRepresentable3KeyRpzSl5ValueRpzAakN_7ElementRPzSxAN_5IndexRPzSZAN_AR6StrideRPzlF"></a>
<a name="//apple_ref/swift/Method/serialize(_:)" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV10SerializerV9serializeys6ResultOyytAA9ErrorListVGxAA15KeyedCollectionRzAA18BytesRepresentable3KeyRpzSl5ValueRpzAakN_7ElementRPzSxAN_5IndexRPzSZAN_AR6StrideRPzlF">serialize(_:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Serializes a dictionary to CSV document data. Usually this will be a dictionary of type
`[BytesRepresentable: [BytesRepresentable]], but it can be any type you conform to the proper protocols.</p>
<p>You can pass multiple dictionaries of the same structure into this method. The headers will only be serialized the
first time it is called.</p>
<div class="aside aside-note">
<p class="aside-title">Note</p>
<p>When you pass a dictionary into this method, each value collection is expect to contain the same
/ number of elements, and will crash with <code>index out of bounds</code> if that assumption is broken.</p>
</div>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">mutating</span> <span class="kd">func</span> <span class="n">serialize</span><span class="o">&lt;</span><span class="kt">Data</span><span class="o">&gt;</span><span class="p">(</span><span class="n">_</span> <span class="nv">data</span><span class="p">:</span> <span class="kt">Data</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Result</span><span class="o">&lt;</span><span class="kt">Void</span><span class="p">,</span> <span class="kt"><a href="../Structs/ErrorList.html">ErrorList</a></span><span class="o">&gt;</span> <span class="k">where</span>
<span class="kt">Data</span><span class="p">:</span> <span class="kt"><a href="../Protocols/KeyedCollection.html">KeyedCollection</a></span><span class="p">,</span> <span class="kt">Data</span><span class="o">.</span><span class="kt">Key</span><span class="p">:</span> <span class="kt"><a href="../Protocols/BytesRepresentable.html">BytesRepresentable</a></span><span class="p">,</span> <span class="kt">Data</span><span class="o">.</span><span class="kt">Value</span><span class="p">:</span> <span class="kt">Collection</span><span class="p">,</span> <span class="kt">Data</span><span class="o">.</span><span class="kt">Value</span><span class="o">.</span><span class="kt">Element</span><span class="p">:</span> <span class="kt"><a href="../Protocols/BytesRepresentable.html">BytesRepresentable</a></span><span class="p">,</span>
<span class="kt">Data</span><span class="o">.</span><span class="kt">Value</span><span class="o">.</span><span class="kt">Index</span><span class="p">:</span> <span class="kt">Strideable</span><span class="p">,</span> <span class="kt">Data</span><span class="o">.</span><span class="kt">Value</span><span class="o">.</span><span class="kt">Index</span><span class="o">.</span><span class="kt">Stride</span><span class="p">:</span> <span class="kt">SignedInteger</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>data</em>
</code>
</td>
<td>
<div>
<p>The dictionary (or other object) to parse.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div>
<h4>Return Value</h4>
<p>A <code>Result</code> instance with a <code>.failure</code> case with all the errors from the the <code><a href="../Structs/Serializer.html#/s:3CSV10SerializerV5onRowyySays5UInt8VGKcvp">.onRow</a></code> callback calls.
If there are no errors, the result will be a <code>.success</code> case.</p>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>&copy; 2019 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2019-04-19)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>

View File

@ -0,0 +1,231 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>SyncSerializer Structure Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Struct/SyncSerializer" class="dashAnchor"></a>
<a title="SyncSerializer Structure Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="../index.html"> Docs</a> (100% documented)</p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="../index.html"> Reference</a>
<img id="carat" src="../img/carat.png" />
SyncSerializer Structure Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Classes/CSVAsyncDecoder.html">CSVAsyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVAsyncEncoder.html">CSVAsyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVCodingOptions.html">CSVCodingOptions</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVDecoder.html">CSVDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVEncoder.html">CSVEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncDecoder.html">CSVSyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/CSVSyncEncoder.html">CSVSyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="../Classes/SyncParser.html">SyncParser</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Enums/BoolCodingStrategy.html">BoolCodingStrategy</a>
</li>
<li class="nav-group-task">
<a href="../Enums/NilCodingStrategy.html">NilCodingStrategy</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Extensions/Array.html">Array</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/Optional.html">Optional</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/String.html">String</a>
</li>
<li class="nav-group-task">
<a href="../Extensions/UInt8.html">UInt8</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Protocols.html">Protocols</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Protocols/BytesRepresentable.html">BytesRepresentable</a>
</li>
<li class="nav-group-task">
<a href="../Protocols/KeyedCollection.html">KeyedCollection</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Structs/ErrorList.html">ErrorList</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Parser.html">Parser</a>
</li>
<li class="nav-group-task">
<a href="../Structs/Serializer.html">Serializer</a>
</li>
<li class="nav-group-task">
<a href="../Structs/SyncSerializer.html">SyncSerializer</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>SyncSerializer</h1>
<div class="declaration">
<div class="language">
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">SyncSerializer</span></code></pre>
</div>
</div>
<p>A synchronous wrapper for the <code><a href="../Structs/Serializer.html">Serializer</a></code> struct for parsing a whole CSV document.</p>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:3CSV14SyncSerializerVACycfc"></a>
<a name="//apple_ref/swift/Method/init()" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV14SyncSerializerVACycfc">init()</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Creates a new <code>SyncSerializer</code> instance.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span> <span class="p">()</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:3CSV14SyncSerializerV9serializeySays5UInt8VGxAA15KeyedCollectionRzAA18BytesRepresentable3KeyRpzSl5ValueRpzAaiL_7ElementRPzSxAL_5IndexRPzSZAL_AP6StrideRPzlF"></a>
<a name="//apple_ref/swift/Method/serialize(_:)" class="dashAnchor"></a>
<a class="token" href="#/s:3CSV14SyncSerializerV9serializeySays5UInt8VGxAA15KeyedCollectionRzAA18BytesRepresentable3KeyRpzSl5ValueRpzAaiL_7ElementRPzSxAL_5IndexRPzSZAL_AP6StrideRPzlF">serialize(_:)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Serializes a dictionary to CSV document data. Usually this will be a dictionary of type
`[BytesRepresentable: [BytesRepresentable]], but it can be any type you conform to the proper protocols.</p>
<div class="aside aside-note">
<p class="aside-title">Note</p>
<p>When you pass a dictionary into this method, each value collection is expect to contain the same
/ number of elements, and will crash with <code>index out of bounds</code> if that assumption is broken.</p>
</div>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="n">serialize</span><span class="o">&lt;</span><span class="kt">Data</span><span class="o">&gt;</span><span class="p">(</span><span class="n">_</span> <span class="nv">data</span><span class="p">:</span> <span class="kt">Data</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="p">[</span><span class="kt">UInt8</span><span class="p">]</span> <span class="k">where</span>
<span class="kt">Data</span><span class="p">:</span> <span class="kt"><a href="../Protocols/KeyedCollection.html">KeyedCollection</a></span><span class="p">,</span> <span class="kt">Data</span><span class="o">.</span><span class="kt">Key</span><span class="p">:</span> <span class="kt"><a href="../Protocols/BytesRepresentable.html">BytesRepresentable</a></span><span class="p">,</span> <span class="kt">Data</span><span class="o">.</span><span class="kt">Value</span><span class="p">:</span> <span class="kt">Collection</span><span class="p">,</span> <span class="kt">Data</span><span class="o">.</span><span class="kt">Value</span><span class="o">.</span><span class="kt">Element</span><span class="p">:</span> <span class="kt"><a href="../Protocols/BytesRepresentable.html">BytesRepresentable</a></span><span class="p">,</span>
<span class="kt">Data</span><span class="o">.</span><span class="kt">Value</span><span class="o">.</span><span class="kt">Index</span><span class="p">:</span> <span class="kt">Strideable</span><span class="p">,</span> <span class="kt">Data</span><span class="o">.</span><span class="kt">Value</span><span class="o">.</span><span class="kt">Index</span><span class="o">.</span><span class="kt">Stride</span><span class="p">:</span> <span class="kt">SignedInteger</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>data</em>
</code>
</td>
<td>
<div>
<p>The dictionary (or other object) to parse.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div>
<h4>Return Value</h4>
<p>The serialized CSV data.</p>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>&copy; 2019 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2019-04-19)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>

View File

@ -0,0 +1,200 @@
/* Credit to https://gist.github.com/wataru420/2048287 */
.highlight {
/* Comment */
/* Error */
/* Keyword */
/* Operator */
/* Comment.Multiline */
/* Comment.Preproc */
/* Comment.Single */
/* Comment.Special */
/* Generic.Deleted */
/* Generic.Deleted.Specific */
/* Generic.Emph */
/* Generic.Error */
/* Generic.Heading */
/* Generic.Inserted */
/* Generic.Inserted.Specific */
/* Generic.Output */
/* Generic.Prompt */
/* Generic.Strong */
/* Generic.Subheading */
/* Generic.Traceback */
/* Keyword.Constant */
/* Keyword.Declaration */
/* Keyword.Pseudo */
/* Keyword.Reserved */
/* Keyword.Type */
/* Literal.Number */
/* Literal.String */
/* Name.Attribute */
/* Name.Builtin */
/* Name.Class */
/* Name.Constant */
/* Name.Entity */
/* Name.Exception */
/* Name.Function */
/* Name.Namespace */
/* Name.Tag */
/* Name.Variable */
/* Operator.Word */
/* Text.Whitespace */
/* Literal.Number.Float */
/* Literal.Number.Hex */
/* Literal.Number.Integer */
/* Literal.Number.Oct */
/* Literal.String.Backtick */
/* Literal.String.Char */
/* Literal.String.Doc */
/* Literal.String.Double */
/* Literal.String.Escape */
/* Literal.String.Heredoc */
/* Literal.String.Interpol */
/* Literal.String.Other */
/* Literal.String.Regex */
/* Literal.String.Single */
/* Literal.String.Symbol */
/* Name.Builtin.Pseudo */
/* Name.Variable.Class */
/* Name.Variable.Global */
/* Name.Variable.Instance */
/* Literal.Number.Integer.Long */ }
.highlight .c {
color: #999988;
font-style: italic; }
.highlight .err {
color: #a61717;
background-color: #e3d2d2; }
.highlight .k {
color: #000000;
font-weight: bold; }
.highlight .o {
color: #000000;
font-weight: bold; }
.highlight .cm {
color: #999988;
font-style: italic; }
.highlight .cp {
color: #999999;
font-weight: bold; }
.highlight .c1 {
color: #999988;
font-style: italic; }
.highlight .cs {
color: #999999;
font-weight: bold;
font-style: italic; }
.highlight .gd {
color: #000000;
background-color: #ffdddd; }
.highlight .gd .x {
color: #000000;
background-color: #ffaaaa; }
.highlight .ge {
color: #000000;
font-style: italic; }
.highlight .gr {
color: #aa0000; }
.highlight .gh {
color: #999999; }
.highlight .gi {
color: #000000;
background-color: #ddffdd; }
.highlight .gi .x {
color: #000000;
background-color: #aaffaa; }
.highlight .go {
color: #888888; }
.highlight .gp {
color: #555555; }
.highlight .gs {
font-weight: bold; }
.highlight .gu {
color: #aaaaaa; }
.highlight .gt {
color: #aa0000; }
.highlight .kc {
color: #000000;
font-weight: bold; }
.highlight .kd {
color: #000000;
font-weight: bold; }
.highlight .kp {
color: #000000;
font-weight: bold; }
.highlight .kr {
color: #000000;
font-weight: bold; }
.highlight .kt {
color: #445588; }
.highlight .m {
color: #009999; }
.highlight .s {
color: #d14; }
.highlight .na {
color: #008080; }
.highlight .nb {
color: #0086B3; }
.highlight .nc {
color: #445588;
font-weight: bold; }
.highlight .no {
color: #008080; }
.highlight .ni {
color: #800080; }
.highlight .ne {
color: #990000;
font-weight: bold; }
.highlight .nf {
color: #990000; }
.highlight .nn {
color: #555555; }
.highlight .nt {
color: #000080; }
.highlight .nv {
color: #008080; }
.highlight .ow {
color: #000000;
font-weight: bold; }
.highlight .w {
color: #bbbbbb; }
.highlight .mf {
color: #009999; }
.highlight .mh {
color: #009999; }
.highlight .mi {
color: #009999; }
.highlight .mo {
color: #009999; }
.highlight .sb {
color: #d14; }
.highlight .sc {
color: #d14; }
.highlight .sd {
color: #d14; }
.highlight .s2 {
color: #d14; }
.highlight .se {
color: #d14; }
.highlight .sh {
color: #d14; }
.highlight .si {
color: #d14; }
.highlight .sx {
color: #d14; }
.highlight .sr {
color: #009926; }
.highlight .s1 {
color: #d14; }
.highlight .ss {
color: #990073; }
.highlight .bp {
color: #999999; }
.highlight .vc {
color: #008080; }
.highlight .vg {
color: #008080; }
.highlight .vi {
color: #008080; }
.highlight .il {
color: #009999; }

View File

@ -0,0 +1,337 @@
html, body, div, span, h1, h3, h4, p, a, code, em, img, ul, li, table, tbody, tr, td {
background: transparent;
border: 0;
margin: 0;
outline: 0;
padding: 0;
vertical-align: baseline; }
body {
background-color: #f2f2f2;
font-family: Helvetica, freesans, Arial, sans-serif;
font-size: 14px;
-webkit-font-smoothing: subpixel-antialiased;
word-wrap: break-word; }
h1, h2, h3 {
margin-top: 0.8em;
margin-bottom: 0.3em;
font-weight: 100;
color: black; }
h1 {
font-size: 2.5em; }
h2 {
font-size: 2em;
border-bottom: 1px solid #e2e2e2; }
h4 {
font-size: 13px;
line-height: 1.5;
margin-top: 21px; }
h5 {
font-size: 1.1em; }
h6 {
font-size: 1.1em;
color: #777; }
.section-name {
color: gray;
display: block;
font-family: Helvetica;
font-size: 22px;
font-weight: 100;
margin-bottom: 15px; }
pre, code {
font: 0.95em Menlo, monospace;
color: #777;
word-wrap: normal; }
p code, li code {
background-color: #eee;
padding: 2px 4px;
border-radius: 4px; }
a {
color: #0088cc;
text-decoration: none; }
ul {
padding-left: 15px; }
li {
line-height: 1.8em; }
img {
max-width: 100%; }
blockquote {
margin-left: 0;
padding: 0 10px;
border-left: 4px solid #ccc; }
.content-wrapper {
margin: 0 auto;
width: 980px; }
header {
font-size: 0.85em;
line-height: 26px;
background-color: #414141;
position: fixed;
width: 100%;
z-index: 1; }
header img {
padding-right: 6px;
vertical-align: -4px;
height: 16px; }
header a {
color: #fff; }
header p {
float: left;
color: #999; }
header .header-right {
float: right;
margin-left: 16px; }
#breadcrumbs {
background-color: #f2f2f2;
height: 27px;
padding-top: 17px;
position: fixed;
width: 100%;
z-index: 1;
margin-top: 26px; }
#breadcrumbs #carat {
height: 10px;
margin: 0 5px; }
.sidebar {
background-color: #f9f9f9;
border: 1px solid #e2e2e2;
overflow-y: auto;
overflow-x: hidden;
position: fixed;
top: 70px;
bottom: 0;
width: 230px;
word-wrap: normal; }
.nav-groups {
list-style-type: none;
background: #fff;
padding-left: 0; }
.nav-group-name {
border-bottom: 1px solid #e2e2e2;
font-size: 1.1em;
font-weight: 100;
padding: 15px 0 15px 20px; }
.nav-group-name > a {
color: #333; }
.nav-group-tasks {
margin-top: 5px; }
.nav-group-task {
font-size: 0.9em;
list-style-type: none;
white-space: nowrap; }
.nav-group-task a {
color: #888; }
.main-content {
background-color: #fff;
border: 1px solid #e2e2e2;
margin-left: 246px;
position: absolute;
overflow: hidden;
padding-bottom: 60px;
top: 70px;
width: 734px; }
.main-content p, .main-content a, .main-content code, .main-content em, .main-content ul, .main-content table, .main-content blockquote {
margin-bottom: 1em; }
.main-content p {
line-height: 1.8em; }
.main-content section .section:first-child {
margin-top: 0;
padding-top: 0; }
.main-content section .task-group-section .task-group:first-of-type {
padding-top: 10px; }
.main-content section .task-group-section .task-group:first-of-type .section-name {
padding-top: 15px; }
.main-content section .heading:before {
content: "";
display: block;
padding-top: 70px;
margin: -70px 0 0; }
.section {
padding: 0 25px; }
.highlight {
background-color: #eee;
padding: 10px 12px;
border: 1px solid #e2e2e2;
border-radius: 4px;
overflow-x: auto; }
.declaration .highlight {
overflow-x: initial;
padding: 0 40px 40px 0;
margin-bottom: -25px;
background-color: transparent;
border: none; }
.section-name {
margin: 0;
margin-left: 18px; }
.task-group-section {
padding-left: 6px;
border-top: 1px solid #e2e2e2; }
.task-group {
padding-top: 0px; }
.task-name-container a[name]:before {
content: "";
display: block;
padding-top: 70px;
margin: -70px 0 0; }
.item {
padding-top: 8px;
width: 100%;
list-style-type: none; }
.item a[name]:before {
content: "";
display: block;
padding-top: 70px;
margin: -70px 0 0; }
.item code {
background-color: transparent;
padding: 0; }
.item .token {
padding-left: 3px;
margin-left: 15px;
font-size: 11.9px; }
.item .declaration-note {
font-size: .85em;
color: gray;
font-style: italic; }
.pointer-container {
border-bottom: 1px solid #e2e2e2;
left: -23px;
padding-bottom: 13px;
position: relative;
width: 110%; }
.pointer {
background: #f9f9f9;
border-left: 1px solid #e2e2e2;
border-top: 1px solid #e2e2e2;
height: 12px;
left: 21px;
top: -7px;
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
-o-transform: rotate(45deg);
transform: rotate(45deg);
position: absolute;
width: 12px; }
.height-container {
display: none;
left: -25px;
padding: 0 25px;
position: relative;
width: 100%;
overflow: hidden; }
.height-container .section {
background: #f9f9f9;
border-bottom: 1px solid #e2e2e2;
left: -25px;
position: relative;
width: 100%;
padding-top: 10px;
padding-bottom: 5px; }
.aside, .language {
padding: 6px 12px;
margin: 12px 0;
border-left: 5px solid #dddddd;
overflow-y: hidden; }
.aside .aside-title, .language .aside-title {
font-size: 9px;
letter-spacing: 2px;
text-transform: uppercase;
padding-bottom: 0;
margin: 0;
color: #aaa;
-webkit-user-select: none; }
.aside p:last-child, .language p:last-child {
margin-bottom: 0; }
.language {
border-left: 5px solid #cde9f4; }
.language .aside-title {
color: #4b8afb; }
.aside-warning {
border-left: 5px solid #ff6666; }
.aside-warning .aside-title {
color: #ff0000; }
.graybox {
border-collapse: collapse;
width: 100%; }
.graybox p {
margin: 0;
word-break: break-word;
min-width: 50px; }
.graybox td {
border: 1px solid #e2e2e2;
padding: 5px 25px 5px 10px;
vertical-align: middle; }
.graybox tr td:first-of-type {
text-align: right;
padding: 7px;
vertical-align: top;
word-break: normal;
width: 40px; }
.slightly-smaller {
font-size: 0.9em; }
#footer {
position: absolute;
bottom: 10px;
margin-left: 25px; }
#footer p {
margin: 0;
color: #aaa;
font-size: 0.8em; }
html.dash header, html.dash #breadcrumbs, html.dash .sidebar {
display: none; }
html.dash .main-content {
width: 980px;
margin-left: 0;
border: none;
width: 100%;
top: 0;
padding-bottom: 0; }
html.dash .height-container {
display: block; }
html.dash .item .token {
margin-left: 0; }
html.dash .content-wrapper {
width: auto; }
html.dash #footer {
position: static; }

Binary file not shown.

After

Width:  |  Height:  |  Size: 274 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -0,0 +1,134 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title> Reference</title>
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
<meta charset='utf-8'>
<script src="js/jquery.min.js" defer></script>
<script src="js/jazzy.js" defer></script>
</head>
<body>
<a title=" Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="index.html"> Docs</a> (100% documented)</p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="index.html"> Reference</a>
<img id="carat" src="img/carat.png" />
Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="Classes.html">Classes</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Classes/CSVAsyncDecoder.html">CSVAsyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="Classes/CSVAsyncEncoder.html">CSVAsyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="Classes/CSVCodingOptions.html">CSVCodingOptions</a>
</li>
<li class="nav-group-task">
<a href="Classes/CSVDecoder.html">CSVDecoder</a>
</li>
<li class="nav-group-task">
<a href="Classes/CSVEncoder.html">CSVEncoder</a>
</li>
<li class="nav-group-task">
<a href="Classes/CSVSyncDecoder.html">CSVSyncDecoder</a>
</li>
<li class="nav-group-task">
<a href="Classes/CSVSyncEncoder.html">CSVSyncEncoder</a>
</li>
<li class="nav-group-task">
<a href="Classes/SyncParser.html">SyncParser</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Enums/BoolCodingStrategy.html">BoolCodingStrategy</a>
</li>
<li class="nav-group-task">
<a href="Enums/NilCodingStrategy.html">NilCodingStrategy</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Extensions/Array.html">Array</a>
</li>
<li class="nav-group-task">
<a href="Extensions/Optional.html">Optional</a>
</li>
<li class="nav-group-task">
<a href="Extensions/String.html">String</a>
</li>
<li class="nav-group-task">
<a href="Extensions/UInt8.html">UInt8</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Protocols.html">Protocols</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Protocols/BytesRepresentable.html">BytesRepresentable</a>
</li>
<li class="nav-group-task">
<a href="Protocols/KeyedCollection.html">KeyedCollection</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Structs.html">Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Structs/ErrorList.html">ErrorList</a>
</li>
<li class="nav-group-task">
<a href="Structs/Parser.html">Parser</a>
</li>
<li class="nav-group-task">
<a href="Structs/Serializer.html">Serializer</a>
</li>
<li class="nav-group-task">
<a href="Structs/SyncSerializer.html">SyncSerializer</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1 id='csv' class='heading'>CSV</h1>
<p>A description of this package.</p>
</section>
</section>
<section id="footer">
<p>&copy; 2019 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2019-04-19)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.1</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>

Some files were not shown because too many files have changed in this diff Show More