Skip to content

Commit 1e7c7c3

Browse files
committed
Refactoring
1 parent 0763ad5 commit 1e7c7c3

File tree

6 files changed

+11
-11
lines changed

6 files changed

+11
-11
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,7 @@ The attributes allow control over how the atoms essentially work, for example, c
741741

742742
#### [Scoped](https://ra1028.github.io/swiftui-atom-properties/documentation/atoms/scoped)
743743

744-
`Scoped` preserves the atom state in the nearest scope in the ancestor of where it is used and prevent it from being shared outside of the scope.
744+
`Scoped` preserves the atom state in the scope nearest to the ancestor of where it is used and prevents it from being shared out of scope.
745745

746746
<details><summary><code>📖 Example</code></summary>
747747

@@ -1250,7 +1250,7 @@ struct NewsView: View {
12501250
#### Scoped Atoms
12511251

12521252
This library is designed with the shared state as a single source of truth first principle, but also the state can be scoped depending on the intended use.
1253-
Scoped atoms preserve their state in the nearest [AtomScope](#atomscope) in the ancestor of the view in which the atom is used, and they are not shared outside the scope. `Scoped` is the attribute for that feature.
1253+
Scoped atoms preserves the atom state in the [AtomScope](#atomscope) nearest to the ancestor of where it is used and prevents it from being shared out of scope. `Scoped` is the attribute for that feature.
12541254

12551255
```swift
12561256
struct TextInputAtom: StateAtom, Scoped Hashable {
@@ -1302,12 +1302,12 @@ AtomScope(id: TextScopeID()) {
13021302
}
13031303
```
13041304

1305-
This is also useful when multiple identical screens are stacked and each has isolated states such as user inputs.
1306-
Note that other atoms that depend on the scoped atom will be in a shared state and must be given `Scoped` attribute as well in order to scope them as well.
1305+
This is also useful when multiple identical screens are stacked and each screen needs isolated states such as user inputs.
1306+
Note that other atoms that depend on scoped atoms will be in a shared state and must be given `Scoped` attribute as well in order to scope them as well.
13071307

13081308
#### Override Atoms
13091309

1310-
Overriding an atom in [AtomRoot](#atomroot) or [AtomScope](#atomscope) overwrites its value when used in the descendant views, which is useful for dependency injection or swapping state in a particular view.
1310+
Overriding an atom in [AtomRoot](#atomroot) or [AtomScope](#atomscope) overwrites its state when used in the descendant views, which is useful for dependency injection or swapping state in a particular view.
13111311

13121312
```swift
13131313
AtomScope {

Sources/Atoms/Attribute/Scoped.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
/// An attribute protocol to preserve the atom state in the nearest scope in the ancestor of
2-
/// where it is used and prevent it from being shared outside of the scope.
1+
/// An attribute protocol to preserve the atom state in the scope nearest to the ancestor
2+
/// of where it is used and prevents it from being shared out of scope.
33
///
44
/// If multiple scopes are nested, you can define an arbitrary `scopeID` to ensure that
55
/// values are stored in a particular scope.

Sources/Atoms/Context/AtomCurrentContext.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public struct AtomCurrentContext<Coordinator>: AtomContext {
4040
/// and assigns a new value for the atom.
4141
/// When you assign a new value, it immediately notifies downstream atoms and views.
4242
///
43-
/// - SeeAlso: ``AtomViewContext/subscript(_:)``
43+
/// - SeeAlso: ``AtomContext/subscript(_:)``
4444
///
4545
/// ```swift
4646
/// let context = ...

Sources/Atoms/Context/AtomTestContext.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ public struct AtomTestContext: AtomWatchableContext {
173173
/// and assigns a new value for the atom.
174174
/// When you assign a new value, it immediately notifies downstream atoms and views.
175175
///
176-
/// - SeeAlso: ``AtomTestContext/subscript(_:)``
176+
/// - SeeAlso: ``AtomContext/subscript(_:)``
177177
///
178178
/// ```swift
179179
/// let context = AtomTestContext()

Sources/Atoms/Context/AtomTransactionContext.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public struct AtomTransactionContext<Coordinator>: AtomWatchableContext {
4747
/// and assigns a new value for the atom.
4848
/// When you assign a new value, it immediately notifies downstream atoms and views.
4949
///
50-
/// - SeeAlso: ``AtomTransactionContext/subscript(_:)``
50+
/// - SeeAlso: ``AtomContext/subscript(_:)``
5151
///
5252
/// ```swift
5353
/// let context = ...

Sources/Atoms/Context/AtomViewContext.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public struct AtomViewContext: AtomWatchableContext {
4646
/// and assigns a new value for the atom.
4747
/// When you assign a new value, it immediately notifies downstream atoms and views.
4848
///
49-
/// - SeeAlso: ``AtomViewContext/subscript(_:)``
49+
/// - SeeAlso: ``AtomContext/subscript(_:)``
5050
///
5151
/// ```swift
5252
/// let context = ...

0 commit comments

Comments
 (0)