Communitygithub.com

ComeOnOliver/skillshub

코드 리뷰와 아키텍처 분석을 통해 SwiftUI 런타임 성능을 진단하고 개선합니다. 느린 렌더링, 버벅이는 스크롤, 높은 CPU/메모리 사용량, 과도한 뷰 업데이트, 레이아웃 쓰래싱 등 SwiftUI 앱의 성능 문제를 진단하고, 코드 리뷰만으로 부족할 경우 사용자가 Instruments로 프로파일링할 수 있도록 안내합니다.

skillshub란 무엇인가요?

이 스킬은 SwiftUI 앱의 런타임 성능을 코드 리뷰와 아키텍처 분석을 통해 진단하고 개선하는 전문 도구입니다. 개발자가 SwiftUI 뷰의 느린 렌더링, 버벅이는 스크롤, 높은 CPU/메모리 사용량, 과도한 뷰 업데이트, 레이아웃 쓰래싱 등의 증상을 보고하면, 체계적인 워크플로우를 통해 원인을 분석하고 구체적인 수정 방안을 제시합니다. 주요 기능으로는 코드 우선 리뷰(Code-First Review)를 통해 뷰 무효화 폭풍, 불안정한 식별자, body 내 무거운 작업, 레이아웃 쓰래싱, 대용량 이미지, 과도한 애니메이션 등의 일반적인 안티패턴을 찾아내고, 필요한 경우 Instruments 프로파일링을 안내하여 심층 분석을 지원합니다. 또한 분석 결과를 바탕으로 상태 범위 좁히기, 식별자 안정화, body 밖으로 무거운 작업 이동, 이미지 다운샘플링, 레이아웃 복잡도 감소 등의 구체적인 수정 사항을 제공합니다. 이 스킬은 Claude Code, Cursor, Codex 등 AI 어시스턴트와 함께 사용할 수 있으며, Apple의 공식 문서와 WWDC 세션을 참고 자료로 활용합니다. 최종적으로는 전/후 메트릭 테이블, 영향도 순으로 정렬된 주요 이슈 목록, 예상 작업량이 포함된 수정 제안을 통해 개발자가 SwiftUI 앱의 성능을 체계적으로 개선할 수 있도록 돕습니다.

지원 대상~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/ComeOnOliver/skillshub/tree/HEAD/skills/aiskillstore/marketplace/dimillian/swiftui-performance-audit

즐겨 사용하는 AI에게 물어보기

이 에이전트 스킬이 미리 로드된 새 채팅을 엽니다.

문서

SwiftUI 성능 감사

개요

SwiftUI 뷰 성능을 계측, 기준 설정, 근본 원인 분석, 구체적인 수정 단계까지 종합적으로 감사합니다.

워크플로우 결정 트리

  • 사용자가 코드를 제공하면 "코드 우선 리뷰"부터 시작합니다.
  • 사용자가 증상만 설명하면, 최소한의 코드/컨텍스트를 요청한 후 "코드 우선 리뷰"를 진행합니다.
  • 코드 리뷰로 결론이 나지 않으면 "사용자 프로파일링 안내"로 이동하여 트레이스 또는 스크린샷을 요청합니다.

1. 코드 우선 리뷰

수집:

  • 대상 뷰/기능 코드.
  • 데이터 흐름: state, environment, observable 모델.
  • 증상 및 재현 단계.

집중할 부분:

  • 광범위한 상태 변경으로 인한 뷰 무효화 폭풍.
  • 리스트에서 불안정한 식별자(id 변동, 렌더링 시 UUID() 사용).
  • body에서의 무거운 작업(포매팅, 정렬, 이미지 디코딩).
  • 레이아웃 쓰래싱(깊은 스택, GeometryReader, preference 체인).
  • 다운샘플링이나 크기 조정 없이 사용되는 대용량 이미지.
  • 과도한 애니메이션 계층 구조(큰 트리에 대한 암시적 애니메이션).

제공:

  • 코드 참조와 함께 예상되는 근본 원인.
  • 제안된 수정 및 리팩터링.
  • 필요한 경우, 최소 재현 코드 또는 계측 제안.

2. 사용자 프로파일링 안내

Instruments로 데이터를 수집하는 방법 설명:

  • SwiftUI 템플릿(Instruments, Release 빌드)을 사용합니다.
  • 정확한 상호작용(스크롤, 탐색, 애니메이션)을 재현합니다.
  • SwiftUI 타임라인과 Time Profiler를 캡처합니다.
  • 관련 레인과 호출 트리를 내보내거나 스크린샷을 찍습니다.

요청:

  • SwiftUI 레인 + Time Profiler 호출 트리의 트레이스 내보내기 또는 스크린샷.
  • 기기/OS/빌드 구성.

3. 분석 및 진단

가능성이 높은 SwiftUI 원인을 우선적으로 확인:

  • 광범위한 상태 변경으로 인한 뷰 무효화 폭풍.
  • 리스트에서 불안정한 식별자(id 변동, 렌더링 시 UUID() 사용).
  • body에서의 무거운 작업(포매팅, 정렬, 이미지 디코딩).
  • 레이아웃 쓰래싱(깊은 스택, GeometryReader, preference 체인).
  • 다운샘플링이나 크기 조정 없이 사용되는 대용량 이미지.
  • 과도한 애니메이션 계층 구조(큰 트리에 대한 암시적 애니메이션).

트레이스/로그에서 얻은 증거를 바탕으로 결과를 요약합니다.

4. 수정

대상별 수정 적용:

  • 상태 범위 좁히기(리프 뷰에 가까운 @State/@Observable).
  • ForEach 및 리스트의 식별자 안정화.
  • body 밖으로 무거운 작업 이동(사전 계산, 캐싱, @State 사용).
  • 비용이 많이 드는 서브트리에 equatable() 또는 값 래퍼 사용.
  • 렌더링 전 이미지 다운샘플링.
  • 레이아웃 복잡도 감소 또는 가능한 경우 고정 크기 사용.

일반적인 코드 스멜 (및 수정)

코드 리뷰 중 다음 패턴을 확인하세요.

body에서 비용이 많이 드는 포매터 사용

var body: some View {
    let number = NumberFormatter() // 느린 할당
    let measure = MeasurementFormatter() // 느린 할당
    Text(measure.string(from: .init(value: meters, unit: .meters)))
}

모델이나 전용 헬퍼에 캐시된 포매터를 사용하는 것이 좋습니다:

final class DistanceFormatter {
    static let shared = DistanceFormatter()
    let number = NumberFormatter()
    let measure = MeasurementFormatter()
}

무거운 작업을 수행하는 연산 프로퍼티

var filtered: [Item] {
    items.filter { $0.isEnabled } // 모든 body 평가 시 실행됨
}

변경 시 미리 계산하거나 캐시하는 것이 좋습니다:

@State private var filtered: [Item] = []
// 입력이 변경될 때 filtered 업데이트

body 또는 ForEach에서 정렬/필터링

List {
    ForEach(items.sorted(by: sortRule)) { item in
        Row(item)
    }
}

뷰 업데이트 전에 한 번 정렬하는 것이 좋습니다:

let sortedItems = items.sorted(by: sortRule)

ForEach에서 인라인 필터링

ForEach(items.filter { $0.isEnabled }) { item in
    Row(item)
}

안정적인 식별자를 가진 사전 필터링된 컬렉션을 사용하는 것이 좋습니다.

불안정한 식별자

ForEach(items, id: \.self) { item in
    Row(item)
}

비안정적인 값에 id: \.self를 사용하지 말고, 안정적인 ID를 사용하세요.

메인 스레드에서 이미지 디코딩

Image(uiImage: UIImage(data: data)!)

메인 스레드 밖에서 디코딩/다운샘플링하고 결과를 저장하는 것이 좋습니다.

관찰 가능한 모델의 광범위한 종속성

@Observable class Model {
    var items: [Item] = []
}

var body: some View {
    Row(isFavorite: model.items.contains(item))
}

업데이트 전파를 줄이기 위해 세분화된 뷰 모델 또는 항목별 상태를 사용하는 것이 좋습니다.

5. 검증

사용자에게 동일한 캡처를 다시 실행하고 기준 메트릭과 비교하도록 요청합니다. 제공된 경우 델타(CPU, 프레임 드롭, 메모리 최대치)를 요약합니다.

출력물

제공:

  • 간단한 메트릭 테이블(가능한 경우 전/후).
  • 주요 이슈(영향도 순서대로 정렬).
  • 예상 작업량과 함께 제안된 수정.

참고 자료

Apple 문서 및 WWDC 리소스는 사용자가 제공하는 대로 references/ 아래에 추가합니다.

  • Instruments로 SwiftUI 성능 최적화: references/optimizing-swiftui-performance-instruments.md
  • SwiftUI 성능 이해 및 개선: references/understanding-improving-swiftui-performance.md
  • 앱에서 멈춤 현상 이해: references/understanding-hangs-in-your-app.md
  • SwiftUI 성능 이해하기 (WWDC23): references/demystify-swiftui-performance-wwdc23.md

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

ComeOnOliver/skillshub

