Build: Stack Layout Demo
This screen shows how to arrange views vertically, horizontally, and layered using VStack, HStack, and ZStack in SwiftUI.
Target UI
------------------------- | VStack, HStack, ZStack | |-----------------------| | VStack: | | [Red Box] | | [Green Box] | | [Blue Box] | | | | HStack: | | [Red Box][Green Box][Blue Box] | | | | ZStack: | | [Blue Box behind] | | [Green Box middle] | | [Red Box front] | -------------------------
Use VStack to stack three colored rectangles vertically with spacing.
Use HStack to stack the same three rectangles horizontally with spacing.
Use ZStack to layer the three rectangles on top of each other with the red box in front.
Each colored rectangle should be 100x100 points.
Add labels above each stack: 'VStack:', 'HStack:', 'ZStack:'.
Use SwiftUI and make the layout scrollable if needed.