I wanted to create a project without any storyboards.
I have deleted the Main and LaunchScreen storyboards.
As usual I added to my applicationDidFinishLaunchingWithOptions:
window = UIWindow(frame: UIScreen.main.bounds
window?.rootViewController = ViewController()
window?.makeKeyAndVisible()
Now in Project Settings -> General if I leave Launch Screen File empty UIScreen.main.bounds
is
(CGRect) $R12 = (origin = (x = 0, y = 0), size = (width = 320, height = 480))
And I get the following screen:
Now if I add something to the Launch Screen File
field, in Info.plist -> Information Property List a new line with key Launch screen interface file base name
appears and the bounds are correct. The bounds are correct even if the value is empty.
Why does the existence of Launch screen interface file base name
affect UIScreen bounds?
It started in iOS 8.0 when iPhone 6/6plus was released (TheFuquan user commented it started with the iPhone 5 release), in 2014. Back then if you wanted to support such new devices, you would definitely need, as it was required, to add a proper launch screen. Either through static image with different sizes for each devices you support OR through xib/storyboards.
Now, you answered your confusion already. The way to fix that is to provide a proper launch screen/image.
Apple's Human Interface Guidelines (Launch Screen): https://developer.apple.com/design/human-interface-guidelines/ios/icons-and-images/launch-screen/