본문으로 건너뛰기
TakoAPI
스킬로 돌아가기

swiftui-view-refactor

steipete 제작

iOS & macOS Development
2.3kclawskills.sh가 보고한 다운로드 수
6스타
0조회수
좋아요 0개로그인하면 이 스킬에 좋아요를 누를 수 있습니다
—아직 평가 없음
내 평가

요약

Refactor and review SwiftUI view files.

설명

이 스킬이 하는 일

Applies consistent structure and dependency patterns to SwiftUI view files. Enforces a standard member ordering, promotes Model-View patterns over view models, and standardizes how @Observable state is initialized and passed through views.

Enforces structural conventions that SwiftUI's own documentation leaves implicit, making large codebases easier to navigate and review consistently.

사용 시점

  • Reordering a SwiftUI view's properties and methods into a consistent declaration order
  • Replacing an optional view model with a non-optional @State initialized in the view's init
  • Breaking a large body into smaller subviews or computed view properties
  • Standardizing how dependencies are injected through view initializers
  • Auditing @Observable usage to remove redundant wrappers or optional state

예시 워크플로

입력

User asks: Clean up this SwiftUI view — it has an optional view model, a huge body, and properties declared in random order

에이전트
  1. 1

    Reorder view members: environment values first, then let properties, @State, computed vars, init, body, and helpers last

  2. 2

    Locate the optional view model and replace it with a non-optional @State property initialized in the view's init using passed dependencies

  3. 3

    Split the large body into extracted computed view properties or dedicated View structs where sections have distinct logic

  4. 4

    Verify @Observable types are stored as @State at root and passed down explicitly without redundant wrappers

  5. 5

    Confirm no layout or business logic changed from the original

출력

Refactored SwiftUI view with standard member ordering, non-optional @State view model, and a decomposed body that delegates to named subviews

설치

clawhub install steipete/swiftui-view-refactor

CLI 명령을 실행하거나, 프롬프트를 Claude Code, Cursor, Codex 등 사용하는 코딩 에이전트에 붙여넣으세요.

링크