CoderProtocol
public protocol CoderProtocol
CoderProtocol API
-
Protocol function to encode the received object to Data
Note: The encodable object has to conform to Apple’s Codable protocol
Throws
Declaration
Swift
func encode<Value>(_ value: Value) throws -> Data where Value : EncodableParameters
valueObject to encode, which conforms to Codable protocol
Return Value
encoded Data object
-
Protocol function to decode the reqested data to original format
Note: The decodable object has to conform to Apple’s Codable protocol before encoding
Throws
Declaration
Swift
func decode<T>(_ type: T.Type, from data: Data) throws -> T where T : DecodableParameters
typethe Codable type itself. example: “String.self”
datathe Data to decode
Return Value
decoded object