Home > Back-end >  What is a window in SwiftUI?
What is a window in SwiftUI?

Time:09-30

The closest documentation I could find was about WindowGroup. I came across this when I was looking at how to convert a View into a bitmap.

The documentation on what is being represented here UIApplication.shared.windows[0].rootViewController.view is pretty scarce which I believe is because they weren't expecting people to access it. Could someone give me a breakdown of what windows are? How is it different from views?

CodePudding user response:

Think about a PC or a Mac

A window consists of a frame area and body area that lets the user view and interact with content in an app. A window can appear onscreen alongside other windows, or it can fill the entire screen.

https://developer.apple.com/design/human-interface-guidelines/macos/windows-and-views/window-anatomy/

https://developer.apple.com/documentation/swiftui/windowgroup

Imagine 2 Safari windows or 2 Xcode windows.

A Window contains Views such as buttons, menus, lists, images, etc.

 UIApplication.shared.windows[0].rootViewController.view

Is UIKit based code not SwiftUI, you won't find any documentation on it with the SwiftUI Framework documentation but there are plenty of "old" references that break down what it is.

https://developer.apple.com/library/archive/featuredarticles/ViewControllerPGforiPhoneOS/TheViewControllerHierarchy.html

  • Related