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

后端 未结 4 2083
暖寄归人
暖寄归人 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:05

    You can force views to fill their ideal size, for example in a vertical ScrollView:

    ScrollView {
        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.")
            .fixedSize(horizontal: false, vertical: true)
    }
    

    Feels a little better to me than modifying the frame.

提交回复
热议问题