From db592944ec7a53e44f21f820d83652947fc2db2a Mon Sep 17 00:00:00 2001 From: Davide Date: Sun, 17 Nov 2024 22:30:22 +0100 Subject: [PATCH] Rename module builders as functions --- .../AppUIMain/Views/App/ProviderEntitySelector.swift | 2 +- .../Sources/UILibrary/Business/ProfileEditor.swift | 2 +- .../Sources/UILibrary/Domain/EditableProfile.swift | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Passepartout/Library/Sources/AppUIMain/Views/App/ProviderEntitySelector.swift b/Passepartout/Library/Sources/AppUIMain/Views/App/ProviderEntitySelector.swift index 3bb73c47..ddebb77a 100644 --- a/Passepartout/Library/Sources/AppUIMain/Views/App/ProviderEntitySelector.swift +++ b/Passepartout/Library/Sources/AppUIMain/Views/App/ProviderEntitySelector.swift @@ -62,7 +62,7 @@ private extension ProviderEntitySelector { pp_log(.app, .info, "Select new provider entity: \(entity)") do { - guard var moduleBuilder = module.asProviderModuleBuilder else { + guard var moduleBuilder = module.providerModuleBuilder() else { assertionFailure("Module is not a ProviderModuleBuilder?") return } diff --git a/Passepartout/Library/Sources/UILibrary/Business/ProfileEditor.swift b/Passepartout/Library/Sources/UILibrary/Business/ProfileEditor.swift index 4e0d8a56..b99c7c09 100644 --- a/Passepartout/Library/Sources/UILibrary/Business/ProfileEditor.swift +++ b/Passepartout/Library/Sources/UILibrary/Business/ProfileEditor.swift @@ -189,7 +189,7 @@ extension ProfileEditor { let profile = try builder.tryBuild() // update local view - editableProfile.modules = profile.modulesBuilders + editableProfile.modules = profile.modulesBuilders() removedModules.removeAll() return profile diff --git a/Passepartout/Library/Sources/UILibrary/Domain/EditableProfile.swift b/Passepartout/Library/Sources/UILibrary/Domain/EditableProfile.swift index 3e260153..e065e28d 100644 --- a/Passepartout/Library/Sources/UILibrary/Domain/EditableProfile.swift +++ b/Passepartout/Library/Sources/UILibrary/Domain/EditableProfile.swift @@ -88,22 +88,22 @@ extension Profile { EditableProfile( id: id, name: name, - modules: modulesBuilders, + modules: modulesBuilders(), activeModulesIds: activeModulesIds, modulesMetadata: modulesMetadata, userInfo: userInfo ) } - public var modulesBuilders: [any ModuleBuilder] { + public func modulesBuilders() -> [any ModuleBuilder] { modules.compactMap { - $0.asModuleBuilder + $0.moduleBuilder() } } } extension Module { - public var asModuleBuilder: (any ModuleBuilder)? { + public func moduleBuilder() -> (any ModuleBuilder)? { guard let buildableModule = self as? any BuildableType else { return nil } @@ -111,8 +111,8 @@ extension Module { return builder as? any ModuleBuilder } - public var asProviderModuleBuilder: (any ProviderModuleBuilder)? { - asModuleBuilder as? any ProviderModuleBuilder + public func providerModuleBuilder() -> (any ProviderModuleBuilder)? { + moduleBuilder() as? any ProviderModuleBuilder } }