Skip to content

Commit

Permalink
Update for Swift 1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Tony DiPasquale committed Feb 9, 2015
1 parent 58ed338 commit 5e20d2a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Argo/Globals/JSONValue.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public extension JSONValue {

static func mapDecode<A where A: JSONDecodable, A == A.DecodedType>(value: JSONValue) -> [A]? {
switch value {
case let .JSONArray(a): return sequence(a.map { A.decode($0) })
case let .JSONArray(a): return sequence(A.decode <^> a)
default: return .None
}
}
Expand Down
6 changes: 1 addition & 5 deletions Argo/Operators/JSONOperators.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@ import Runes

// Pull embedded value from JSON
public func <|<A where A: JSONDecodable, A == A.DecodedType>(json: JSONValue, keys: [String]) -> A? {
if let o = json.find(keys) {
return A.decode(o)
}

return .None
return json.find(keys) >>- A.decode
}

// Pull value from JSON
Expand Down
2 changes: 1 addition & 1 deletion Argo/Protocols/JSONDecodable.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
public protocol JSONDecodable {
typealias DecodedType = Self
class func decode(JSONValue) -> DecodedType?
static func decode(JSONValue) -> DecodedType?
}

0 comments on commit 5e20d2a

Please sign in to comment.