title: Custom NSValueTransformer in xcode 6 with swift
body: <p>Did anyone successfully implement a custom NSValueTransformer in xcode 6 beta with swift?</p>
  
  <p>I have the following swift class:</p>
  
  <pre><code>import Foundation
  
  class myTransformer: NSValueTransformer {
  
    let amount = 100
  
    override class func transformedValueClass() -&gt; AnyClass!
    {
      return NSNumber.self
    }
  
    override func transformedValue(value: AnyObject!) -&gt; AnyObject! {
      return value.integerValue + amount
    }
  }
  </code></pre>
  
  <p>So all this transformer should do is, adding 100 to a given value in the gui.</p>
  
  <p>As you can see, the transformer class appears now in the Value Transformer drop down in IB.</p>
  
  <p><img src="https://i.stack.imgur.com/JXkNk.png" alt="enter image description here"></p>
  
  <p>But if I choose this transformer the application crashes with:</p>
  
  <pre><code>2014-08-27 20:12:17.686 cdTest[44134:303] 
  *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', 
  reason: 'Cannot find value transformer with name newTransformer'
  </code></pre>
  
  <p>Is it right to register this transformer in the AppDelegate with</p>
  
  <pre><code>override class func initialize() {
    let newTransformer = myTransformer()
  }
  </code></pre>
  
  <p>Does anyone know how this whole stuff should work?</p>
  
  <p>kind regards!
  martin</p>