SSkilltecabyclaudinhocode
Enviar skill
← Voltar para o catálogo

swift-uikit-skill

Design e Frontend

Build, review, and improve programmatic UIKit applications following proven patterns for Auto Layout, table views, collection views, navigation, animation, Core Data, networking, and architecture. Use when writing new UIKit features, refactoring existing view controllers, reviewing UIKit code quality, building custom controls, or implementing common iOS design patterns like load-and-retry, onboard

1estrelas
Ver no GitHub ↗Autor: nizhan80-artLicença: MIT

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

Como adicionar

/plugin marketplace add nizhan80-art/Swift-UIKit-Skill

O comando exato pode variar conforme o repositório. Confira o README no GitHub.

Comentários · Nenhum comentário

Entre para comentar. Entrar

  • Ainda não há comentários. Seja o primeiro.