Skip to content

Provide aliases to improve cohabitation with protocol reducers

Latest
Compare
Choose a tag to compare
@tgrapperon tgrapperon released this 22 Aug 17:09
· 2 commits to main since this release
757dd90

When importing versions of TCA defining ReducerProtocol, there will likely be ambiguities when using the @dependency property wrapper, or the DependencyKey protocol. As this library will give way to TCA, the preferred approach is the following:

Define a typealias to both TCA's types in a module you own (or in your application if you're not using modules):

import ComposableArchitecture
public typealias DependencyKey = ComposableArchitecture.DependencyKey
public typealias Dependency = ComposableArchitecture.Dependency

Because these typeliases are defined in modules you own, they will be preferred to external definitions when resolving types.

Replace all occurrences of DependencyKey by Compatible.DependencyKey and @Dependency by @Compatible.Dependency. You can use Xcode search/replace in all files for this purpose.
In this state, your project should build without ambiguities and you can start transitioning to reducer protocols at your rhythm.