From 8334e38a0ae64086668db614d7e115fdc345b47c Mon Sep 17 00:00:00 2001 From: Matt Kiazyk Date: Sat, 23 Jan 2021 14:22:23 -0600 Subject: [PATCH 1/2] #71 Update Filter/Info to use AppStorage --- Xcodes/Frontend/MainWindow.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Xcodes/Frontend/MainWindow.swift b/Xcodes/Frontend/MainWindow.swift index 4170a2bb..0b1eb419 100644 --- a/Xcodes/Frontend/MainWindow.swift +++ b/Xcodes/Frontend/MainWindow.swift @@ -6,8 +6,8 @@ struct MainWindow: View { @State private var selectedXcodeID: Xcode.ID? @State private var searchText: String = "" @AppStorage("lastUpdated") private var lastUpdated: Double? - @SceneStorage("isShowingInfoPane") private var isShowingInfoPane = false - @SceneStorage("xcodeListCategory") private var category: XcodeListCategory = .all + @AppStorage("isShowingInfoPane") private var isShowingInfoPane = false + @AppStorage("xcodeListCategory") private var category: XcodeListCategory = .all var body: some View { HSplitView { From 102f3bbb582ffe185ea2b9d4c06fb608e59c44a6 Mon Sep 17 00:00:00 2001 From: Matt Kiazyk Date: Sat, 23 Jan 2021 15:45:52 -0600 Subject: [PATCH 2/2] Add comments about why we're using appStorage instead of sceneStorage Co-authored-by: Brandon Evans --- Xcodes/Frontend/MainWindow.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Xcodes/Frontend/MainWindow.swift b/Xcodes/Frontend/MainWindow.swift index 0b1eb419..006740cf 100644 --- a/Xcodes/Frontend/MainWindow.swift +++ b/Xcodes/Frontend/MainWindow.swift @@ -6,6 +6,10 @@ struct MainWindow: View { @State private var selectedXcodeID: Xcode.ID? @State private var searchText: String = "" @AppStorage("lastUpdated") private var lastUpdated: Double? + // These two properties should be per-scene state managed by @SceneStorage property wrappers. + // There's currently a bug with @SceneStorage on macOS, though, where quitting the app will discard the values, which removes a lot of its utility. + // In the meantime, we're using @AppStorage so that persistence and state restoration works, even though it's not per-scene. + // FB8979533 SceneStorage doesn't restore value after app is quit by user @AppStorage("isShowingInfoPane") private var isShowingInfoPane = false @AppStorage("xcodeListCategory") private var category: XcodeListCategory = .all