I can’t seem to find the link with the screenshot.
In iOS 14 and macOS 11, you can change the zoom level of a WKWebView by settings its pageZoom property. It is set to 1.00 by default, which is equivalent to Safari’s zoom at %100.
Post
Replies
Boosts
Views
Activity
You can replace the "New Window" command with an empty CommandGroup like so:
CommandGroup(replacing: .newItem, addition: {
})
There is a hacky way to do this. You can create a View that acts as your app's root view. The body of this view depends on the value of a specific variable.
For example:
@main
struct TestApp: App {
var body: some Scene {
WindowGroup {
RootView()
}
}
}
var useWindow1: Bool = true
struct RootView: View {
var body: some View {
Group {
if useWindow1 {
Window1()
} else {
Window2()
}
}
}
}
You can then use the NSWindowController on the MainWindow to open a new window.
NSApp.mainWindow?.windowController?.newWindowForTab(nil)
Though this does require that at least one window is visible. There could be another way to trigger the "New Window" command, but I haven't found one that works.
One upshot of using this instead of creating a new NSWindow with an NSHostingController is that toolbars won't display their items if you just put them in a Hosting Controller, since the NSWindow thinks it should manage the toolbar.
Also, you may have to override some of macOS' window restoration behavior, since if you have two windows of two separate views when you quit the app, it may relaunch with two of the "default" view.