changes
This commit is contained in:
parent
205c83c097
commit
37e1cb9e36
@ -8,7 +8,7 @@ extension JSONDecoder: AnyDecoder {}
|
||||
extension PropertyListDecoder: AnyDecoder {}
|
||||
|
||||
extension Data {
|
||||
public func decodeToObject<T: Decodable>(using decoder: AnyDecoder = JSONDecoder()) throws -> T {
|
||||
public func decode<T: Decodable>(using decoder: AnyDecoder = JSONDecoder()) throws -> T {
|
||||
return try decoder.decode(T.self, from: self)
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,7 +8,7 @@ extension JSONEncoder: AnyEncoder {}
|
||||
extension PropertyListEncoder: AnyEncoder {}
|
||||
|
||||
extension Encodable {
|
||||
public func encodeToData(using encoder: AnyEncoder = JSONEncoder()) throws -> Data {
|
||||
public func encode(using encoder: AnyEncoder = JSONEncoder()) throws -> Data {
|
||||
return try encoder.encode(self)
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user