From 72943e0dba164610b2d73031caba9d35182dfd21 Mon Sep 17 00:00:00 2001 From: Anass Bouassaba Date: Wed, 27 Nov 2024 09:29:38 +0100 Subject: [PATCH] refactor: better placement for .navigationDestination() (#35) --- Sources/Screens/Group/GroupList.swift | 10 +++++----- Sources/Screens/Organization/OrganizationList.swift | 10 +++++----- Sources/Screens/Workspace/WorkspaceList.swift | 10 +++++----- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/Sources/Screens/Group/GroupList.swift b/Sources/Screens/Group/GroupList.swift index b7aa846..b5b799c 100644 --- a/Sources/Screens/Group/GroupList.swift +++ b/Sources/Screens/Group/GroupList.swift @@ -54,11 +54,6 @@ struct GroupList: View, ViewDataProvider, LoadStateProvider, TimerLifecycle, Tok .onChange(of: searchText) { groupStore.searchPublisher.send($1) } - .navigationDestination(isPresented: $overviewIsPresented) { - if let newGroup { - GroupOverview(newGroup, groupStore: groupStore) - } - } } } } @@ -83,6 +78,11 @@ struct GroupList: View, ViewDataProvider, LoadStateProvider, TimerLifecycle, Tok overviewIsPresented = true } } + .navigationDestination(isPresented: $overviewIsPresented) { + if let newGroup { + GroupOverview(newGroup, groupStore: groupStore) + } + } } .onAppear { if let token = tokenStore.token { diff --git a/Sources/Screens/Organization/OrganizationList.swift b/Sources/Screens/Organization/OrganizationList.swift index 36d866e..eaac0e0 100644 --- a/Sources/Screens/Organization/OrganizationList.swift +++ b/Sources/Screens/Organization/OrganizationList.swift @@ -47,11 +47,6 @@ struct OrganizationList: View, ViewDataProvider, LoadStateProvider, TimerLifecyc } } } - .navigationDestination(isPresented: $overviewIsPresented) { - if let newOrganization { - OrganizationOverview(newOrganization, organizationStore: organizationStore) - } - } } } .refreshable { @@ -85,6 +80,11 @@ struct OrganizationList: View, ViewDataProvider, LoadStateProvider, TimerLifecyc overviewIsPresented = true } } + .navigationDestination(isPresented: $overviewIsPresented) { + if let newOrganization { + OrganizationOverview(newOrganization, organizationStore: organizationStore) + } + } } .onAppear { if let token = tokenStore.token { diff --git a/Sources/Screens/Workspace/WorkspaceList.swift b/Sources/Screens/Workspace/WorkspaceList.swift index 5c0318f..6d9ffe8 100644 --- a/Sources/Screens/Workspace/WorkspaceList.swift +++ b/Sources/Screens/Workspace/WorkspaceList.swift @@ -58,11 +58,6 @@ struct WorkspaceList: View, ViewDataProvider, LoadStateProvider, TimerLifecycle, .onChange(of: searchText) { workspaceStore.searchPublisher.send($1) } - .navigationDestination(isPresented: $overviewIsPresented) { - if let newWorkspace { - WorkspaceOverview(newWorkspace, workspaceStore: workspaceStore) - } - } } } } @@ -95,6 +90,11 @@ struct WorkspaceList: View, ViewDataProvider, LoadStateProvider, TimerLifecycle, overviewIsPresented = true } } + .navigationDestination(isPresented: $overviewIsPresented) { + if let newWorkspace { + WorkspaceOverview(newWorkspace, workspaceStore: workspaceStore) + } + } .sheet(isPresented: $accountIsPresented) { AccountOverview() }