Skip to content

Commit 5e6c05c

Browse files
committed
Update readme, add screenshots
1 parent 1638642 commit 5e6c05c

File tree

5 files changed

+9
-1
lines changed

5 files changed

+9
-1
lines changed

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,22 @@ By [Ole Begemann](https://oleb.net), 2022
1919

2020
Requires iOS 16 or macOS 13.
2121

22+
## Screenshots
23+
24+
<img src="assets/ios-root-screen.png" width="197" height="426"/> <img src="assets/ios-list-dynamic.png" width="197" height="426"/> <img src="assets/ios-tabview.png" width="197" height="426"/>
25+
26+
<img src="assets/mac-scrollview-dynamic.png" width="465" height="301"/>
27+
2228
## The `LifecycleMonitor` view
2329

24-
All examples use one or more `LifecycleMonitor` views as their content. This view tracks its lifecycle events and displays them as constantly-updating timestamps. For example, this view got created 2:17 minutes ago, which is also when its `@State` got created. Its `.onAppear` and `.onDisappear` actions were last called 13 and 18 seconds ago, respectively:
30+
All examples use one or more [`LifecycleMonitor`](https://github.com/ole/swiftui-view-lifecycle/blob/main/ViewLifecycle/LifecycleMonitor.swift) views as their content. This view tracks its lifecycle events and displays them as constantly-updating timestamps. For example, this view got created 2:17 minutes ago, which is also when its `@State` got created. Its `.onAppear` and `.onDisappear` actions were last called 13 and 18 seconds ago, respectively:
2531

2632
<img src="assets/LifecycleMonitor-example.png" width="308" height="133"/>
2733

2834
As you interact with the app, e.g. by scrolling through a `List`, you’ll see these timestamps update (or not, depending on the container view). Pay special attention to resets of the `@State` field because this means that the view got destroyed and recreated, losing all of its internal state.
2935

36+
The view’s background color is set to a random color when its `@State` is created, so color changes are another indication that the view identity has changed.
37+
3038
## License
3139

3240
[MIT license](LICENSE.md)

assets/ios-list-dynamic.png

603 KB
Loading

assets/ios-root-screen.png

240 KB
Loading

assets/ios-tabview.png

181 KB
Loading

assets/mac-scrollview-dynamic.png

382 KB
Loading

0 commit comments

Comments
 (0)