Skip to content

Add AtomDerivedScope and deprecate AtomScope(inheriting:content:) #175

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 26, 2025

Conversation

ra1028
Copy link
Owner

@ra1028 ra1028 commented Mar 25, 2025

Pull Request Type

  • Bug fix
  • New feature
  • Refactoring
  • Documentation update
  • Chore

Description

AtomScope's APIs for adding observers/overrides while inheriting parent contexts have been deprecated and now it asserts internally.
So this PR aims to add a new view without observe/override functionality so that the interface doesn't confuse users, and the original AtomScope.init(inheriting:content:) has now been deprecated.

@Copilot Copilot AI review requested due to automatic review settings March 25, 2025 11:50
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request introduces the new AtomDerivedScope view to replace the deprecated observe/override functionality from AtomScope. The changes update the documentation with new usage examples and API listings to clarify how to explicitly derive the atom store from a parent view context.

  • Added AtomDerivedScope documentation and example usage in README.md.
  • Updated the API list in the Atoms documentation.
  • Modified workaround instructions to reference AtomDerivedScope instead of AtomScope.

Reviewed Changes

Copilot reviewed 2 out of 5 changed files in this pull request and generated no comments.

File Description
README.md Added a dedicated section for AtomDerivedScope and replaced legacy AtomScope usage examples.
Sources/Atoms/Atoms.docc/Atoms.md Updated the API reference list to include AtomDerivedScope.
Files not reviewed (3)
  • Sources/Atoms/AtomDerivedScope.swift: Language not supported
  • Sources/Atoms/AtomScope.swift: Language not supported
  • Sources/Atoms/PropertyWrapper/ViewContext.swift: Language not supported
Comments suppressed due to low confidence (1)

README.md:1809

  • [nitpick] The documentation references AtomViewContext while the examples use a context provided by @ViewContext. Consider aligning the terminology for clarity.
As a workaround, you can use `AtomDerivedScope` to explicitly inherit the atom store through `AtomViewContext` from the parent view.

@ra1028 ra1028 merged commit e3175b9 into main Mar 26, 2025
8 checks passed
@ra1028 ra1028 deleted the atomderivedscope branch March 26, 2025 07:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant