본문으로 건너뛰기
Skillpedia
웹사이트 및 UI (프런트엔드)48k · #5914

swiftui-ui-patterns

하는 일

이 가이드는 SwiftUI로 만든 앱의 코드를 정리하는 방법을 알려 줍니다. 화면 사이의 내비게이션을 관리하고, 추가 창(시트)을 띄우고, 로드에 시간이 걸리는 작업을 처리하며, 재사용 가능한 인터페이스 부품을 만드는 방법을 보여 줍니다.

사용하는 경우

  • ✓SwiftUI 앱의 새 화면이나 부분을 만들 때.
  • ✓사용자가 화면 사이를 이동하는 방식을 정리해야 할 때.
  • ✓여러 곳에서 쓸 수 있는 인터페이스 구성 요소를 만들고 싶은 경우.

스킬 링크

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/swiftui-ui-patterns/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/swiftui-ui-patterns/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“SwiftUI에서 화면 사이의 내비게이션을 어떻게 정리할 수 있나요?”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

이 가이드는 SwiftUI의 구성 도구, 예를 들어 @State와 @Binding을 사용하는 예시와 규칙을 제공합니다. 유지보수와 가독성을 높이도록 코드를 구조화하는 방법을 제안합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

SwiftUI UI Patterns

Quick start

When to Use

  • When creating or refactoring SwiftUI screens, flows, or reusable UI components.
  • When you need guidance on navigation, sheets, async state, previews, or component patterns.

Choose a track based on your goal:

Existing project

  • Identify the feature or screen and the primary interaction model (list, detail, editor, settings, tabbed).
  • Find a nearby example in the repo with rg "TabView\(" or similar, then read the closest SwiftUI view.
  • Apply local conventions: prefer SwiftUI-native state, keep state local when possible, and use environment injection for shared dependencies.
  • Choose the relevant component reference from references/components-index.md and follow its guidance.
  • If the interaction reveals secondary content by dragging or scrolling the primary content away, read references/scroll-reveal.md before implementing gestures manually.
  • Build the view with small, focused subviews and SwiftUI-native data flow.

New project scaffolding

  • Start with references/app-wiring.md to wire TabView + NavigationStack + sheets.
  • Add a minimal AppTab and RouterPath based on the provided skeletons.
  • Choose the next component reference based on the UI you need first (TabView, NavigationStack, Sheets).
  • Expand the route and sheet enums as new screens are added.

Example prerequisites

The references contain application sketches, not a complete app. Supply the named project views, models, adapters and theme tokens; verify imports, actual error contracts and minimum OS with the installed SDK before adapting them. Bind every visible action to a real tested handler, make persistence failures observable and use inert preview data. A successful code example is not evidence of a tested screen or deployed service.

General rules to follow

  • Use modern SwiftUI state (@State, @Binding, @Observable, @Environment) and avoid unnecessary view models.
  • If the deployment target includes iOS 16 or earlier and cannot use the Observation API introduced in iOS 17, fall back to ObservableObject with @StateObject for root ownership, @ObservedObject for injected observation, and @EnvironmentObject only for truly shared app-level state.
  • Prefer composition; keep views small and focused.
  • Use async/await with .task and explicit loading/error states. For restart, cancellation, and debouncing guidance, read references/async-state.md.
  • Keep shared app services in @Environment, but prefer explicit initializer injection for feature-local dependencies and models. For root wiring patterns, read references/app-wiring.md.
  • Prefer the newest SwiftUI API that fits the deployment target and call out the minimum OS whenever a pattern depends on it.
  • Maintain existing legacy patterns only when editing legacy files.
  • Follow the project's formatter and style guide.
  • Sheets: Prefer .sheet(item:) over .sheet(isPresented:) when state represents a selected model. Avoid if let inside a sheet body. Sheets should own their actions and call dismiss() internally instead of forwarding onCancel/onConfirm closures.
  • Scroll-driven reveals: Prefer deriving a normalized progress value from scroll offset and driving the visual state from that single source of truth. Avoid parallel gesture state machines unless scroll alone cannot express the interaction.

State ownership summary

Use the narrowest state tool that matches the ownership model:

Scenario Preferred pattern
Local UI state owned by one view @State
Child mutates parent-owned value state @Binding
Root-owned reference model on iOS 17+ @State with an @Observable type
Child reads or mutates an injected @Observable model on iOS 17+ Pass it explicitly as a stored property
Shared app service or configuration @Environment(Type.self)
Legacy reference model on iOS 16 and earlier @StateObject at the root, @ObservedObject when injected

Choose the ownership location first, then pick the wrapper. Do not introduce a reference model when plain value state is enough.

Cross-cutting references

  • references/navigationstack.md: navigation ownership, per-tab history, and enum routing.
  • references/sheets.md: centralized modal presentation and enum-driven sheets.
  • references/deeplinks.md: URL handling and routing external links into app destinations.

…

자주 묻는 질문

'시트(sheets)'란 무엇인가요?

현재 화면 위에 나타나는 더 작은 창입니다. 현재 화면을 벗어나지 않고 양식을 작성하거나 세부 정보를 보여 주는 등 간단한 작업에 쓰입니다.

'비동기 상태(async state)'는 무엇을 뜻하나요?

인터넷에서 데이터를 가져오는 것처럼 완료에 시간이 걸리는 작업을 처리하는 방법을 뜻합니다. 로딩 표시를 보여 주고 발생할 수 있는 오류를 다룹니다.

이전 프로젝트에서도 쓸 수 있나요?

네, 가이드는 이전 SwiftUI 버전을 위한 대안도 제공하지만, 가능하면 최신 도구를 사용하는 것을 권장합니다.

상세 정보

작성자의 원본 설명

Apply proven SwiftUI UI patterns for navigation, sheets, async state, and reusable screens.

repo: sickn33/agentic-awesome-skills

인기도

GitHub 스타
48k
순위
#5914
라이선스
MIT
업데이트
2026. 10. 15.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