DataSource
open class DataSource<Type> where Type : Decodable
Generic Data Source for parsing NYMTA data
-
All values
Declaration
Swift
public var values: [Type] { get }
-
Initialize from JSON data
Throws
When unable to decode the JSON dataDeclaration
Swift
public required init(json: Data) throws
Parameters
json
JSON data
-
Initialized from a JSON asset in the specified Bundle
Throws
When unable to find the data asset or unable to decode the JSON dataDeclaration
Swift
public convenience init(jsonDataAssetName assetName: String, bundle: Bundle) throws
Parameters
assetName
JSON asset name
bundle
Bundle
-
Initialize from CSV string
Throws
When unable to decode the CSV dataDeclaration
Swift
public required init(csv: String) throws
Parameters
csv
CSV string
-
Initialize from CSV data
Throws
When unable to decode the CSV dataDeclaration
Swift
public convenience init(csv: Data) throws
Parameters
csv
CSV data
-
Initialize from a CSV asset in the specified Bundle
Throws
When unable to find the data asset or unable to decode the CSV dataDeclaration
Swift
public convenience init(csvDataAssetName assetName: String, bundle: Bundle) throws
Parameters
assetName
CSV asset name
bundle
Bundle