Skip to content

Commit

Permalink
Add migration helpers (#9)
Browse files Browse the repository at this point in the history
This PR aims to provide contextual information when migrating from `Composable` to `Global` environments (in both ways).
It also helps to get the project back into a buildable and potentially runnable state sooner.
  • Loading branch information
tgrapperon authored Dec 27, 2021
1 parent a2a1654 commit 581b34f
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
@available(*, deprecated, message: """
If you are transitioning from `GlobalEnvironment`, you should make sure that is type is a \
subclass of `ComposableEnvironment`.
If your environment is a `struct`, replacing this by `class` should allow the project to build \
and run again as a temporary workaround.
If you are not transitioning from `GlobalEnvironment`, you should not have to use this type \
at all. It is only provided to help transitioning projects from `GlobalEnvironment` to \
`ComposableEnvironment`.
""")
open class GlobalEnvironment: ComposableEnvironment {
public required init() {}
}

@available(*, deprecated, message: """
If you are transitioning from `GlobalEnvironment`, you should make sure that is type is a \
subclass of `ComposableEnvironment`.
If your environment is a `struct`, replacing this by `class` should allow the project to build \
and run again as a temporary workaround.
If you are not transitioning from `GlobalEnvironment`, you should not have to use this type \
at all. It is only provided to help transitioning projects from `GlobalEnvironment` to \
`ComposableEnvironment`.
""")
open class GlobalDependenciesAccessing: ComposableEnvironment {
public required init() {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
@available(*, deprecated, message: """
If you are transitioning from `ComposableEnvironment`, you should replace this class by a type \
conforming to `GlobalEnvironment` or `GlobalDependenciesAccessing`. Please make sure that you \
are not overriding dependencies mid-chain, as all dependencies are shared globally when using \
`GlobalEnvironment`. If your project depends on mid-chain dependencies overrides, using \
`GlobalEnvironment` will likely produce incoherent results. In this case, you should continue \
using `ComposableEnvironment`.
If you are not transitioning from `ComposableEnvironment`, you should not have to use this type \
at all. It is only provided to help transitioning projects from `ComposableEnvironment` to \
`GlobalEnvironment`.
""")
open class ComposableEnvironment: GlobalEnvironment {
public required init() {}
}

0 comments on commit 581b34f

Please sign in to comment.