Group Group Group Group Group Group Group Group Group

Scaling game to iPhone x


I’m creating a universal app but I have issues scaling my scene to display correctly on the iPhone x.

I’m using a single scene size of 1536, 2048 and scaling it down to other devices using aspectFill. My scene is displayed correctly on every device except the iPhone x. Objects in my safe area are cut off on the left and right side.

I would appreciate if someone could help me get my game to scale for every device including the iPhone x.


@cocopuffs Thanks very much for your question!

I found this article which I realize is a few years old, but it does discuss this exact topic, and may be useful. :slight_smile:

I hope this helps!

All the best!


I appreciate the help but I’m basing my setup on the Conga tutorial. I’m starting with a large image allowing Xcode to fill the screen on smaller devices using aspect fill. Does this method work on the iPhone x?


Hi @cocopuffs, are you adding constraints to your image? If you are using a storyboard then you can place a UIImageView in your view controller. Then you can constraints to all four sides of the UIImageview, keeping them at zero. Once you set the constraints you should be able to see the UIImageView adjust to each screen size by clicking on the phone icons in the bottom left of your storyboard. Hope that helps.



Unfortunately I’m not using storyboard. This is how I’m creating the scene and scaling the image. I’m using a 1x image for all devices just as the Conga tutorial did it.

override func viewDidLoad() {
    let scene = GameScene(size:CGSize(width: 1536, height: 2048))
    let skView = self.view as! SKView
    scene.scaleMode = .aspectFill

@cocopuffs, from what I viewed above, it looks right. Are you adding any constraints programmatically? I’ve found some possible links that might help you get that image to appear right on the iPhone X. I’m not sure if constraints are your core issue but it might be worth taking a look at the links below in regarards to that topic.
Adding Constraints Programmatically in Swift 4
Using Safe Area with iPhone X
Here is a video that is a bit long but might be worth watching.


closed #7

This topic was automatically closed after 166 days. New replies are no longer allowed.