title: Changing a JSContext-passed Swift object with JavaScriptCore
body: <p>I have a problem changing an object passed into JavaScriptCore.</p>
  
  <p>Here is my custom object, defining a single String property called testProperty:</p>
  
  <pre><code>import Foundation
  import JavaScriptCore
  
  protocol JSCustomObjectExport: JSExport {
      var testProperty: String { get set }
  }
  
  class JSCustomObject: NSObject, JSCustomObjectExport {
      var testProperty: String = "ABC"
  }
  </code></pre>
  
  <p>Here is the AppDelegate in which I create a JSContext, pass my custom object to it and run a JS script to change its testProperty from "ABC" to "XYZ". However the testProperty is never changed.</p>
  
  <pre><code>import Cocoa
  import JavaScriptCore
  
  class AppDelegate: NSObject, NSApplicationDelegate {
  
      @IBOutlet var window: NSWindow!
      lazy var context = JSContext()
  
      func applicationDidFinishLaunching(aNotification: NSNotification?) {
          println("Started")
          var co = JSCustomObject()
          context.globalObject.setValue(co, forProperty: "customObject")
          context.evaluateScript("customObject.testProperty = 'XYZ'")
          println(co.testProperty) // ERROR(?): This prints "ABC" instead of "XYZ"
      }
  
  }
  </code></pre>
  
  <p>Am I doing something wrong? Shouldn't co.testProperty change?</p>
  
  <p>Btw, this is an OS X app, compiled in XCode 6.1.1 on OSX 10.10.1.</p>