Window is like a topmost UI container for any iOS application. It sits above all of your views and viewControllers.
Ask me why it is needed, And I say it makes the UI structure more clear in terms of view hierarchy and event handling. For example any user event, when not handled by the innermost view, goes up the view hierarchy eventually to the window object if no other view in the hierarchy handles it.
Another example is the rootViewController of a window which handles view-specific details of the application.
There will be mostly one window for an application. But I have worked on an app which used a shared framework for user authentication. And there, we had a separate window specific to that auth framework. Why separate window you ask, and here I go again, there are 2 important use cases,
- As I mentioned it was a shared auth framework. Hence different apps could use the same framework for user authentication which uses its own window for login screen etc.
- There was a session timeout after which, a login screen had to pop up regardless of what user is currently doing on the screen. This can get really tricky if we don't use a separate window.
I hope you can understand essence of a window after reading these examples.