title: Swift compiler error: Bitcast requires both operands to be pointer or neither
body: <p>I am getting the above compiler error on the following class:</p>
  
  <pre><code>class Log: NSObject, NSCoding {
  
  var targetHoursPerWeek: Double
  var weeksLog: Double[]
  
  // Serialization keys that are using to implement NSCoding.
  struct SerializationKey {
      static let targetHoursPerWeek = "targetHoursPerWeek"
      static let weeksLog = "weeksLog"
  }
  
  init() {
  
      targetHoursPerWeek = 7.0
      weeksLog = Double[](count: 7, repeatedValue: 0.0)
      // [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
  
  }
  
  // MARK: NSCoding
  
  init(coder decoder: NSCoder) {
      targetHoursPerWeek = decoder.decodeObjectForKey(SerializationKey.targetHoursPerWeek) as Double
       weeksLog = decoder.decodeObjectForKey(SerializationKey.weeksLog) as Double[]
  }
  
  func encodeWithCoder(encoder: NSCoder) {
      encoder.encodeObject(targetHoursPerWeek, forKey: SerializationKey.targetHoursPerWeek)
      encoder.encodeObject(weeksLog, forKey: SerializationKey.weeksLog)
  }
  </code></pre>
  
  <p>}</p>
  
  <p>I believe that the error comes from the line</p>
  
  <pre><code> weeksLog = decoder.decodeObjectForKey(SerializationKey.weeksLog) as Double[]
  </code></pre>
  
  <p>but if so I am stumped -- the "as Double[]" agrees with the declaration of "weeksLog".
  So I am stumped!</p>