Remove Runes dependency from the playground

This commit is contained in:
Gordon Fontenot
2015-07-15 17:04:09 -04:00
committed by Tony DiPasquale
parent f184851164
commit 16bdb90332
2 changed files with 6 additions and 8 deletions

View File

@@ -5,15 +5,14 @@
*/
import Foundation
import Argo
import Runes
import Curry
/*:
**Helper function** load JSON from a file
*/
func JSONFromFile(file: String) -> AnyObject? {
return NSBundle.mainBundle().pathForResource(file, ofType: "json")
>>- { NSData(contentsOfFile: $0) }
>>- JSONObjectWithData
.flatMap { NSData(contentsOfFile: $0) }
.flatMap(JSONObjectWithData)
}
func JSONObjectWithData(data: NSData) -> AnyObject? {
@@ -50,6 +49,6 @@ extension User: Decodable {
/*:
* * *
*/
let user: User? = JSONFromFile("user_with_email") >>- decode
let user: User? = JSONFromFile("user_with_email").flatMap(decode)
print(user!)

View File

@@ -5,15 +5,14 @@
*/
import Foundation
import Argo
import Runes
import Curry
/*:
**Helper function** load JSON from a file
*/
func JSONFromFile(file: String) -> AnyObject? {
return NSBundle.mainBundle().pathForResource(file, ofType: "json")
>>- { NSData(contentsOfFile: $0) }
>>- JSONObjectWithData
.flatMap { NSData(contentsOfFile: $0) }
.flatMap(JSONObjectWithData)
}
func JSONObjectWithData(data: NSData) -> AnyObject? {
@@ -63,6 +62,6 @@ extension App: Decodable {
/*:
* * *
*/
let app: App? = (JSONFromFile("tropos")?["results"] >>- decode)?.first
let app: App? = (JSONFromFile("tropos")?["results"].flatMap(decode))?.first
print(app!)