Files
hyperoslo-Cache/Source/Shared/DataStructures/JSON.swift
T
2016-09-27 13:19:34 +02:00

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
}
}