title: Applying a texture material to custom objects in SceneKit
body: <p>SceneKit beginner here, doing an iOS project.</p>
  
  <p>I have been wrapping textures around SCN geometry (spheres, so far) like this:</p>
  
  <pre><code>let scene = SCNScene()
  var planet : SCNGeometry
  planet = SCNSphere(radius: 1.0)
  let material = SCNMaterial()
  material.diffuse.contents = UIImage(named: "texture.jpg")
  planet.materials = [material]
  let planetNode = SCNNode(geometry: planet)
  scene.rootNode.addChildNode(planetNode)
  </code></pre>
  
  <p>And this seems to be working fine.  I have textures that are meant to apply to spheres anyways.</p>
  
  <p>However, when I try to load a custom obj file, texture materials seem to refuse to map onto it when I load the geometry from the obj like so:</p>
  
  <pre><code>let scene = SCNScene()
  var planet : SCNGeometry
  let tempScene = SCNScene(named: "model.obj")
  planet = tempScene!.rootNode.childNodes[0].geometry!
  let material = SCNMaterial()
  material.diffuse.contents = UIImage(named: "texture.jpg")
  planet.materials = [material]
  let planetNode = SCNNode(geometry: planet)
  scene.rootNode.addChildNode(planetNode)
  </code></pre>
  
  <p>The model object, however, appears to show just fine, albeit, without the texture.<br>
  Any pointers?</p>