-
Notifications
You must be signed in to change notification settings - Fork 194
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Swift 3 enumeration improvements (#69)
* rename columns to namedColumns * move public interface properties into CSV.swift * move "named" field access to NamedView The parse() helper method masked the fact that rows and columns used to be lazily initialized; with NamedView as the base for both computed properties, a lazy initializer works just as well. * refactor enumerateAsArray into a static function * change CSV.header to be computable in the initializer The new static enumeration function helps make it possible to not keep `header` as a mutable force-unwrapped optional. * fix Swift documentation * rename parsing elements * refactor parse helpers * extract parsing state machine * rename CSV.rows to .namedRows * add EnumeratedView as a complementary to hash-based storage
- Loading branch information
1 parent
6625114
commit c35cd94
Showing
14 changed files
with
399 additions
and
167 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// | ||
// EnumeratedView.swift | ||
// SwiftCSV | ||
// | ||
// Created by Christian Tietze on 25/10/16. | ||
// Copyright © 2016 Naoto Kaneko. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
public struct EnumeratedView { | ||
|
||
public struct Column { | ||
public let header: String | ||
public let rows: [String] | ||
} | ||
|
||
var rows: [[String]] | ||
var columns: [Column] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// | ||
// NamedView.swift | ||
// SwiftCSV | ||
// | ||
// Created by Christian Tietze on 22/10/16. | ||
// Copyright © 2016 Naoto Kaneko. All rights reserved. | ||
// | ||
|
||
struct NamedView { | ||
|
||
var rows: [[String: String]] | ||
var columns: [String: [String]] | ||
} |
Oops, something went wrong.