Skip to content

Add SwiftUI best practices from SwiftLee articles analysis#27

Merged
AvdLee merged 3 commits intomainfrom
swiftlee-articles-optimization
Feb 27, 2026
Merged

Add SwiftUI best practices from SwiftLee articles analysis#27
AvdLee merged 3 commits intomainfrom
swiftlee-articles-optimization

Conversation

@AvdLee
Copy link
Owner

@AvdLee AvdLee commented Feb 27, 2026

Summary

Analyzed 55+ SwiftLee articles across the SwiftUI and Swift categories to extract still-relevant, non-opinionated SwiftUI best practices and add them to the skill. Only content that is SwiftUI-specific and factual (not architectural opinions) was included.

Changes

  • New file: references/accessibility-patterns.md -- traits, grouping, @ScaledMetric, Dynamic Type, VoiceOver patterns
  • Updated: state-management.md -- @Entry macro, @State with @Observable ownership
  • Updated: performance-patterns.md -- Self._logChanges() alongside _printChanges
  • Updated: image-optimization.md -- UIImage(named:) caching behavior, NSCache pattern
  • Updated: list-patterns.md -- Identifiable pitfalls, ContentUnavailableView, .scrollContentBackground
  • Updated: view-structure.md -- conditional modifier identity, ViewModifier/ButtonStyle, redacted views, UIViewRepresentable, static member lookup
  • Updated: sheet-navigation-patterns.md -- enum-based sheet management
  • Updated: SKILL.md -- accessibility in decision tree, core guidelines, and review checklist
  • Updated: README.md -- SwiftLee articles attribution

Articles providing value (traceability)

Article What was extracted Target file
Accessibility in SwiftUI Traits, grouping, adjustable actions, containers accessibility-patterns.md
VoiceOver navigation Navigation grouping, labeling patterns accessibility-patterns.md
@ScaledMetric Dynamic Type @ScaledMetric property wrapper for accessibility accessibility-patterns.md
@Entry macro Modern environment value definition state-management.md
@Observable Macro @State importance with @observable, @bindable usage state-management.md
Debugging SwiftUI views Self._logChanges() (Xcode 15.1+) performance-patterns.md
Memory consumption UIImage UIImage(named:) caching vs UIImage(contentsOfFile:) image-optimization.md
Identifiable protocol Non-unique ID pitfalls list-patterns.md
ContentUnavailableView Empty state handling (iOS 17+) list-patterns.md
Conditional View Modifier if-based modifier impacts on view identity view-structure.md
View Composition ViewModifiers ViewModifier protocol for reusable styling view-structure.md
Redacted View Modifier Skeleton loading pattern view-structure.md
SwiftUI Button styles Prefer Button over tap gestures; custom ButtonStyle view-structure.md
UIViewRepresentable UIKit bridging lifecycle essentials view-structure.md
Sheets in SwiftUI Enum-based sheet patterns, DismissAction sheet-navigation-patterns.md
SwiftUI Lists .scrollContentBackground(.hidden) for custom backgrounds list-patterns.md
Static Member Lookup Discoverability pattern for custom SwiftUI styles view-structure.md

Test plan

  • Verify all reference files render correctly in markdown
  • Confirm SKILL.md references point to correct file paths
  • Review new accessibility-patterns.md for completeness
  • Verify README skill structure matches actual file listing

AvdLee and others added 2 commits February 27, 2026 11:49
Analyzed 55+ SwiftLee articles across SwiftUI and Swift categories to
extract still-relevant, non-opinionated best practices. Changes:

- New accessibility-patterns.md reference (traits, grouping, @ScaledMetric, Dynamic Type)
- state-management.md: @entry macro, @State with @observable ownership
- performance-patterns.md: Self._logChanges() alongside _printChanges
- image-optimization.md: UIImage caching behavior, NSCache pattern
- list-patterns.md: Identifiable pitfalls, ContentUnavailableView, scrollContentBackground
- view-structure.md: conditional modifier identity, ViewModifier/ButtonStyle, redacted, UIViewRepresentable, static member lookup
- sheet-navigation-patterns.md: enum-based sheet management
- SKILL.md: accessibility in decision tree, core guidelines, review checklist
- README.md: SwiftLee articles attribution
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0cedc1ce79

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds SwiftUI best practices extracted from 55+ SwiftLee articles, focusing on accessibility, state management, view composition, performance debugging, and image optimization. The additions are factual, non-opinionated, and align with the repository's Agent Skills format and SwiftUI-focused scope.

Changes:

  • New accessibility-patterns.md reference covering Dynamic Type, VoiceOver, traits, and grouping
  • Enhanced state-management.md with @Entry macro and @State+@observable ownership guidance
  • Improved performance-patterns.md with Self._logChanges() debugging helper
  • Expanded view-structure.md with ViewModifier/ButtonStyle patterns, redacted views, and UIViewRepresentable essentials
  • Updated sheet-navigation-patterns.md with enum-based sheet management pattern
  • Enhanced list-patterns.md with ID uniqueness pitfalls, ContentUnavailableView, and custom backgrounds
  • Expanded image-optimization.md with UIImage loading strategies and NSCache patterns
  • Updated SKILL.md to integrate accessibility guidance across workflows
  • Added SwiftLee attribution to README.md

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
swiftui-expert-skill/SKILL.md Integrated accessibility patterns into decision tree, core guidelines, and review checklist; updated _logChanges reference
swiftui-expert-skill/references/accessibility-patterns.md New file covering @ScaledMetric, traits, grouping patterns, and custom controls
swiftui-expert-skill/references/state-management.md Added @Entry macro pattern and critical @State+@observable ownership guidance
swiftui-expert-skill/references/performance-patterns.md Added Self._logChanges() alongside _printChanges with usage guidance
swiftui-expert-skill/references/view-structure.md Added conditional modifier identity pitfall, ViewModifier/ButtonStyle patterns, redacted views, UIViewRepresentable lifecycle, and static member lookup
swiftui-expert-skill/references/sheet-navigation-patterns.md Added enum-based sheet management pattern with Identifiable conformance
swiftui-expert-skill/references/list-patterns.md Added ID uniqueness pitfalls, ContentUnavailableView (iOS 17+), and scrollContentBackground for custom backgrounds
swiftui-expert-skill/references/image-optimization.md Added UIImage(named:) vs contentsOfFile guidance and NSCache pattern for bounded memory
README.md Added SwiftLee articles attribution and accessibility-patterns.md to skill structure listing

- Replace VoiceOver testing directive with implementation-focused checklist item
- Strip LLDB/Xcode-console references from _printChanges/_logChanges docs
@EngOmarElsayed
Copy link
Collaborator

Amazing work man ❤️

@AvdLee AvdLee merged commit a3a9724 into main Feb 27, 2026
1 check passed
@AvdLee AvdLee deleted the swiftlee-articles-optimization branch February 27, 2026 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants