Member-only story
Factory 2.5 Was Just Released
Here’s what’s new in one of Swift’s most used dependency injection systems.
Factory 2.5 has been released with the FactoryKit migration in place, support for container parallelization under the Swift Testing framework, new support for Observation, ParameterFactory scope caching, and new helpers for previews and mocking.
As well as a brand new logo.
Let’s take a look.
FactoryKit
Factory has had a long running issue with SPM in that Factory is the name of the project, the name of the import module, and the name of the Factory struct used to define dependencies.
import Factory
extension Container {
var myService: Factory<MyServiceType> {
Factory(self) { MyService() }
}
}
As of Factory 2.5, the Factory package includes a library named FactoryKit, which is now the recommended import library for Factory.
import FactoryKit
extension Container {
var myService: Factory<MyServiceType> {
Factory(self) { MyService() }
}
}
Migration is fairly simple. Just update the package, change the import library from Factory to FactoryKit, and do a search and replace in your application, replacing import Factory
with import
…