Find Jobs
Hire Freelancers

Write custom NSTextField class to work with Measurement in Swift

$10-30 USD

Cerrado
Publicado hace más de 7 años

$10-30 USD

Pagado a la entrega
See stackoverflow question here: [login to view URL] 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() [login to view URL] = .medium [login to view URL] = .providedUnit let area = Measurement<UnitArea>( value: 123.43, unit: .squareInches) let editInput = NSTextFieldCell [login to view URL] = area [login to view URL] = areaFormatter This displays something like 123.43 in^2 The problem starts when I want to read this back in with var inputArea = [login to view URL] 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 = [login to view URL] as! Measurement<UnitArea> so this gets displayed 123.43 in^2 but only the 123.43 can be edited.
ID del proyecto: 12157646

Información sobre el proyecto

1 propuesta
Proyecto remoto
Activo hace 7 años

¿Buscas ganar dinero?

Beneficios de presentar ofertas en Freelancer

Fija tu plazo y presupuesto
Cobra por tu trabajo
Describe tu propuesta
Es gratis registrarse y presentar ofertas en los trabajos

Sobre este cliente

Bandera de UNITED STATES
Bonita Springs, United States
5,0
133
Forma de pago verificada
Miembro desde oct 25, 2004

Verificación del cliente

¡Gracias! Te hemos enviado un enlace para reclamar tu crédito gratuito.
Algo salió mal al enviar tu correo electrónico. Por favor, intenta de nuevo.
Usuarios registrados Total de empleos publicados
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Cargando visualización previa
Permiso concedido para Geolocalización.
Tu sesión de acceso ha expirado y has sido desconectado. Por favor, inica sesión nuevamente.