why remove Aliases file?
Why was the Aliases file removed from FactoryKit?
Problem
The Aliases.swift file was removed from FactoryKit, causing naming conflicts and breaking backward compatibility, especially for CocoaPods users.
Current Situation
The aliases that were previously available:
public typealias FactoryAutoRegistering = AutoRegistering
public typealias FactoryContainer = Container
public typealias FactoryContainerManager = ContainerManager
public typealias FactoryManagedContainer = ManagedContainer
public typealias FactoryResolving = Resolving
public typealias FactoryScope = Scope
public typealias FactorySharedContainer = SharedContainer
This file exists in Sources/Factory/Factory/Aliases.swift but NOT in Sources/FactoryKit/FactoryKit/Aliases.swift.
Impact
1. CocoaPods Users
According to Factory.podspec:
- Pod name:
Factory→ module name isFactory(users import asimport Factory) - Source files:
Sources/FactoryKit/**/*.swift→ noAliases.swiftincluded
Result: CocoaPods users who import Factory cannot use FactoryContainer, FactoryScope, etc., even though these aliases were specifically added in version 2.3.1 (Issue #154) to avoid naming conflicts.
2. Naming Conflicts with Other Libraries
When using FactoryKit together with libraries like XCoordinator, both define a Container type:
- FactoryKit:
public final class Container - XCoordinator:
protocol Container
Without aliases, this causes compiler errors or ambiguous type references.
Example conflict:
import Factory
import XCoordinator // Also has a Container protocol
// This fails without FactoryContainer alias
extension Container { // ❌ Ambiguous: which Container?
var myService: Factory<MyServiceType> {
self { MyService() }
}
}
Expected Behavior
Users should be able to use aliases to avoid naming conflicts:
import Factory // CocoaPods, or import FactoryKit via SPM
extension FactoryContainer { // ✅ Clear, no ambiguity
var myService: Factory<MyServiceType> {
self { MyService() }
}
}
Workaround
Currently, users have to:
- Use module qualifiers:
FactoryKit.Container(but this doesn't work for CocoaPods users usingimport Factory) - Create their own aliases file in their project (workaround, not a solution)
Proposed Solution
Please restore the Aliases.swift file in Sources/FactoryKit/FactoryKit/ to:
- ✅ Support CocoaPods users who import as
Factory - ✅ Provide a clean way to avoid naming conflicts with other libraries (like XCoordinator)
- ✅ Maintain backward compatibility with code that relies on these aliases
The aliases were specifically added to address naming conflicts (Issue #154), and their removal breaks this functionality, especially for CocoaPods users.
Environment
- Factory version: 2.5.3
- Installation method: CocoaPods
- Use case: Integration with XCoordinator (which also has a
Containerprotocol)