Created
June 15, 2018 08:09
-
-
Save onmyway133/81c6578ce5f77c6f571a774e6b025359 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
/** | |
Helper enum to work with JSON arrays and dictionaries. | |
*/ | |
public enum JSON { | |
/// JSON array | |
case array([Any]) | |
/// JSON dictionary | |
case dictionary([String : Any]) | |
/// Converts value to Any | |
public var object: Any { | |
switch self { | |
case .array(let object): | |
return object | |
case .dictionary(let object): | |
return object | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment