Skip to content

Commit 0b67111

Browse files
authored
Remove Refreshable & Resettable from readme (#189)
1 parent 002f10d commit 0b67111

File tree

2 files changed

+2
-71
lines changed

2 files changed

+2
-71
lines changed

README.md

Lines changed: 0 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -865,75 +865,6 @@ struct FetchMasterDataAtom: ThrowingTaskAtom, KeepAlive, Hashable {
865865

866866
</details>
867867

868-
#### [Refreshable](https://ra1028.github.io/swiftui-atom-properties/documentation/atoms/refreshable)
869-
870-
`Refreshable` allows you to implement a custom refreshable behavior to an atom.
871-
872-
<details><summary><code>📖 Example</code></summary>
873-
874-
It adds custom refresh behavior to `ValueAtom` which is inherently unable to refresh.
875-
It's useful when need to have arbitrary refresh behavior or implementing refresh when value depends on private atom.
876-
In this example, `FetchMoviesPhaseAtom` transparently exposes the value of `FetchMoviesTaskAtom` as `AsyncPhase` so that the error can be handled easily inside the atom, and `Refreshable` gives refreshing behavior to `FetchMoviesPhaseAtom` itself.
877-
878-
```swift
879-
private struct FetchMoviesTaskAtom: ThrowingTaskAtom, Hashable {
880-
func value(context: Context) async throws -> [Movies] {
881-
try await fetchMovies()
882-
}
883-
}
884-
885-
struct FetchMoviesPhaseAtom: ValueAtom, Refreshable, Hashable {
886-
func value(context: Context) -> AsyncPhase<[Movies], any Error> {
887-
context.watch(FetchMoviesTaskAtom().phase)
888-
}
889-
890-
func refresh(context: CurrentContext) async -> AsyncPhase<[Movies], any Error> {
891-
await context.refresh(FetchMoviesTaskAtom().phase)
892-
}
893-
894-
func effect(context: CurrentContext) -> some AtomEffect {
895-
UpdateEffect {
896-
if case .failure = context.read(self) {
897-
print("Failed to fetch movies.")
898-
}
899-
}
900-
}
901-
}
902-
```
903-
904-
</details>
905-
906-
#### [Resettable](https://ra1028.github.io/swiftui-atom-properties/documentation/atoms/resettable)
907-
908-
`Resettable` allows you to implement a custom reset behavior to an atom.
909-
910-
<details><summary><code>📖 Example</code></summary>
911-
912-
It adds custom reset behavior to an atom that will be executed upon atom reset.
913-
It's useful when need to have arbitrary reset behavior or implementing reset when value depends on private atom.
914-
In following example, `RandomIntAtom` generates a random value using generated from private `RandomNumberGeneratorAtom`, and `Resettable` gives ability to replace exposed reset with `RandomNumberGeneratorAtom` reset.
915-
916-
```swift
917-
struct RandomIntAtom: ValueAtom, Resettable, Hashable {
918-
func value(context: Context) -> Int {
919-
var generator = context.watch(RandomNumberGeneratorAtom())
920-
return .random(in: 0..<100, using: &generator)
921-
}
922-
923-
func reset(context: CurrentContext) {
924-
context.reset(RandomNumberGeneratorAtom())
925-
}
926-
}
927-
928-
private struct RandomNumberGeneratorAtom: ValueAtom, Hashable {
929-
func value(context: Context) -> CustomRandomNumberGenerator {
930-
CustomRandomNumberGenerator()
931-
}
932-
}
933-
```
934-
935-
</details>
936-
937868
---
938869

939870
### Property Wrapper

Sources/Atoms/Atoms.docc/Atoms.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ Building state by compositing atoms automatically optimizes rendering based on i
4747

4848
- ``Scoped``
4949
- ``KeepAlive``
50-
- ``Refreshable``
51-
- ``Resettable``
5250

5351
### Property Wrappers
5452

@@ -95,5 +93,7 @@ Building state by compositing atoms automatically optimizes rendering based on i
9593

9694
### Deprecated
9795

96+
- ``Refreshable``
97+
- ``Resettable``
9898
- ``EmptyEffect``
9999
- ``MergedEffect``

0 commit comments

Comments
 (0)