An iOS and macOS app that demonstrates how different SwiftUI constructs and SwiftUI container views affect:
- the lifetime of
- the firing of events such as
My article introducing the app: Understanding View Lifecycles (2022-12-15)
- Open the project in Xcode.
- Run the app on the iOS simulator, an iOS device, or on macOS.
- Click through the list of examples and observe the timestamps when certain lifecycle events happened.
Requires iOS 16 or macOS 13.
All examples use one or more
LifecycleMonitor views as their content. The view below tracks its lifecycle events and displays them as constantly-updating timestamps. For example, this view got created 1:26 minutes ago, which is also when its
@State got created. Its
.onDisappear actions were last called 15 and 47 seconds ago, respectively:
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.
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.
Mobile App Development Best Practices – 02.10
Data.ai has summarized the interim results of the year – and once again we have a record. Annual consumer spending...
How to Use Kotlin’s Timing API
Kotlin’s Timing API is stable as of Kotlin 1.9, and it offers some great ways to both measure and specify...
Candy Crush made $20 billion
King attributes its huge success to several factors, including not only the games themselves, but also the company's commitment to...
FittedSheets – Bottom sheets for iOS.
This project is to enable easily presenting view controllers in a bottom sheet that supports scrollviews and multiple sizes. Contributions...
ComposeFadingEdges – Android Compose UI with fading edges
The ComposeFadingEdges is a powerful Android Compose library that seamlessly incorporates customisable fading edges with horizontal or vertical orientations, static or scrollable...
Mobile Consumer Spend Surpasses $100 Billion in Record Time in 2023
Positive growth in mobile consumer spend continued in Q3 2023 at a solid 3.7% year-over-year. Downloads declined slightly over the...