-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #254 from Zewo/0.16.1
0.16.1
- Loading branch information
Showing
11 changed files
with
141 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
4.0 | ||
4.0.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import Foundation | ||
extension String { | ||
public init?(json: JSON?) { | ||
guard let json = json else { return nil} | ||
switch json { | ||
case .string(let v): | ||
self = v | ||
default: | ||
return nil | ||
} | ||
} | ||
} | ||
|
||
extension Double { | ||
public init?(json: JSON?) { | ||
guard let json = json else { return nil} | ||
switch json { | ||
case .double(let v): | ||
self = v | ||
default: | ||
return nil | ||
} | ||
} | ||
} | ||
|
||
extension Int { | ||
public init?(json: JSON?) { | ||
guard let json = json else { return nil} | ||
switch json { | ||
case .int(let v): | ||
self = v | ||
default: | ||
return nil | ||
} | ||
} | ||
} | ||
|
||
|
||
extension Bool { | ||
public init?(json: JSON?) { | ||
guard let json = json else { return nil } | ||
switch json { | ||
case .bool(let v): | ||
self = v | ||
default: | ||
return nil | ||
} | ||
} | ||
} | ||
|
||
|
||
extension Array where Array.Element == JSON { | ||
public init?(json: JSON?) { | ||
guard let json = json else { return nil } | ||
switch json { | ||
case .array(let v): | ||
self = v | ||
default: | ||
return nil | ||
} | ||
} | ||
} | ||
|
||
|
||
extension Dictionary where Dictionary.Key == String, Dictionary.Value == JSON { | ||
public init?(json: JSON?) { | ||
guard let json = json else { return nil } | ||
switch json { | ||
case .object(let v): | ||
self = v | ||
default: | ||
return nil | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters