मुख्य सामग्री पर जाएँ
Skillpedia
वेबसाइट और UI (frontend)48k · #5914

swiftui-ui-patterns

यह क्या करती है

यह गाइड SwiftUI से बने ऐप्स का कोड व्यवस्थित करने में मदद करती है। यह दिखाती है कि स्क्रीनों के बीच नेविगेशन कैसे मैनेज करें, extra विंडो (sheets) कैसे दिखाएँ, लोड होने में समय लेने वाले कामों को कैसे सँभालें, और बार-बार इस्तेमाल होने वाले UI हिस्से कैसे बनाएँ।

कब इस्तेमाल करें

  • ✓जब SwiftUI ऐप की नई स्क्रीन या हिस्से बनाने हों।
  • ✓जब यह व्यवस्थित करना हो कि यूज़र स्क्रीनों के बीच कैसे जाए।
  • ✓जब ऐसे UI components बनाने हों जो कई जगह इस्तेमाल हो सकें।

Skill का लिंक

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 में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।

पेस्ट करने के लिए तैयार मैसेज

इस skill से मेरी मदद करो: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/swiftui-ui-patterns/SKILL.md इस लिंक की SKILL.md फ़ाइल पढ़ो और मेरे काम में उसके निर्देशों का पालन करो।
क्या आप चाहते हैं कि आपका AI ऐसी skills खुद ढूँढे?मुफ़्त Skillpedia MCP इंस्टॉल करें: बस एक लाइन, और हर काम से पहले यह 15,000+ skills में खोजता है।1 मिनट में इंस्टॉल करें →

AI से क्या माँगें: उदाहरण

“SwiftUI में अपनी स्क्रीनों के बीच नेविगेशन को कैसे व्यवस्थित करूँ?”

हर हफ़्ते 5 नई skills, 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' का क्या मतलब है?

इसका मतलब है ऐसे कामों को सँभालना जिन्हें पूरा होने में समय लगता है, जैसे इंटरनेट से डेटा लाना, loading indicator दिखाना, और संभावित errors को सँभालना।

क्या इसे पुराने प्रोजेक्ट्स में इस्तेमाल कर सकते हैं?

हाँ, गाइड पुराने SwiftUI वर्ज़न के लिए विकल्प देती है, लेकिन जब संभव हो तो नवीनतम टूल्स इस्तेमाल करने की सलाह देती है।

जानकारी

लेखक का मूल विवरण

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

repo: sickn33/agentic-awesome-skills

लोकप्रियता

GitHub स्टार
48k
रैंकिंग में स्थान
#5914
लाइसेंस
MIT
अपडेट की गई
15/10/2026

क्या यह skill काम की है?

0

लॉग इन करें वोट करने के लिए।

कमेंट

  • …

इस repository की और skills

00-andruia-consultant

48k

आपके एजेंट को AI प्रोजेक्ट शुरू करने या उन्हें बेहतर बनाने में मदद करता है। यह code का विश्लेषण करता है, tools सुझाता है और स्पेनिश भाषा में action plan बनाता है।

AI और एजेंटएजेंट

007

48k

आपका एजेंट security audit और threat modeling करता है। यह प्रोजेक्ट को हमलों और कमजोरियों से बचाने में काम आता है।

कोडिंगसिक्योरिटी

10-andruia-skill-smith

48k

आपके एजेंट को AI tools बनाने या उन्हें बेहतर करने में मदद करता है। यह तय करता है कि tools कैसे काम करेंगे, documentation लिखता है और structure की जांच करता है।

AI और एजेंटएजेंट

20-andruia-niche-intelligence

48k

आपका एजेंट किसी खास industry का summary बनाता है। भरोसेमंद स्रोतों की मदद से यह प्रोजेक्ट का संदर्भ, नियम, इस्तेमाल के तरीके और जोखिम समझने में मदद करता है।

लेखन और डॉक्यूमेंटरिसर्च

मिलती-जुलती skills