Protocols
The following protocols are available globally.
-
A protocol that adds support of complex objects to be serialized into a JSON object.
See moreDeclaration
Swift
public protocol MapEncodable
-
A protocol that adds support of complex objects to be deserialized from a JSON object.
See moreDeclaration
Swift
public protocol MapDecodable
-
A wrapper protocol that reqires both
MapEncodable
andMapDecodable
protocols.Declaration
Swift
public protocol MapCodable : MapDecodable, MapEncodable
-
A protocol that allows you to transform a
See moreMapPrimitive
(JSON) value to another value. This protocol is used to add more type sypport to theMap
class.Declaration
Swift
public protocol MapDecoder
-
A protocol that allows you to transform a value into a
See moreMapPrimitive
(JSON) value. This protocol is used to add more type support to theMap
class.Declaration
Swift
public protocol MapEncoder
-
A protocol combining both
MapEncoder
andMapDecoder
.Declaration
Swift
public protocol MapCoder : MapDecoder, MapEncoder where Self.Object == Self.Object, Self.Primitive == Self.Primitive
-
A MapKey is a protocol that provides a parsing mechanism for converting any object (such as a
String
) into key parts (an array ofKeyPart
objects). Key parts individually represent a key in a JSON dictionary or position in a JSON array. When combined, key parts represent the nesting structure of a JSON dictionary for a specific value, object or array. The order of key parts matter as they coencide with the nesting order in a dictionary.For example, lets say we are given the following key parts: 1
KeyPart.object("first")
2KeyPart.array("second")
3KeyPart.object("first")
This can be used to return the value
My Value
from the nested keyfirst
in the following JSON dictionary:{ "first": { "second": [ { "first": "My Value" } ] } }
Using this key when storing a value in the map will, on the other hand, create the above JSON dictionary.
JSON dictionaries created using key parts are merged when the key part does not represent a leaf in a JSON dictionary.
For example, if I were to add the value
My other value
to the above JSON using the following key parts: 1KeyPart.object("first")
2KeyPart.array("second")
3KeyPart.object("second")
Then i will end up with the following result:
See more{ "first": { "second": [ { "first": "My Value" "second": "My other Value" } ], } }
Declaration
Swift
public protocol MapKey
-
A protocol that represents JSON primatives as well as arrays and dictionaries of map primatives.
WARNING: This protocol should NEVER be used directly as it only adds a form of tagging to primitive variables supported by the
Map
class. All objects in the map are converted to and from aMapPrimitive
object. Adding this protocol to any other object will result in crashes.The following objects support
MapPrimitive
:String
Double
Bool
Int
Int8
Int16
Int32
Int64
UInt
UInt8
UInt16
UInt32
UInt64
Array
where each Element also conforms to aMapPrimitive
Dictionary
where each Value also conforms to aMapPrimitive
Declaration
Swift
public protocol MapPrimitive