title: SpriteKit .sks Files Crash Xcode 10 When Assigning Texture
body: <h2>Am I missing something obvious?</h2>
  
  <p>For reasons unknown, Xcode 10 keeps crashing on me when I go to assign a texture to a <strong>named</strong> sprite using the Scene Editor. After having to delete and recreate my .sks files a couple times, I decided to try and reproduce the issue using Xcode's game template. The steps I took to do this are as follows:</p>
  
  <ul>
  <li>Open Xcode and select <strong>Create a new Xcode project</strong>.</li>
  <li>Choose the <strong>Game</strong> template, name the project <strong>Test</strong> and save it somewhere, i.e. your desktop.</li>
  <li><p>Drag any image asset into <strong>Assets.xcassets</strong>. I used this green square:</p>
  
  <p><a href="https://i.stack.imgur.com/nTLJV.png" rel="noreferrer"><img src="https://i.stack.imgur.com/nTLJV.png" alt="green square"></a></p></li>
  <li>Open <strong>GameScene.sks</strong> and drag a <strong>Color Sprite</strong> onto the scene.</li>
  </ul>
  
  <p><a href="https://i.stack.imgur.com/C3j8H.png" rel="noreferrer"><img src="https://i.stack.imgur.com/C3j8H.png" alt="enter image description here"></a></p>
  
  <ul>
  <li>Name the sprite something descriptive like <strong>square_green</strong>.</li>
  <li>Attempt to set the texture in this field:</li>
  </ul>
  
  <p><a href="https://i.stack.imgur.com/nrpG2.png" rel="noreferrer"><img src="https://i.stack.imgur.com/nrpG2.png" alt="enter image description here"></a></p>
  
  <p>Other similar questions on Stack Overflow:</p>
  
  <p><a href="https://stackoverflow.com/questions/36390504/xcode-is-crashing-in-spritekit">Xcode is crashing in SpriteKit</a></p>
  
  <p><a href="https://stackoverflow.com/questions/46879397/xcode-9-crashing-while-setting-a-texture-in-skscene-in-spritekit">XCode 9 Crashing while setting a Texture in SKScene in Spritekit</a></p>
  
  <p>If I do not set a name for the color sprite prior to assigning a texture, everything works fine. However, if Xcode is forced to crash at least one time, I have to delete the .sks file completely just to get Xcode to open again.</p>
  
  <p>For the time being I've decided to avoid the trouble all together and just assign the textures programmatically in the didMove(to:) of my SKScene class:</p>
  
  <pre><code>override func didMove(to view: SKView) {
      let greenSquare = childNode(withName: "square_green") as! SKSpriteNode
      greenSquare.texture = SKTexture(imageNamed: "square_green")
  }
  </code></pre>