From a2d9196bca5ea03e530b3f8ecb91e27fdb78c51f Mon Sep 17 00:00:00 2001 From: Scott Pfeil Date: Mon, 10 Jan 2022 11:36:54 -0500 Subject: [PATCH] Allows replace --- MVMCore/MVMCore/Models/Model/ModelRegistry.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/MVMCore/MVMCore/Models/Model/ModelRegistry.swift b/MVMCore/MVMCore/Models/Model/ModelRegistry.swift index f8b2510..6e6e77a 100644 --- a/MVMCore/MVMCore/Models/Model/ModelRegistry.swift +++ b/MVMCore/MVMCore/Models/Model/ModelRegistry.swift @@ -40,9 +40,9 @@ public struct ModelRegistry { /// - Parameters: /// - handler: The handling class taking an object of ModelHandlerProtocol.self which is used to register /// - model: The data object of ModelProtocol.self which is used to register - public static func register(handler: H.Type, for model: M.Type) { + public static func register(handler: H.Type, for model: M.Type, allowsReplace: Bool = false) { do { - try throwable_register(handler: handler, model: model) + try throwable_register(handler: handler, model: model, allowsReplace: allowsReplace) } catch { handleError(error) } @@ -126,7 +126,7 @@ public struct ModelRegistry { /// - Throws: An Error object of `ModelRegistry.Error` public static func throwable_register(handler: H.Type, model: M.Type, allowsReplace: Bool = false) throws { // Register the type - try self.throwable_register(type: model) + try self.throwable_register(type: model, allowsReplace: allowsReplace) // Get the key for the handler let key = model.identifier