Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to accept arbitrary string for TextField in SwiftUI?

Which option I can use

TextField("na", value: $object.maintainer, format: .)

to accept any arbitrary string here?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

The default is to accept an arbitrary string. You just need maintainer to be of type String here and use TextField("na", text: $object.maintainer). (Note text, not value. The version you’re using is for things that need custom conversion, so you need to provide that custom conversion.)

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading