You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The context also provides a flexible solution for passing dynamic parameters to atom's initializer. See [Contexts](#contexts) section for more detail.
906
+
The context also provides a flexible solution for passing dynamic parameters to atom's initializer. See [Context](#context) section for more detail.
907
907
908
908
---
909
909
910
-
### Contexts
910
+
### Context
911
911
912
-
Contexts are context structure for using and interacting with the data of other atoms from a view or an another atom. The basic API common to all contexts is as follows:
912
+
Context is a structure for using and interacting with atom values from views or other atoms.
913
913
914
914
|API|Use|
915
915
|:--|:--|
@@ -921,7 +921,7 @@ Contexts are context structure for using and interacting with the data of other
921
921
|[refresh(_:)](https://ra1028.github.io/swiftui-atom-properties/documentation/atoms/atomcontext/refresh(_:))|Reset an atom and await until asynchronous operation is complete.|
922
922
|[reset(_:)](https://ra1028.github.io/swiftui-atom-properties/documentation/atoms/atomcontext/reset(_:))|Reset an atom to the default value or a first output.|
923
923
924
-
There are the following types context as different contextual environments, and they have some specific APIs for each.
924
+
There are the following types context as different contextual environments.
Context passed as a parameter to the primary function of each atom type.
1026
+
A context passed as a parameter to the primary function of each atom type.
1027
+
This context type has a `coordinator` property that preserves an instance from the time an atom is used and initialized until it is unused and cleaned up, so it can be used to cache values or as a lifecycle for an atom.
1028
1028
1029
1029
|API|Use|
1030
1030
|:--|:--|
1031
-
|[addTermination(_:)](https://ra1028.github.io/swiftui-atom-properties/documentation/atoms/atomtransactioncontext/addtermination(_:))|Calls the passed closure when the atom is updated or is no longer used.|
1032
-
|[keepUntilTermination(_:)](https://ra1028.github.io/swiftui-atom-properties/documentation/atoms/atomtransactioncontext/keepuntiltermination(_:))|Retains the given object instance until the atom is updated or is no longer used.|
1031
+
|[coordinator](https://ra1028.github.io/swiftui-atom-properties/documentation/atoms/atomtransactioncontext/coordinator)|The atom’s associated coordinator that preservess a state until the atom will no longer be used.|
@@ -1074,7 +1073,7 @@ class FetchMusicsTests: XCTestCase {
1074
1073
1075
1074
</details>
1076
1075
1077
-
Context that can simulate any scenarios in which atoms are used from a view or another atom and provides a comprehensive means of testing.
1076
+
A context that can simulate any scenarios in which atoms are used from a view or another atom and provides a comprehensive means of testing.
1078
1077
1079
1078
|API|Use|
1080
1079
|:--|:--|
@@ -1133,7 +1132,7 @@ In order to fully test your app, this library guarantees the following principle
1133
1132
- Dependencies are replaceable with any of mock/stub/fake/spy per test case.
1134
1133
- Test cases can reproduce any possible scenarios at the view-layer.
1135
1134
1136
-
In the test case, you first create an `AtomTestContext` instance that behaves similarly to other context types. The context allows for flexible reproduction of expected scenarios for testing using the control functions described in the [Contexts](#contexts) section.
1135
+
In the test case, you first create an `AtomTestContext` instance that behaves similarly to other context types. The context allows for flexible reproduction of expected scenarios for testing using the control functions described in the [Context](#context) section.
1137
1136
In addition, it's able to replace the atom value with test-friendly dependencies with `override` function. It helps you to write a reproducible & stable testing.
1138
1137
Since atom needs to be used from the main actor to guarantee thread-safety, `XCTestCase` class that to test atoms should have `@MainActor` attribute.
0 commit comments