Big rewrite to make it distinct from SwiftUI Environment Values #22
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces significant changes to the
SwiftEnvironment
library, focusing on refactoring its global environment management system. The changes include replacingEnvironmentValues
with a newGlobalValues
structure, updating documentation to reflect the new design, and removing deprecated files. These updates aim to simplify the codebase, enhance flexibility, and improve clarity in managing global environment values.Refactoring Global Environment Management:
GlobalValues
: Added a newGlobalValues
structure to replace theSwiftEnvironmentValues
class. This structure introduces methods for managing singleton, transient, and weak global values, along with support for dynamic member lookup and publishers for observing changes. (Sources/SwiftEnvironment/Environment/GlobalValues.swift
)GlobalEnvironment
Property Wrapper: Updated theGlobalEnvironment
property wrapper to useGlobalValues
instead ofEnvironmentValues
. This change simplifies value resolution and observation logic. (Sources/SwiftEnvironment/Environment/GlobalEnvironment.swift
) [1] [2]Documentation Updates:
README.md
: Revised the documentation to reflect the newGlobalValues
structure and its usage. Added sections on defining, accessing, and setting global values, along with advanced options like transient values and weak references. (README.md
) [1] [2]Code Cleanup and Removal:
SwiftEnvironmentValues
implementation (SwiftEnvironmentValues.swift
,EnvironmentSource.swift
,SwiftUIEnvironment+Extensions.swift
) to streamline the codebase. (Sources/SwiftEnvironment/GlobalEnvironment/SwiftEnvironmentValues.swift
) [1] (Sources/SwiftEnvironment/GlobalEnvironment/EnvironmentSource.swift
) [2] (Sources/SwiftEnvironment/Extensions/SwiftUIEnvironment+Extensions.swift
) [3]Dependency Updates:
swift-syntax
Dependency: UpdatedPackage.swift
to include theswift-syntax
package for macro support, enabling the new@GlobalEntry
macro functionality. (Package.swift
) [1] [2]