mirror of
https://github.com/hyperoslo/Cache.git
synced 2026-04-07 19:17:36 +00:00
26 lines
447 B
Swift
26 lines
447 B
Swift
import Foundation
|
|
|
|
/**
|
|
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 AnyObject
|
|
public var object: Any {
|
|
var result: Any
|
|
|
|
switch self {
|
|
case .array(let object):
|
|
result = object as Any
|
|
case .dictionary(let object):
|
|
result = object as Any
|
|
}
|
|
|
|
return result
|
|
}
|
|
}
|