DevPrep

All topics › UIKit

UIWindow

Junior PRO

The gist

UIWindow is the root container of the view hierarchy (a UIView subclass) with no content of its own: it shows the rootViewController and delivers events. Since iOS 13 a window belongs to a scene: you create it with UIWindow(windowScene:) inside scene(_:willConnectTo:options:). An app can have several scenes (multiple windows on iPad, an external display, CarPlay), each with its own windows.

The rest of this answer, with code and interview follow-ups, is in the DevPrep app.

Read the full answer in DevPrep

Practice this before your interview

DevPrep turns these answers into one-minute challenges: what does this code print, find the bug, mock interviews. One challenge a day.

Get DevPrep on the App Store