[swift-users] Binding NSTextField value to NSNumber

Jens Alfke jens at mooseyard.com
Wed Jan 6 14:01:58 CST 2016

> On Jan 6, 2016, at 11:25 AM, Etan Kissling via swift-users <swift-users at swift.org> wrote:
> I now bind such en object to an NSObjectController, 
> and bind the value binding of an NSTextField to the object controller's selection.someNumber key path.

This is a Cocoa question, not a Swift question; a better place to ask is Apple’s cocoa-dev mailing list at http://lists.apple.com, or Apple’s developer forums.

(The quick answer is that NSTextField’s ‘value’ binding is by default an NSString, not an NSNumber. If you want it to be an NSNumber, you’ll need to attach a numeric NSFormatter to the text field. If you have further questions about this, send them to me off-list since this is an off-topic thread.)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160106/79c9dfff/attachment.html>

More information about the swift-users mailing list