SwiftUI iOS app crashes when state change causes keyboard to resign as first responder while in a sheet
问题 I'm trying to create a view in a sheet with multiple "pages". The view holds a @State variable of an enum and I "switch" between pages with if self.page == .text {...} else if self.page == .image {...} else {...} However, when self.page is set while a textfield is active in one of the pages, the app crashes with no clear error message. This seems to work on the simulator but not on a device. Here's the dump: Thread 1 Queue : com.apple.main-thread (serial) #0 0x00000001f6dc702c in