Write custom NSTextField class to work with Measurement in Swift

Closed

Description

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: [url removed, login to view], unit: .squareInches)

let editInput = NSTextFieldCell

[url removed, login to view] = area

[url removed, login to view] = areaFormatter

This displays something like

[url removed, login to view] 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

[url removed, login to view] in^2

but only the [url removed, login to view] can be edited.

Skills: Objective C, Swift

See more: 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

Project ID: #12157646

3 freelancers are bidding on average $79 for this job

xiaomingming

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, More

$133 USD in 1 day
(7 Reviews)
5.5
gamnetmobile

Hi, My name is Gabriel and I'm ready to help you with your project! I'm full stack Xcode/Android Certified developer and software engineering. I'm new on freelancer and full motivated for success here! We dev More

$150 USD in 1 day
(7 Reviews)
5.2
$80 USD in 1 day
(16 Reviews)
4.4
$23 USD in 6 days
(0 Reviews)
0.0
$25 USD in 1 day
(0 Reviews)
0.0