indentation

This commit is contained in:
Kevin G Christiano 2020-02-12 16:13:26 -05:00
parent ea6089e772
commit a7c25f0bdf

View File

@ -58,8 +58,6 @@ public struct ModelRegistry {
return getCategory(for: type)?.instanceTypes[name] return getCategory(for: type)?.instanceTypes[name]
} }
private static func getCategory(for typeString: String) -> Category? { private static func getCategory(for typeString: String) -> Category? {
for (_, value) in categories where value.codingKey == typeString { for (_, value) in categories where value.codingKey == typeString {
@ -73,8 +71,6 @@ public struct ModelRegistry {
return getCategory(for: typeString)?.instanceTypes[name] return getCategory(for: typeString)?.instanceTypes[name]
} }
public static func getCodingKey<T>(for type: T.Type) throws -> AnyCodingKey{ public static func getCodingKey<T>(for type: T.Type) throws -> AnyCodingKey{
guard let category = getCategory(for: type) else { guard let category = getCategory(for: type) else {
throw ModelRegistry.Error.decoderOther(message: "decodeModelsIfPresent only works for objects implementing the Model protocol") throw ModelRegistry.Error.decoderOther(message: "decodeModelsIfPresent only works for objects implementing the Model protocol")
@ -200,7 +196,7 @@ public extension KeyedEncodingContainer where Key: CodingKey {
} }
/// Convenience function for encoding the container into a list of lists of Models. needs instance type as input paramaeter list /// Convenience function for encoding the container into a list of lists of Models. needs instance type as input paramaeter list
mutating func encodeModels2D(_ list: [[Model]]?, forKey key:KeyedEncodingContainer<K>.Key) throws { mutating func encodeModels2D(_ list: [[Model]]?, forKey key:KeyedEncodingContainer<K>.Key) throws {
guard let list = list else { return } guard let list = list else { return }
var unkeyedContainer = nestedUnkeyedContainer(forKey: key) var unkeyedContainer = nestedUnkeyedContainer(forKey: key)