<!--
{
  "documentType" : "article",
  "framework" : "SpriteKit",
  "identifier" : "/documentation/SpriteKit/creating-a-scene-from-a-file",
  "metadataVersion" : "0.1.0",
  "role" : "article",
  "title" : "Creating a Scene from a File"
}
-->

# Creating a Scene from a File

Load a scene that you configure in Xcode’s scene editor.

## Discussion

The most common way to load an [`SKScene`](/documentation/SpriteKit/SKScene) is through an `.sks` file configured in Xcode’s scene editor. Making your base changes in the editor is faster than writing equivalent initalization code, and it  avoids repeating code if you create a scene in multiple places.

### Create a New Scene File

First, add a new scene file to your project through Xcode’s File menu > New… > File > (choose your platform tab) > SpriteKit Scene.

![Sceenshot showing the New File dialog in Xcode. Pick your target platform tab, then choose SpriteKit Scene.](images/com.apple.spritekit/media-3020351@2x.png)

### Configure the Scene Using the Editor

You configure your scene in the scene editor by clicking on the `.sks` file in Xcode’s file navigator pane, then adjusting properties in the Utility pane. For example, to set your scene’s background color, follow the steps highlighted in the figure below:

1. Select the `.sks` file in the file navigator pane.
2. Open the Utilities pane.
3. Choose the Attributes inspector.
4. Define a color under Scene.

![Screenshot showing setting the scene background color in Xcode’s SpriteKit scene editor. You select the .sks file in Xcode’s file navigator pane, then choose the Attributes inspector tab within the Utilities pane. ](images/com.apple.spritekit/media-3020360@2x.png)

### Load the Scene in Code

Load the newly configured scene file in code using [`init(fileNamed:)`](/documentation/SpriteKit/SKNode/init(fileNamed:)).

```swift
let scene = SKScene(fileNamed: "MyScene")
        
// Now present the scene in a view.
skView.presentScene(scene)
```

> Note:
> The `.sks` file extension is left out of the `String` name argument to ``doc://com.apple.spritekit/documentation/SpriteKit/SKNode/init(fileNamed:)``.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)