mirror of
https://github.com/zhigang1992/Argo.git
synced 2026-01-13 09:00:00 +08:00
This also breaks up the main README.md into a Documentations directory with separate documents for different topics. This will be expanded upon with new PRs going forward.
14 lines
404 B
Swift
14 lines
404 B
Swift
import Foundation
|
|
|
|
func JSONFromFile(file: String) -> AnyObject? {
|
|
return NSBundle(forClass: JSONFileReader.self).pathForResource(file, ofType: "json")
|
|
.flatMap { NSData(contentsOfFile: $0) }
|
|
.flatMap(JSONObjectWithData)
|
|
}
|
|
|
|
private func JSONObjectWithData(data: NSData) -> AnyObject? {
|
|
return try? NSJSONSerialization.JSONObjectWithData(data, options: [])
|
|
}
|
|
|
|
private class JSONFileReader { }
|