Rename module builders as functions
This commit is contained in:
parent
8e7f3e80ce
commit
db592944ec
|
@ -62,7 +62,7 @@ private extension ProviderEntitySelector {
|
||||||
pp_log(.app, .info, "Select new provider entity: \(entity)")
|
pp_log(.app, .info, "Select new provider entity: \(entity)")
|
||||||
|
|
||||||
do {
|
do {
|
||||||
guard var moduleBuilder = module.asProviderModuleBuilder else {
|
guard var moduleBuilder = module.providerModuleBuilder() else {
|
||||||
assertionFailure("Module is not a ProviderModuleBuilder?")
|
assertionFailure("Module is not a ProviderModuleBuilder?")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -189,7 +189,7 @@ extension ProfileEditor {
|
||||||
let profile = try builder.tryBuild()
|
let profile = try builder.tryBuild()
|
||||||
|
|
||||||
// update local view
|
// update local view
|
||||||
editableProfile.modules = profile.modulesBuilders
|
editableProfile.modules = profile.modulesBuilders()
|
||||||
removedModules.removeAll()
|
removedModules.removeAll()
|
||||||
|
|
||||||
return profile
|
return profile
|
||||||
|
|
|
@ -88,22 +88,22 @@ extension Profile {
|
||||||
EditableProfile(
|
EditableProfile(
|
||||||
id: id,
|
id: id,
|
||||||
name: name,
|
name: name,
|
||||||
modules: modulesBuilders,
|
modules: modulesBuilders(),
|
||||||
activeModulesIds: activeModulesIds,
|
activeModulesIds: activeModulesIds,
|
||||||
modulesMetadata: modulesMetadata,
|
modulesMetadata: modulesMetadata,
|
||||||
userInfo: userInfo
|
userInfo: userInfo
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
public var modulesBuilders: [any ModuleBuilder] {
|
public func modulesBuilders() -> [any ModuleBuilder] {
|
||||||
modules.compactMap {
|
modules.compactMap {
|
||||||
$0.asModuleBuilder
|
$0.moduleBuilder()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension Module {
|
extension Module {
|
||||||
public var asModuleBuilder: (any ModuleBuilder)? {
|
public func moduleBuilder() -> (any ModuleBuilder)? {
|
||||||
guard let buildableModule = self as? any BuildableType else {
|
guard let buildableModule = self as? any BuildableType else {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -111,8 +111,8 @@ extension Module {
|
||||||
return builder as? any ModuleBuilder
|
return builder as? any ModuleBuilder
|
||||||
}
|
}
|
||||||
|
|
||||||
public var asProviderModuleBuilder: (any ProviderModuleBuilder)? {
|
public func providerModuleBuilder() -> (any ProviderModuleBuilder)? {
|
||||||
asModuleBuilder as? any ProviderModuleBuilder
|
moduleBuilder() as? any ProviderModuleBuilder
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue