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 is Factory (users import as import Factory)
- Source files:
Sources/FactoryKit/**/*.swift → no Aliases.swift included
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 using import 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
Container protocol)
Why was the Aliases file removed from FactoryKit?
Problem
The
Aliases.swiftfile was removed fromFactoryKit, causing naming conflicts and breaking backward compatibility, especially for CocoaPods users.Current Situation
The aliases that were previously available:
This file exists in
Sources/Factory/Factory/Aliases.swiftbut NOT inSources/FactoryKit/FactoryKit/Aliases.swift.Impact
1. CocoaPods Users
According to
Factory.podspec:Factory→ module name isFactory(users import asimport Factory)Sources/FactoryKit/**/*.swift→ noAliases.swiftincludedResult: CocoaPods users who import
Factorycannot useFactoryContainer,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
Containertype:public final class Containerprotocol ContainerWithout aliases, this causes compiler errors or ambiguous type references.
Example conflict:
Expected Behavior
Users should be able to use aliases to avoid naming conflicts:
Workaround
Currently, users have to:
FactoryKit.Container(but this doesn't work for CocoaPods users usingimport Factory)Proposed Solution
Please restore the
Aliases.swiftfile inSources/FactoryKit/FactoryKit/to:FactoryThe aliases were specifically added to address naming conflicts (Issue #154), and their removal breaks this functionality, especially for CocoaPods users.
Environment
Containerprotocol)