From ec2d510be220425257d6b362bbddd9de56f3ef3a Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Sun, 6 Sep 2020 23:27:43 -0400 Subject: [PATCH] Fix crash when opening Compose screen on iOS 13 --- Tusker/Screens/Compose/MainComposeTextView.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Tusker/Screens/Compose/MainComposeTextView.swift b/Tusker/Screens/Compose/MainComposeTextView.swift index aeddf260..713d7fbf 100644 --- a/Tusker/Screens/Compose/MainComposeTextView.swift +++ b/Tusker/Screens/Compose/MainComposeTextView.swift @@ -145,8 +145,10 @@ struct MainComposeWrappedTextView: UIViewRepresentable { context.coordinator.uiState = uiState if becomeFirstResponder { - uiView.becomeFirstResponder() DispatchQueue.main.async { + // calling becomeFirstResponder during the SwiftUI update causes a crash on iOS 13 + uiView.becomeFirstResponder() + // can't update @State vars during the SwiftUI update becomeFirstResponder = false } }