title: Split UInt32 into [UInt8] in swift
body: <p>I want to add <code>UInt32</code> to byte buffer for which I use <code>[UInt8]</code>. In java, there is convenient ByteBuffer class that has methods like putInt() for cases exactly like this. How could this be done in swift?</p>
  
  <p>I guess I could solve this as following:</p>
  
  <pre><code>let example: UInt32 = 72 &lt;&lt; 24 | 66 &lt;&lt; 16 | 1 &lt;&lt; 8 | 15
  var byteArray = [UInt8](count: 4, repeatedValue: 0)
  
  for i in 0...3 {
      byteArray[i] = UInt8(0x0000FF &amp; example &gt;&gt; UInt32((3 - i) * 8))
  }
  </code></pre>
  
  <p>This is quite verbose though, any simpler way?</p>