title: KVO Binding failing in swift
body: <p>This bug has me truly frustrated. I am using KVO as follows:</p>
  
  <pre><code>dynamic var product: NSNumber? {
      get {
          return (defaults.objectForKey("product") != nil ? defaults.integerForKey("product") : nil)
      }
      set(newValue) {
          if newValue != product {
              willChangeValueForKey("product")
              if let value = newValue {
                  defaults.setInteger(value.integerValue, forKey: "product")
              } else {
                  defaults.removeObjectForKey("product")
              }
              didChangeValueForKey("product")
              reader.product = newValue?.integerValue
              refresh()
          }
      }
  }
  
  override class func automaticallyNotifiesObserversForKey(key: String) -&gt; Bool {
      return true
  }
  </code></pre>
  
  <p>Another object modifies the property as follows;</p>
  
  <pre><code>    info.product = NSNumber(short: prodId)
  </code></pre>
  
  <p>When called, the result is the following error;</p>
  
  <pre><code>    Thread 1: EXC_BAD_ACCESS(code=1, address = 0x0)
  </code></pre>
  
  <p>And stack trace:</p>
  
  <pre><code>#0  0x37c4cf66 in objc_msgSend ()
  #1  0x2acca772 in NSKeyValuePushPendingNotificationPerThread ()
  #2  0x2acbae3c in NSKeyValueWillChange ()
  #3  0x2aca7c04 in -[NSObject(NSKeyValueObserverNotification) willChangeValueForKey:] ()
  #4  0x2acdafc0 in _NSSetObjectValueAndNotify ()
  #5  0x002a3c44 in Module.MyView.pickerView (Module.MyView)(ObjectiveC.UIPickerView, didSelectRow : Swift.Int, inComponent : Swift.Int) -&gt; () at /&lt;***&gt;/MyView.swift:122
  </code></pre>
  
  <p>Now, I've set breakpoints and prints and determined that <code>NSKeyValueWillChange</code> is called before the var setter code is called, so it appears that this is not being used in the same way as in Objective C, that the message for <code>NSKeyValueWillChange</code> is being sent before the the setter is being called. In Objective C the setter had to manually call <code>willChangeValueForKey("product")</code>. Anybody have any idea what is happening?</p>
  
  <p>On a side note, the following s the code where the crash occurs. The error occurs on the third line, I am guessing that r9 being 0x0 has something to do with it.</p>
  
  <pre><code>libobjc.A.dylib`objc_msgSend:
  0x37c4cf60:  cbz    r0, 0x37c4cf9e            ; objc_msgSend + 62
  0x37c4cf62:  ldr.w  r9, [r0]
  0x37c4cf66:  ldrh.w r12, [r9, #12]
  0x37c4cf6a:  ldr.w  r9, [r9, #8]
  0x37c4cf6e:  and.w  r12, r12, r1
  0x37c4cf72:  add.w  r9, r9, r12, lsl #3
  0x37c4cf76:  ldr.w  r12, [r9]
  0x37c4cf7a:  teq.w  r12, r1
  0x37c4cf7e:  bne    0x37c4cf86                ; objc_msgSend + 38
  0x37c4cf80:  ldr.w  r12, [r9, #4]
  0x37c4cf84:  bx     r12
  0x37c4cf86:  cmp.w  r12, #0x1
  0x37c4cf8a:  blo    0x37c4cf98                ; objc_msgSend + 56
  0x37c4cf8c:  it     eq
  0x37c4cf8e:  ldreq.w r9, [r9, #4]
  0x37c4cf92:  ldr    r12, [r9, #8]!
  0x37c4cf96:  b      0x37c4cf7a                ; objc_msgSend + 26
  0x37c4cf98:  ldr.w  r9, [r0]
  0x37c4cf9c:  b      0x37c4d1e0                ; _objc_msgSend_uncached
  0x37c4cf9e:  mov.w  r1, #0x0
  0x37c4cfa2:  bx     lr
  </code></pre>