Allows replace
This commit is contained in:
parent
6fe6d6ea8b
commit
a2d9196bca
@ -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<H: ModelHandlerProtocol, M: ModelProtocol>(handler: H.Type, for model: M.Type) {
|
||||
public static func register<H: ModelHandlerProtocol, M: ModelProtocol>(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<H: ModelHandlerProtocol, M: ModelProtocol>(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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user