mirror of
https://github.com/zhigang1992/Argo.git
synced 2026-05-22 03:13:13 +08:00
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.
20 lines
425 B
Swift
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
|
|
}
|
|
}
|