title: Swift: Cannot Store Unsafe Pointers in Array
body: <p>I created a small <code>struct</code> to hold version numbers.</p>
  
  <p>Now I searched a compact way to parse the numbers directly into the variables of the struct. I tried to implement it this way:</p>
  
  <pre><code>struct Version {
      var major: Int = 0
      var minor: Int = 0
      var revision: Int = 0
  
      init(string: String) {
          let components = string.componentsSeparatedByString(".")
          if 1...3 ~= components.count {
              var targets = [&amp;major, &amp;minor, &amp;revision]
              for index in 0...2 {
                  var scanner = NSScanner(string: components[index])
                  if (!scanner.scanInteger(target[index])) {
                      major = 0
                      minor = 0
                      revision = 0
                      return                    
                  }
              }
          }
      }    
  }
  </code></pre>
  
  <p>But I get this error message:</p>
  
  <pre><code>Type '[inout Int]' of variable is not materializable
  </code></pre>
  
  <p>I do not understand this error. Is there a way to implement it in this way, using a sort of pointers to the member variables?</p>
  
  <h1>Update</h1>
  
  <p>In the end I did not use unsafe pointers. This was my final implementation:</p>
  
  <pre><code>init(string: String) {
      let components = string.componentsSeparatedByString(".")
      if 1...3 ~= components.count {
          var values = [0, 0, 0]
          for index in 0..&lt;components.count {
              var scanner = NSScanner(string: components[index])
              if (!scanner.scanInteger(&amp;values[index])) {
                  return
              }
          }
          major = values[0]
          minor = values[1]
          revision = values[2]
      }
  }
  </code></pre>