Create stunning, animation-rich HTML presentations from scratch or by converting PowerPoint files. Use when the user wants to build a presentation, convert a PPT/PPTX to web, or create slides for a talk/pitch. Helps non-designers discover their aesthetic through visual exploration rather than abstract choices.

ComeOnOliver/skillshub

Next.js 16+ 和 Turbopack — 增量打包、文件系统缓存、开发速度,以及何时使用 Turbopack 与 webpack。

ComeOnOliver/skillshub

SwiftUI architecture patterns, state management with @Observable, view composition, navigation, performance optimization, and modern iOS/macOS UI best practices.

ComeOnOliver/skillshub

See, Understand, Act on video and audio. See- ingest from local files, URLs, RTSP/live feeds, or live record desktop; return realtime context and playable stream links. Understand- extract frames, build visual/semantic/temporal indexes, and search moments with timestamps and auto-clips. Act- transcode and normalize (codec, fps, resolution, aspect ratio), perform timeline edits (subtitles, text/image overlays, branding, audio overlays, dubbing, translation), generate media assets (image, audio, video), and create real time alerts for events from live streams or desktop capture.

ComeOnOliver/skillshub

AI-assisted video editing workflows for cutting, structuring, and augmenting real footage. Covers the full pipeline from raw capture through FFmpeg, Remotion, ElevenLabs, fal.ai, and final polish in Descript or CapCut. Use when the user wants to edit video, cut footage, create vlogs, or build video content.

ComeOnOliver/skillshub

Next.js 15 애플리케이션을 위한 프론트엔드 개발 가이드라인. React 19, TypeScript, Shadcn/ui, Tailwind CSS를 사용한 모던 패턴. Server Components, Client Components, App Router, 파일 구조, Shadcn/ui 컴포넌트, 성능 최적화, TypeScript 모범 사례 포함. 컴포넌트, 페이지, 기능 생성, 데이터 페칭, 스타일링, 라우팅, 프론트엔드 코드 작업 시 사용.

ComeOnOliver/skillshub

Provides Tamagui patterns for config v4, compiler optimization, styled context, and cross-platform styling. Must use when working with Tamagui projects (tamagui.config.ts, @tamagui imports).

ComeOnOliver/skillshub

Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.

ComeOnOliver/skillshub

Create high-converting, visually distinctive landing pages. Use when building marketing pages, product launches, SaaS homepages, or any single-page conversion-focused website. Guides section-by-section composition with anti-AI-slop principles.

ComeOnOliver/skillshub

Auto-loaded context for Portfolio Buddy 2 development. Use for ANY task involving: React 19 development, TypeScript, portfolio analysis features, metrics calculations, trading strategy comparison, or working with the Portfolio Buddy 2 codebase. Contains tech stack, known issues, and architectural constraints.

ComeOnOliver/skillshub

Next.js development tooling via MCP. Inspect routes, components, build info, and debug Next.js apps. Use when working on Next.js applications, debugging routing, or inspecting app structure. NOT for general React or non-Next.js projects.

ComeOnOliver/skillshub

Implement UI using Shadcn MCP (atoms/theme) and 21st.dev MCP (complex sections). Use when adding buttons, layouts, or generating landing pages.

ComeOnOliver/skillshub

A conceptual skill for building an API client in Next.js that handles JWT tokens

ComeOnOliver/skillshub

Best practices and patterns for Next.js App Router, Server Actions, and Routing in this project.

ComeOnOliver/skillshub

The Design System, Theme, and UX rules for the Physical AI Hub.

ComeOnOliver/skillshub

Comprehensive frontend development skill for building modern, performant web applications using ReactJS, NextJS, TypeScript, Tailwind CSS. Includes component scaffolding, performance optimization, bundle analysis, and UI best practices. Use when developing frontend features, optimizing performance, implementing UI/UX designs, managing state, or reviewing frontend code.

ComeOnOliver/skillshub

This document captures learnings from fixing keyboard navigation issues when floating components (Select, DropdownMenu, Popover) have CSS open/close animations.

ComeOnOliver/skillshub

Build Next.js 16 applications with correct patterns and distinctive design. Use when creating pages, layouts, dynamic routes, upgrading from Next.js 15, or implementing proxy.ts. Covers breaking changes (async params/searchParams, Turbopack, cacheComponents) and frontend aesthetics. NOT when building non-React or backend-only applications.

ComeOnOliver/skillshub

Comprehensive Framer Motion animation library for React. Covers motion components, variants, gestures, page transitions, and scroll animations. Use when adding animations to React/Next.js applications.

ComeOnOliver/skillshub

Build interfaces that resonate, not just render. This skill enforces bold, intentional

관련 스킬