Write custom NSTextField class to work with Measurement in Swift

See stackoverflow question here: [url removed, login to view]

Looking for a custom NSTextField class (or NSTextFieldCell class) where I can read and write measurements to where the user can not edit the measurement text.

I want to be able to nicely use a Measurement and MeasurementFormatter for output and input with a NSTextFieldCell.

I am able to display the measurement correctly with...

let areaFormatter = MeasurementFormatter()

[url removed, login to view] = .medium

[url removed, login to view] = .providedUnit

let area = Measurement<UnitArea>( value: 123.43, unit: .squareInches)

let editInput = NSTextFieldCell

[url removed, login to view] = area

[url removed, login to view] = areaFormatter

This displays something like

123.43 in^2

The problem starts when I want to read this back in with

var inputArea = [url removed, login to view] as! Measurement<UnitArea>

I think because the get Object value of the Measurement Formatter is not defined.

open func getObjectValue(_ obj: AutoreleasingUnsafeMutablePointer<AnyObject?>?, for string: String, errorDescription error: AutoreleasingUnsafeMutablePointer<NSString?>?) -> Bool

Is my understanding correct? Are there any examples in Swift where this function has been defined for measurements?

Right now the user can edit the entire string including the text in the units. Is there a good way to block the units in the NSTextFieldCell? I would like the user to be able to edit the number but not the units and then return the measurement with

var inputArea = [url removed, login to view] as! Measurement<UnitArea>

so this gets displayed

123.43 in^2

but only the 123.43 can be edited.

Habilidades: Objective C, Swift

Ver más: work from home tax write offs, custom write, class custom php, class custom themes, work opencart custom footer, class custom template, design implement class circular list write program, moodle custom write query, wordpress custom write panel, maths working project work class, wordpress custom write table, page class custom properties joomla, java class will able write text file, write secure url custom api magento, joomla error unable open configurationphp write, write custom forum software, magento write custom extension template, sharepoint write custom search query, write custom content query webpart, mass mailer swift mailer class, custom properties macro write, write custom scripts trixbox, excel write custom xml, freelancer surfacing work class, write custom code godaddy reseller

Información del empleador:
( 133 comentarios ) Bonita Springs, United States

Nº del proyecto: #12157646

1 freelancer está ofertando el promedio de $133 para este trabajo


How are you? Thanks for your checking my bid. I am a Mobile & Web developer who have 10 years experience of program develop and 5 + years in mobile. also I have rich develop experience with XCode, Android studio, Más

$133 USD en 1 día
(9 comentarios)