Skip to content

Add rule: prefer_frame_over_spacer #40

@kj6dev

Description

@kj6dev

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions