Skip to content

Commit

Permalink
Fix reopening window on macOS (#5)
Browse files Browse the repository at this point in the history
## Summary

This fixes an issue that caused macOS app rejection to AppStore.

> we found that when the user closes the main application window there
is no menu item to re-open it

When using `Window`, the "New window" menu item is not available.
Switching to `WindowGroup` solves the problem.

## What was done

- [x] Use `WindowGroup` instead of `Window` in macOS app
- [x] Remove unused `AppWindowID.main`
  • Loading branch information
darrarski authored May 14, 2024
2 parents 77c6e9e + d3c4b9b commit 26f40ad
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
2 changes: 1 addition & 1 deletion sort-swift-imports-app/Sources/AppFeature/App.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ struct App: SwiftUI.App {
)
}
#elseif os(macOS)
Window(appInfo.name, id: AppWindowID.main.rawValue) {
WindowGroup {
AppView(
store: Store(
initialState: AppReducer.State(
Expand Down
1 change: 0 additions & 1 deletion sort-swift-imports-app/Sources/AppShared/AppWindowID.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#if os(macOS)
public enum AppWindowID: String {
case main = "main"
case about = "about"
case help = "help"
case acknowledgments = "acknowledgments"
Expand Down

0 comments on commit 26f40ad

Please sign in to comment.