Files
Argo/ArgoTests/JSON/JSONFileReader.swift
Tony DiPasquale 3a4974e4ec Use Swift 1 to 2 conversion tool and fix errors
Run the conversion tool in Xcode 7 beta 1 to convert to Swift 2. Remove
Box from the project since it is no longer needed. Fix any errors
leftover.
2015-09-17 14:55:32 -07:00

20 lines
425 B
Swift

import Foundation
import Runes
func JSONFromFile(file: String) -> AnyObject? {
return NSBundle(forClass: JSONFileReader.self).pathForResource(file, ofType: "json")
>>- { NSData(contentsOfFile: $0) }
>>- parseJSON
}
private class JSONFileReader { }
func parseJSON(data: NSData) -> AnyObject? {
do {
return try NSJSONSerialization.JSONObjectWithData(data, options: [])
}
catch _ {
return .None
}
}