How do you create a multi-line text inside a ScrollView in SwiftUI?

后端 未结 4 2082
暖寄归人
暖寄归人 2020-11-30 02:12

Since List doesn\'t look like its configurable to remove the row dividers at the moment, I\'m using a ScrollView with a VStack inside

4条回答
  •  生来不讨喜
    2020-11-30 03:10

    It seems like there is bug in SwiftUI. For now you have to specify height for your VStack container

    ScrollView {
          VStack {
               // ...
                   Text("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer mattis ullamcorper tortor, nec finibus sapien imperdiet non. Duis tristique eros eget ex consectetur laoreet.")
                        .lineLimit(nil)
                }.frame(width: UIScreen.main.bounds.width, height: 500)
           }
    

提交回复
热议问题