BeClaude

Swift-UIKit-Skill

New
1GitHubGeneralby nizhan80-art

Build programmatic UIKit apps with production-ready patterns for views, navigation, animation, architecture, and data flow

First seen 5/28/2026

Overview

Swift UIKit Skill

Operating Rules

  • All UI is built programmatically (no Storyboards). Always set translatesAutoresizingMaskIntoConstraints = false.
  • Prefer NSLayoutConstraint.activate([...]) for batch constraint activation.
  • Organize view controller code with extensions: separate style(), layout(), and protocol conformances.
  • Use factory functions for repetitive UI element creation.
  • Use weak references for delegates and [weak self] in closures to prevent retain cycles.
  • Prefer Result<Success, Error> for async completion handlers.
  • Always dispatch UI updates to the main thread from async callbacks.
  • Extract custom views flush to their container; parent manages spacing.
  • Use child view controllers for complex, self-contained screen sections.
  • Consult relevant reference files before implementing any topic.

Task Workflow

Review existing UIKit code

  • Read the code under review and identify which topics apply
  • Run the Topic Router below for each relevant topic
  • Check for retain cycles (missing weak delegates, missing [weak self])
  • Verify Auto Layout completeness (unambiguous constraints, no warnings)
  • Flag deprecated patterns (e.g., manual beginUpdates/endUpdates when Diffable is available)

Improve existing UIKit code

  • Audit current implementation against the Topic Router topics
  • Extract large view controllers into child VCs and custom views
  • Replace inline UI creation with factory functions
  • Migrate legacy table/collection view data sources to Diffable where appropriate
  • Add proper error handling with Result types

Implement new UIKit feature

  • Design data flow first: identify service, view model, view controller, and view layers
  • Structure views for composition (extracted views + child view controllers)
  • Apply correct animation patterns (constraint-based, Core Animation, or UIView)
  • Use protocol-delegate for sustained relationships; closures for one-shot callbacks
  • Add proper loading/error states

Topic Router

Consult the reference file for each topic relevant to the current task:

TopicReference
UITableViewreferences/uitableview.md
UICollectionViewreferences/uicollectionview.md
UINavigationControllerreferences/uinavigationcontroller.md
UIScrollViewreferences/uiscrollview.md
Core Animationreferences/core-animation.md
Core Graphicsreferences/core-graphics.md
Auto Layout animationreferences/auto-layout-animation.md
Communication patternsreferences/communication-patterns.md
Architecture patternsreferences/architecture-patterns.md
View extractionreferences/view-extraction.md
Navigation patternsreferences/navigation-patterns.md
Design patterns (UI)references/design-patterns.md
Networkingreferences/networking.md
Factory functionsreferences/factory-patterns.md
Nib / XIB patternsreferences/nib-patterns.md
NSAttributedStringreferences/nsattributedstring.md
Gesture recognizersreferences/gesture-recognizers.md
Custom controlsreferences/custom-controls.md
Currency formattingreferences/currency-formatting.md
Deep linkingreferences/deep-linking.md

Correctness Checklist

These are hard rules -- violations are always bugs:

  • [ ] Every programmatic view sets translatesAutoresizingMaskIntoConstraints = false
  • [ ] Delegates are declared weak var delegate: SomeDelegate?
  • [ ] Async closures capture [weak self] when referencing the owning object
  • [ ] UI updates from async callbacks are dispatched to DispatchQueue.main
  • [ ] beginUpdates() / endUpdates() bracket all batch table view mutations
  • [ ] Diffable data source items conform to Hashable with stable identifiers
  • [ ] Child view controllers follow the 3-step lifecycle: addChild(), addSubview(), didMove(toParent:)
  • [ ] Custom views define intrinsicContentSize when they have a natural size
  • [ ] NSFetchedResultsController delegate implements all three callbacks (willChange, didChange, didChangeContent)
  • [ ] Core Animation model layer is updated after animation to persist final state
  • [ ] NSLayoutConstraint.activate() is used instead of isActive = true one-by-one
  • [ ] Factory functions return views with translatesAutoresizingMaskIntoConstraints already set to false

Quick Diagnostics

SymptomLikely causeReference
View doesn't appearMissing translatesAutoresizingMaskIntoConstraints = falsereferences/view-extraction.md
Table view crashes on insertData source count mismatch with beginUpdatesreferences/uitableview.md
Animation snaps to final stateModel layer not updated after CA animationreferences/core-animation.md
Retain cycle / memory leakMissing weak on delegate or [weak self]references/communication-patterns.md
Scroll view doesn't scrollMissing content size or broken constraint chainreferences/uiscrollview.md
Shadow clipped by viewmasksToBounds = true on layerreferences/core-animation.md
Gradient/shadow wrong sizeSet bounds-dependent layers in viewDidAppearreferences/core-animation.md
Collection view emptyForgot to register cell or data source nilreferences/uicollectionview.md
Core Data threading crashAccessing managed object on wrong queuereferences/networking.md
Navigation bar title missingNot setting title or navigationItem.titlereferences/uinavigationcontroller.md

Install & Usage

1
Create the skills directory
mkdir -p .claude/skills
2
Download the skill file
mkdir -p .claude/skills && curl -o .claude/skills/swift-uikit-skill.md https://raw.githubusercontent.com/nizhan80-art/Swift-UIKit-Skill/main/SKILL.md
3
Invoke in Claude Code
/swift-uikit-skill
View source on GitHub

Security Audits

LicenseUnknownSourceWarnRepositoryPass

Frequently Asked Questions

What is Swift-UIKit-Skill?

Build programmatic UIKit apps with production-ready patterns for views, navigation, animation, architecture, and data flow

How to install Swift-UIKit-Skill?

To install Swift-UIKit-Skill: create the skills directory (mkdir -p .claude/skills), then run: mkdir -p .claude/skills && curl -o .claude/skills/swift-uikit-skill.md https://raw.githubusercontent.com/nizhan80-art/Swift-UIKit-Skill/main/SKILL.md. Finally, /swift-uikit-skill in Claude Code.

What is Swift-UIKit-Skill best for?

Swift-UIKit-Skill is a skill categorized under General. Created by nizhan80-art.