Created
January 12, 2016 22:11
-
-
Save zorn/a02cebd22dcdfd4478dc to your computer and use it in GitHub Desktop.
This file contains hidden or 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
private func loadCastData() { | |
// [ | |
// { | |
// "title": "April Main Meeting", | |
// "date": "2016-04-14T18:30:00-0500", | |
// "rsvp_count": 2, | |
// "announced": false | |
// }, | |
// { | |
// "title": "Febuary Main Meeting", | |
// "date": "2016-02-11T18:30:00-0500", | |
// "rsvp_count": 31, | |
// "announced": true | |
// }, | |
// { | |
// "title": "March Main Meeting", | |
// "date": "2016-03-10T18:30:00-0500", | |
// "rsvp_count": 4, | |
// "announced": false | |
// } | |
// ] | |
if let data = getDataFromFileURL(self.dataURL) { | |
let json: AnyObject? = try? NSJSONSerialization.JSONObjectWithData(data, options: []) | |
if let j: AnyObject = json { | |
let decodedCastMember: Decoded<FireflyCastMember> = decode(j) | |
switch decodedCastMember { | |
case .Success(let castMember): | |
castList.append(castMember) | |
case .Failure(let error): | |
presentError(error) | |
} | |
} | |
} else { | |
presentError("Could not load data file.") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment