Overview
Suggest using .frame(maxHeight: .infinity, alignment: .top) instead of VStack { content; Spacer() }
Rule Identifier
prefer_frame_over_spacer
Rationale
More concise, declarative, and performant approach to alignment.
Example
// ❌ Avoid
VStack {
Text("Header")
Spacer()
}
// ✅ Prefer
Text("Header")
.frame(maxHeight: .infinity, alignment: .top)
Notes
This is a preference, not always wrong - VStack+Spacer is more explicit about layout intent. Consider making this a warning rather than error.
Priority
Medium
Overview
Suggest using
.frame(maxHeight: .infinity, alignment: .top)instead ofVStack { content; Spacer() }Rule Identifier
prefer_frame_over_spacerRationale
More concise, declarative, and performant approach to alignment.
Example
Notes
This is a preference, not always wrong - VStack+Spacer is more explicit about layout intent. Consider making this a warning rather than error.
Priority
Medium