Questions tagged [swiftui-windowgroup]
14 questions
9
votes
0 answers
SwiftUI - main(), Scene and WindowGroup are only available in iOS 14 or newer
I started a SwiftUI project with iOS 15 as a deployment target, I was asked to lower the version, so I changed it to iOS 13, after resolving some code compatibility issues I was left with an error at the entry point of the app MyProjectApp.swift…

Thorvald
- 3,424
- 6
- 40
- 66
9
votes
1 answer
SwiftUI: How to implement Edit menu in macOS app
I am building a macOS-app using SwiftUI and the new App lifecycle.
All the default macOS menu items (like cut, copy, paste) are already there after starting a new project but they’re greyed out. How can I implement methods for these default menu…

ixany
- 5,433
- 9
- 41
- 65
7
votes
5 answers
SwiftUI WindowGroup: How to limit the number of windows?
I am building a single window application and want to use the new Swift App Lifecycle.
import SwiftUI
@main
struct SingleWindowApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
The default…

ixany
- 5,433
- 9
- 41
- 65
5
votes
1 answer
Is it possible to combine WindowGroup and DocumentGroup in a SwiftUI iOS app?
I am developing a SwiftUI iOS app which originally started out with A WindowGroup. In another view, I have decided that I need to present that view as a DocumentGroup scene to take advantage of all the features that come with it. I don't want the…

Heyman
- 449
- 4
- 13
4
votes
2 answers
SwiftUI WindowGroup disable window persistence
Apple added new functionality to SwiftUI this year, bringing persistence and multiple windows to our SwiftUI apps. How can we disable window persistence. I'm looking for a windowing system very similar to Xcode, where there's a Welcome window on…

southwest-quack
- 41
- 2
4
votes
2 answers
How do you restrict the macOS windowing management from restoring a specific window?
I have an app that has a few windows defined as a windows group in the structure conforming to App in the main scene:
WindowGroup("StandingsView") {
StandingsView()
.environmentObject(appServices)
}
.handlesExternalEvents(matching:…

Scott
- 1,034
- 1
- 9
- 19
4
votes
1 answer
Listing and closing Windows in a MacOS SwiftUI App
I have this little sample App which creates multiple Windows of my SwiftUI MacOS app.
Is it possible:
to have a list of all open windows in MainView?
to close a single window from MainView?
to send Message to a single window from…

mica
- 3,898
- 4
- 34
- 62
3
votes
1 answer
How to set size of WindowGroup in visionOS?
I want to set the dimensions of a WindowGroup to a specific size when running on visionOS. On iOS and maOS we have the .defaultSize modifier for that. When building for visionOS, Xcode offers a slightly different modifier (with an additional…

ixany
- 5,433
- 9
- 41
- 65
2
votes
1 answer
What is equivalent to 'window.rootViewController' in WindowGroup - SwiftUI
I am new to SwiftUI and facing a problem where I want to change the root view when a certain action occurs inside the app.
How I handle it when using SceneDelegate was as follows
func scene(_ scene: UIScene, willConnectTo session: UISceneSession,…

el3ankaboot
- 302
- 2
- 12
1
vote
0 answers
Detecting hardware keyboard key press under iPadOS 14.x with SwiftUI 2.0
i'm trying to add hardware keyboard support for an iOS 14.0 app written in SwiftUI 2.0.
I saw some examples working with UIHostingController, so i'd like to try this way on iOS14/SWiftui 2.0 using WindowGroup.
I'm gettin gerror when compiling in…

Fred The Dev
- 163
- 8
0
votes
0 answers
SwiftUI WindowGroup opens multiple windows with the same id on an ipad
I want to make a data-driven WindowGroup so that my app can launch additional supporting windows. The problem is that on the iPad, the WindowGroup doesn't seem to know that a specific window for that ID is already open, so it opens another window…

reza23
- 3,079
- 2
- 27
- 42
0
votes
1 answer
Status Bar Color Not being modified SwiftUI
Thanks for taking your time to help others :)
Problem description:
I'm starting a new iOS 14-16 app with SwiftUI.
In this new app, we removed AppDelegate and SceneDelegate logic, just trying to simplify, using just the WindowGroup.
The thing is, all…

MglSaRu
- 115
- 5
0
votes
2 answers
SwiftUI - share dictionary among views, unclear what arguments to use at @Main / WindowGroup
I'm trying to build an app (macOS, but would be the same for iOS) that creates a number of grids, the outcome of which is to be shown in a second screen. For this, I'm sharing data across these screens, and I'm running into an issue here, I hope…

quoteunquote
- 5
- 3
0
votes
0 answers
How to detect URL schemes with .handlesExternalEvents and NSAppleEventManager simultaneously
I have a SwiftUI-based Mac app with multiple WindowGroups.
1. Opening different SwiftUI WindowGroups using URL schemes
To open those windows I am using URL schemes (like described here):
WindowGroup {
// ...
}
.handlesExternalEvents(matching:…

ixany
- 5,433
- 9
- 41
- 65