From 472b5e4b41c24ac37249a579c6ef5fcad0616b2f Mon Sep 17 00:00:00 2001 From: Davide De Rosa Date: Sun, 1 May 2022 20:07:51 +0200 Subject: [PATCH] Fix active profile flickering on first launch Move .onAppear() handler to main view. --- Passepartout/App/Views/OrganizerView.swift | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/Passepartout/App/Views/OrganizerView.swift b/Passepartout/App/Views/OrganizerView.swift index 133659e4..7b3b4236 100644 --- a/Passepartout/App/Views/OrganizerView.swift +++ b/Passepartout/App/Views/OrganizerView.swift @@ -125,6 +125,8 @@ struct OrganizerView: View { return ZStack { hiddenSceneView mainView + .onAppear(perform: presentActiveProfile) + if !profileManager.hasProfiles { emptyView } @@ -207,8 +209,6 @@ struct OrganizerView: View { profileLabel(forHeader: header) }.contextMenu { profileMenu(forHeader: header) - }.onAppear { - presentIfActiveProfile(header.id) } } @@ -338,13 +338,6 @@ extension OrganizerView { } extension OrganizerView { - private func presentIfActiveProfile(_ id: UUID) { - guard id == profileManager.activeHeader?.id else { - return - } - presentActiveProfile() - } - private func presentActiveProfile() { guard isFirstLaunch else { return