Search code examples
iosxcodeswift2xcode7iphone-x

Add iPhone X layout support to old Xcode 7 / Swift 2 project


What I have?

An old project using Swift 2 and building/running without any issue on Xcode 7. It has a lot of dependencies and sophisticated architecture which makes it complicated to migrate to swift 3/4 (in a short period of time).

When app is running on iPhone X it has black bars on top and bottom of the sreen (sizing like on iPhone 6/7/8)

What I need?

I need to make the app running on iPhone X without black bars on top and bottom of the screen (fullscreen) without updating whole project. Are there any ways making it possible?

What I've tried?

  • Making constraints directly to the containing superviews and not the layoutGuide
  • Removing launchScreen assets and sticking only to LaunchScreen.xib

Solution

  • There are only two ways to remove black bars for a newer device size:

    • Launchscreen images assets with the new size
    • Launchscreen storyboard

    And, well, you're out of luck, because both solutions require Xcode 9 for iPhone X size support. So you must go for Swift 3.2 at least.