You can create a view with a red background of size 100 by 100 by using the Color
and frame
modifiers in SwiftUI as shown below:
main.swift135 chars9 lines
This creates a RedView
struct which is a SwiftUI View
that displays a red background color of size 100 by 100. You can then use this view in your SwiftUI hierarchy by adding it to a parent view, like this:
main.swift144 chars9 lines
This adds the RedView
to a VStack
along with some text, and displays it on the screen.
gistlibby LogSnag