diff --git a/MVMCore/MVMCore/Models/Model/ModelRegistry.swift b/MVMCore/MVMCore/Models/Model/ModelRegistry.swift index da7df9b..7bf560f 100644 --- a/MVMCore/MVMCore/Models/Model/ModelRegistry.swift +++ b/MVMCore/MVMCore/Models/Model/ModelRegistry.swift @@ -34,7 +34,7 @@ public struct ModelRegistry { public static func register(_ type: M.Type) throws { var category: Category - + if let c = categories[M.categoryName] { category = c } else { @@ -58,8 +58,6 @@ public struct ModelRegistry { return getCategory(for: type)?.instanceTypes[name] } - - private static func getCategory(for typeString: String) -> Category? { for (_, value) in categories where value.codingKey == typeString { @@ -73,8 +71,6 @@ public struct ModelRegistry { return getCategory(for: typeString)?.instanceTypes[name] } - - public static func getCodingKey(for type: T.Type) throws -> AnyCodingKey{ guard let category = getCategory(for: type) else { 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 - mutating func encodeModels2D(_ list: [[Model]]?, forKey key:KeyedEncodingContainer.Key) throws { + mutating func encodeModels2D(_ list: [[Model]]?, forKey key:KeyedEncodingContainer.Key) throws { guard let list = list else { return } var unkeyedContainer = nestedUnkeyedContainer(forKey: key)