Skip to content

Commit 59fc426

Browse files
authored
meta: Add comment explaining why the crash was moved to onAppear (#5899)
* meta: Add comment explaining why the crash was moved to onAppear * Improve message
1 parent c5bedc0 commit 59fc426

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

TestSamples/SwiftUICrashTest/SwiftUICrashTest/SwiftUICrashTestApp.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ struct SwiftUICrashTestApp: App {
1717
WindowGroup {
1818
ContentView()
1919
.onAppear {
20+
// Moved the crash from init to onAppear to ensure the app is fully loaded before crashing.
21+
// This prevents test flakiness on CI that occurred when the crash happened during the app launch.
2022
let userDefaultsKey = "crash-on-launch"
2123
if UserDefaults.standard.bool(forKey: userDefaultsKey) {
2224
NSLog("SwiftUICrashTestApp - will crash")

0 commit comments

Comments
 (0)