Recall & Review
beginner
What is a Spacer in SwiftUI?
A Spacer is a flexible space that expands to fill available space in a layout, pushing other views apart.
Click to reveal answer
beginner
How does padding affect a view in SwiftUI?
Padding adds empty space around the content inside a view, creating space between the view's edges and its content.
Click to reveal answer
beginner
Which SwiftUI modifier adds space inside a view's border?
The .padding() modifier adds space inside the view's border, around its content.
Click to reveal answer
intermediate
What happens if you add multiple Spacers in a horizontal stack?
Multiple Spacers share the available space equally, pushing views evenly apart.
Click to reveal answer
intermediate
Can you specify padding only on certain edges in SwiftUI?
Yes, you can specify padding on specific edges using .padding(.leading), .padding(.top), etc.
Click to reveal answer
What does Spacer() do in a SwiftUI layout?
✗ Incorrect
Spacer() creates flexible space that expands to fill available room, pushing other views apart.
How do you add padding only to the top of a view in SwiftUI?
✗ Incorrect
Use .padding(.top) to add padding only on the top edge of a view.
If you want equal space between three buttons horizontally, what should you use?
✗ Incorrect
Adding Spacer() between buttons pushes them apart evenly.
What is the default behavior of .padding() without parameters?
✗ Incorrect
Without parameters, .padding() adds equal space around all edges of the view.
Which of these is NOT true about Spacer()?
✗ Incorrect
Spacer() does not add fixed padding; it adds flexible space between views.
Explain how Spacer and padding work together to create balanced layouts in SwiftUI.
Think about how empty space and inside space affect view placement.
You got /4 concepts.
Describe how you would add space only on the left side of a button in SwiftUI.
Remember padding can target specific edges.
You got /3 concepts.