-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
1 parent
a2a1654
commit 581b34f
Showing
2 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
Sources/ComposableEnvironment/Deprecations/GlobalEnvironment+Migration.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() {} | ||
} |
15 changes: 15 additions & 0 deletions
15
Sources/GlobalEnvironment/Deprecations/ComposableEnvironment+Migration.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() {} | ||
} |