iOS Build a Simple iPhone App with Swift View Controllers and Views Recap: Views

James Rimmer
James Rimmer
2,603 Points

"Each iPhone app has one window which acts as a container for the views in our app"

I put 'False' for this question and it said I was incorrect, but actually it is a poorly worded question. Each iPhone app doesn't necessarily have one window, as the video lesson stated that each iPhone app has AT LEAST one window (the implication being there could be multiple windows within the app). Will this question be updated?

1 Answer

Nathan F.
Nathan F.
iOS Development with Swift Techdegree Student 28,947 Points

This is a little tricky one--I'd have to go back to see where the video says "at least" one window to confirm, but the answer is indeed actually "true." If you open a recent iOS project, or even a new one, and use the "Debug View Hierarchy" button, You'll see that underneath your multiple views is a single object called "UIWindow".

It is possible to have more than one UIWindow, but as the docs specify, this is typically for displaying content on an external monitor or something of that sort.

The phrasing might be a bit confusing, but it's still true--there's always one UIWindow object which manages and contains our views.

James Rimmer
James Rimmer
2,603 Points

Thanks Nathan for coming back on this one. If, as you state, there is the possibility of having more than one window (albeit in rare cases), and if the statement in the question is specifically worded "Each iPhone app HAS one window..." rather than "...AT LEAST one window", then surely the fact that it is possible to have MORE THAN one means the statement "Each iPhone app HAS one window..." is in fact 'False' as it is actually possible to have MORE THAN one window? Would you agree?