ObjectDeserializer
public enum ObjectDeserializer
Provides methods for deserialization JSON data to custom objects
-
Deserializes
Data?
object to the type that conforms toBoxModel
and returns aResult
of this type if success orBoxSDKError
on failure.Declaration
Swift
public static func deserialize<ReturnType>(data: Data?) -> Result<ReturnType, BoxSDKError> where ReturnType : BoxModel
Parameters
data
Binary data to deserialize
Return Value
Returns an object if success otherwise error
-
Deserializes
BoxResponse
object to the type that conforms toDecodable
and returns aResult
of this type if success orBoxSDKError
on failure.Declaration
Swift
public static func deserialize<ReturnType>(response: BoxResponse) -> Result<ReturnType, BoxSDKError> where ReturnType : Decodable
Parameters
response
The
BoxResponse
object whichbody
will be deserializeReturn Value
Returns an object if success otherwise error