rename
This commit is contained in:
parent
5d836fc757
commit
d75a152b9a
@ -46,13 +46,13 @@ extension KeyedDecodingContainer where Key: CodingKey {
|
|||||||
//MARK: - DecodeIfPresent
|
//MARK: - DecodeIfPresent
|
||||||
public func decodeIfPresent<T, C:CodingKey>(codingKey: KeyedDecodingContainer<K>.Key, typeCodingKey: C) throws -> T? {
|
public func decodeIfPresent<T, C:CodingKey>(codingKey: KeyedDecodingContainer<K>.Key, typeCodingKey: C) throws -> T? {
|
||||||
//get the type string
|
//get the type string
|
||||||
var me: KeyedDecodingContainer<C>?
|
var meta: KeyedDecodingContainer<C>?
|
||||||
do {
|
do {
|
||||||
me = try self.nestedContainer(keyedBy: C.self, forKey: codingKey)
|
meta = try self.nestedContainer(keyedBy: C.self, forKey: codingKey)
|
||||||
} catch {
|
}git catch {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
guard let type = try me?.decodeIfPresent(String.self, forKey: typeCodingKey) else {
|
guard let type = try meta?.decodeIfPresent(String.self, forKey: typeCodingKey) else {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user