If I place a Picker or a Toggle in a SwiftUI Kind, the related label is at all times seen:
However for a TextField, the label is simply proven whereas the sector is empty:
And as quickly as I begin to fill within the TextField, the label disappears.
So now I’ve no context for what the TextField is supposed for.
This is able to not be an issue if the TextField content material is self explanatory, however I’ve a kind with a number of TextFields used to enter numerical values, and as soon as they’re stuffed in I’ve no context for differentiating between every quantity.
Is there any approach to make a SwiftUI TextField behave like a Picker or Toggle, and have the label completely displayed?
Replace:
After attempting out Benzy’s reply of utilizing LabeledContent, I get this kind of consequence when I’ve a number of fields. As you may see the alignment of the TextFields themselves will depend on the size of the textual content within the LabeledContent. I would favor to align the TextFields.





