title: How do I work with a UnsafeMutablePointer<UnsafeMutablePointer<Void>> reference from Swift?
body: <p>I'm building a test app using the SceneKit's <code>SCNParticleSystem</code>. It has a callback which lets you modify the particles' properties on each frame. The signature of this callback is </p>
  
  <pre><code>typealias SCNParticleModifierBlock = (UnsafeMutablePointer&lt;UnsafeMutablePointer&lt;Void&gt;&gt;, UnsafeMutablePointer&lt;Int&gt;, Int, Int, Float) -&gt; Void
  </code></pre>
  
  <p>Reference from apple developer site - <a href="https://developer.apple.com/library/prerelease/ios/documentation/SceneKit/Reference/SCNParticleSystem_Class/index.html#//apple_ref/doc/constant_group/Particle_Property_Keys" rel="nofollow">SCNParticleSystem_Class</a></p>
  
  <p>I don't know how to access and modify this reference from Swift. If this was C it would be a <code>**</code> that I could dereference like an array. </p>
  
  <p>After some futzing I've gotten as far as this:</p>
  
  <pre><code>..... 
             particleSystem?.addModifierForProperties([SCNParticlePropertySize], atStage: SCNParticleModifierStage.PostDynamics, withBlock: doit2)
  }
  
  struct Foos {
      var size:float_t
  }
  func doit2(data:UnsafeMutablePointer&lt;UnsafeMutablePointer&lt;Void&gt;&gt;, dataStride: UnsafeMutablePointer&lt;Int&gt;, start:Int, end:Int, deltaTime:Float) -&gt; Void {
      let myptr = UnsafeMutablePointer&lt;UnsafeMutablePointer&lt;Foos&gt;&gt;(data)
      print("indexes",start,end)
      for i in 0 ..&lt; end {
          print(i,myptr[i].memory.size)
      }
  }¸
  </code></pre>
  
  <p>This works for the first particle but crashes on the second.  The first time the function is called there are 0 particles, so it skips the loop. The second time there are three particles, so it tries to print them out. The first size value is 0.9 which seams reasonable. The second size value is clearly bogus, and then it crashes and I drop into the debugger.</p>
  
  <pre><code>indexes 0 0
  indexes 0 3
  0 0.929816
  1 1.51296e-39
  (lldb)
  </code></pre>
  
  <p>As near as I can tell no one on the internet uses this function. The only references I find are Apple's docs which provide only ObjC examples for it, not Swift.</p>
  
  <p>Help me!</p>