From d6866e8e95c523cd6bd3ef82d09c164ac0c53fd6 Mon Sep 17 00:00:00 2001 From: Davide De Rosa Date: Thu, 19 May 2022 20:11:08 +0200 Subject: [PATCH] Fix iPad multitasking condition --- Passepartout/App/Constants/Theme.swift | 19 +++++++++---------- .../App/Views/OrganizerView+Profiles.swift | 6 ++++-- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/Passepartout/App/Constants/Theme.swift b/Passepartout/App/Constants/Theme.swift index c4c7ae02..0ee979d3 100644 --- a/Passepartout/App/Constants/Theme.swift +++ b/Passepartout/App/Constants/Theme.swift @@ -31,14 +31,6 @@ extension View { UIDevice.current.userInterfaceIdiom } - var themeIsiPad: Bool { - #if targetEnvironment(macCatalyst) - false - #else - UIDevice.current.userInterfaceIdiom == .pad - #endif - } - var themeIsiPadPortrait: Bool { #if targetEnvironment(macCatalyst) false @@ -48,8 +40,15 @@ extension View { #endif } - var themeIsMultitasking: Bool { - UIDevice.current.isMultitaskingSupported + var themeIsiPadMultitasking: Bool { + #if targetEnvironment(macCatalyst) + false + #else + guard #available(iOS 15, *) else { + return false + } + return UIDevice.current.userInterfaceIdiom == .pad + #endif } } diff --git a/Passepartout/App/Views/OrganizerView+Profiles.swift b/Passepartout/App/Views/OrganizerView+Profiles.swift index cc84ff20..c439880e 100644 --- a/Passepartout/App/Views/OrganizerView+Profiles.swift +++ b/Passepartout/App/Views/OrganizerView+Profiles.swift @@ -52,8 +52,10 @@ extension OrganizerView { List { if profileManager.hasProfiles { - // FIXME: iPad multitasking, navigation binding does not clear on pop without Section - if themeIsiPad && themeIsMultitasking { + // FIXME: iPad multitasking, navigation binding does not clear on pop + // - if listStyle is different than .sidebar + // - if listStyle is .sidebar but List has no Section + if themeIsiPadMultitasking { Section { profilesView } header: {