ScrollView
Making the content scrollable.
ScrollView
Making the content scrollable.
0
0
Checkbox to mark video as read
Mark as read

So far we've seen how to display multiple components to our users, but what happens if all this content doesn't fit on the screen?

In order to allow our users to scroll through our content, we must include that content in a ScrollView.

Let's look at an example where we display 4 Rectangle() to which we apply a color with the modifier .fill().

ScrollView {
    VStack {
        Rectangle()
            .fill(.red)
            .frame(width: 300, height: 300)

        Rectangle()
            .fill(.blue)
            .frame(width: 300, height: 300)

        Rectangle()
            .fill(.green)
            .frame(width: 300, height: 300)

        Rectangle()
            .fill(.yellow)
            .frame(width: 300, height: 300)
    }
}


course

Quiz Time!

0 Comments

Join the community to comment
Sign Up
I have an account
Be the first to comment

Accept Cookies

We use cookies to collect and analyze information on site performance and usage, in order to provide you with better service.

Check our Privacy Policy