TextField.linelimit(nil) is not resulting in multiline TextField

I am trying to come up with an appearance in SwiftUI where user can enter multiple line of text on screen. For this I am using TextField and setting linelimit to nil. But output is not showing TextField as multiline.

Below is my code

struct ItemDetailView: View {
@State var itemDescription: String = “”

var body: some View {
    TextField("Type some description such as product or item name so that you can recall later what it was about.", text: $itemDescription)
        .border(Color.gray, width: 1)


and below is how TextField is rendered.

Screenshot 2020-06-05 at 12.56.52 PM

When I do the same for Text then it is rendered as multiline.

TextFields are generally single lined. Try TextView’s instead.

This topic was automatically closed after 166 days. New replies are no longer allowed.