From cc0366057630d38f3da7596cc168b850d794d595 Mon Sep 17 00:00:00 2001 From: Edgar Story Date: Tue, 12 Nov 2024 09:14:51 +0000 Subject: [PATCH] Push the setting of `authError` to happen on MainActor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - The Xcode “Run Time Issue” breakpoint was being hit whenever an error was being set, complaining about this being set outside of the main thread. --- Xcodes/Backend/AppState.swift | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Xcodes/Backend/AppState.swift b/Xcodes/Backend/AppState.swift index 6ea6bc5..d855d24 100644 --- a/Xcodes/Backend/AppState.swift +++ b/Xcodes/Backend/AppState.swift @@ -405,7 +405,9 @@ class AppState: ObservableObject { // we don't have to show an error // because the sheet will already be dismissed } catch { - authError = error + Task { @MainActor in + authError = error + } } } } @@ -418,7 +420,10 @@ class AppState: ObservableObject { do { return try fido2.deviceHasPin() } catch { - authError = error + Task { @MainActor in + authError = error + } + return true } }