[UPDATE] I’ve identified one of the triggers for the crash. The crash occurs immediately after calling becomeFirstResponder() on a UITextField (or similar view) that is fully added to the view hierarchy and visible on screen. This call is made from the main thread. In case of SwiftUI, the crash happens if using @FocusState: @FocusState private var textFieldFocused: Bool TextField(..., text: $text) .focused($textFieldFocused) .onAppear { textFieldFocused = viewModel.shouldFocusWhenAppear } The console log include: Unsupported layout off the main thread for with no associated or ancestor view controller Followed by a crash: NSInternalInconsistencyException: Modifications to the layout engine must not be performed from a background thread after it has been accessed from the main thread.
Topic:
UI Frameworks
SubTopic:
UIKit
Tags: