I'd love to build a scrolling screen, so I wanted to embed it ScrollView
. But I am not able to achieve it the view just shrinks to its compressed size. Let's say that I want the ScrollView
to scroll vertically so I'd love the content to match scrollView's width. So I use such preview:
struct ScrollSubview_Previews : PreviewProvider {
static var previews: some View {
func textfield() -> some View {
TextField(.constant("Text")).background(Color.red)
}
return Group {
textfield()
ScrollView {
textfield()
}
}
}
}
But it ends with result like this: