Protocols
The following protocols are available globally.
-
A protocol for types that can deserialize JSON.
All methods have default implementations. See
See moreJSONDeserializer‘s extensions for details.Declaration
Swift
public protocol JSONDeserializer
-
Protocol to auto-implement deserialization for
RawRepresentabletypes.Example:
The following enum automatically implementsJSONDeserializer.
See moreenum Lorem: String, JSONRawRepresentable { case ipsum case dolor case sitAmet }Declaration
Swift
public protocol JSONRawRepresentable: JSONDeserializer, RawRepresentable
-
A protocol for types that deserialize themselves from JSON.
Helps reduces boilerplate for types that deserialize themselves from a single source type. Using this protocol you only have to:
- specify the
JSONRepresentationtype - implement
init(jsonData:)
For an example, see UsageTests.swift.
See moreDeclaration
Swift
public protocol JSONRepresentable: JSONDeserializer - specify the
-
Implemented by Foundation types returned by
JSONSerialization.jsonObject(with:options:):- NSArray
- NSDictionary
- NSNull
- NSNumber
- NSString
Declaration
Swift
public protocol JSONAnyParsedObject
View on GitHub
Install in Dash
Protocols Reference