swiftui
Skill15 starsChanged 43 days agoMITView on GitHub
Expert SwiftUI assistance covering declarative iOS/macOS layouts, @Observable / ObservableObject state propagation, view modifiers, custom animations, and NavigationStack. Use when creating modern Apple platform user interfaces, widgets, and multi-platform apps.
10 other projects use a version of this.
Adopted by
Most recently taken up by
- turkeryildirim/ai-skillstheir own version, first seen Nov 1, 2026
- sreejithraman/SreeStacktheir own version, first seen Oct 27, 2026
- g-cqd/skillstheir own version, first seen Oct 23, 2026
- caglarbaranbora/Apple-Agent-Kittheir own version, first seen Oct 13, 2026
- FradSer/skillstheir own version, first seen Oct 13, 2026
- 31Carlton7/skillstheir own version, first seen Oct 8, 2026
Other versions10 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 10
- Prisma-Labs-Dev/apple-skills★ 336same name
- FradSer/skills★ 4same name
- moasq/ios-dev-agent★ 4same name
- turkeryildirim/ai-skills★ 4same name
- 31Carlton7/skills★ 2same name
- g-cqd/skills★ 2same name
- caglarbaranbora/Apple-Agent-Kit★ 1same name
- sreejithraman/SreeStack★ 1same name
- Chaeguevara/Skills★ 0same name
- Fe2-O3/swift-field-guide★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository350 other files it gives its agents.
- airflowSkill
- catboostSkill
- claudeSkill
- comfyuiSkill
- cursor-aiSkill
- dalleSkill
- daskSkill
- dbtSkill
- deepseekSkill
- fastaiSkill
- geminiSkill
- github-copilotSkill
- huggingfaceSkill
- jaxSkill
- jupyterSkill
- kerasSkill
- langchainSkill
- lightgbmSkill
- llamaindexSkill
- llamaSkill
- matplotlibSkill
- midjourneySkill
- mistralSkill
- mlflowSkill
- nltkSkill
- numpySkill
- ollamaSkill
- openai-gptSkill
- opencvSkill
- pandasSkill
- perplexitySkill
- plotlySkill
- polarsSkill
- pytorchSkill
- raySkill
- scikit-learnSkill
- seabornSkill
- spacySkill
- sparkSkill
- stable-diffusionSkill
- tensorflowSkill
- vaexSkill
- weights-biasesSkill
- whisperSkill
- xgboostSkill
- api-gatewaySkill
- clean-architectureSkill
- cqrsSkill
- domain-driven-designSkill
- event-drivenSkill
- event-sourcingSkill
- graphqlSkill
- grpcSkill
- hexagonalSkill
- microservicesSkill
- modular-monolithSkill
- monolithSkill
- rest-apiSkill
- sagaSkill
- serverlessSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
1 rule. 0 are common, 0 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 9 edited versions we read keep these.
0
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 169
Use path-based NavigationStack with .navigationDestination(for:) to separate navigation state from UI buttons:
“Common” is measured: kept by at least 6 in 10 of the 9 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
SwiftUI
SwiftUI is Apple's declarative framework for building user interfaces across all Apple platforms (iOS, macOS, watchOS, tvOS, visionOS) with the power of Swift.
When to Use
- Modern Apple Platform Apps: Building user interfaces for iOS, iPadOS, macOS, watchOS, and visionOS from a unified declarative syntax.
- State-Driven Interactive Interfaces: Creating fluid, animated user experiences using
@Observable, Swift 6 concurrency, and@State. - Dynamic Layout Adaptability: Designing views that adapt smoothly to Dynamic Type, Dark Mode, and diverse Apple device form factors.
- Interactive Widgets & Live Activities: Implementing Lock Screen widgets, Home Screen widgets, and Dynamic Island activities.
Quick Start
import SwiftUI
@main
struct MyApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
// Observation Framework (iOS 17+)
@Observable
class UserSettings {
var username = "Guest"
var isLoggedIn = false
}
struct ContentView: View {
@State private var settings = UserSettings()
var body: some View {
NavigationStack {
VStack(spacing: 20) {
Text("Hello, \(settings.username)!")
.font(.largeTitle)
Button("Log In") {
settings.username = "User"
settings.isLoggedIn = true
}
.buttonStyle(.borderedProminent)
NavigationLink("Settings", value: "settings")
}
.navigationDestination(for: String.self) { path in
if path == "settings" {
Text("Settings Page")
}
}
}
}
}Core Concepts
Modern @Observable Architecture (iOS 17+)
Replaces legacy ObservableObject and @Published with compiler-macro observations, tracking only properties actually read in the view:
import SwiftUI
import Observation
@Observable
final class WalletViewModel {
var balance: Double = 1420.50
var isRefreshing: Bool = false
func loadBalance() async {
isRefreshing = true
defer { isRefreshing = false }
// Async network fetch
try? await Task.sleep(nanoseconds: 500_000_000)
balance += 50.0
}
}
struct WalletView: View {
@State private var viewModel = WalletViewModel()
var body: some View {
VStack(spacing: 12) {
Text("Available Balance")
.font(.subheadline)
.foregroundStyle(.secondary)
Text(viewModel.balance, format: .currency(code: "USD"))
.font(.system(size: 34, weight: .bold))
Button("Add Funds") {
Task { await viewModel.loadBalance() }
}
.buttonStyle(.borderedProminent)
}
.padding()
}
}Declarative View Modifiers & Composition
Modifiers return new view structures, composing functionality through ordered transformations:
struct PrimaryButtonModifier: ViewModifier {
func body(content: Content) -> some View {
content
.font(.headline)
.foregroundStyle(.white)
.frame(maxWidth: .infinity)
.padding()
.background(Color.indigo, in: RoundedRectangle(cornerRadius: 14))
.shadow(color: .indigo.opacity(0.3), radius: 8, y: 4)
}
}
extension View {
func primaryButtonStyle() -> some View {
modifier(PrimaryButtonModifier())
}
}NavigationStack & Value-Based Routing
Modern type-safe navigation using NavigationStack and navigationDestination:
enum AppRoute: Hashable {
case orderDetail(id: String)
case settings
}
struct MainCoordinator: View {
@State private var path: [AppRoute] = []
var body: some View {
NavigationStack(path: $path) {
List {
Button("View Order #415") { path.append(.orderDetail(id: "415")) }
}
.navigationDestination(for: AppRoute.self) { route in
switch route {
case .orderDetail(let id): Text("Order Detail: \(id)")
case .settings: Text("App Settings")
}
}
}
}
}Common Patterns
Decoupled Path-Based NavigationStack
Problem: Deprecated NavigationView tightly coupling view presentation logic to UI controls.
Solution:
Use path-based NavigationStack with .navigationDestination(for:) to separate navigation state from UI buttons:
NavigationStack(path: $router.path) {
UserListView()
.navigationDestination(for: Route.self) { route in
router.view(for: route)
}
}MVVM with Observation
Problem: Over-invalidating view hierarchies and boilerplate publisher subscriptions in stateful SwiftUI screens.
Solution:
@Observable
class ProfileViewModel {
var profile: Profile?
var isLoading = false
@MainActor
func loadProfile(userId: String) async {
isLoading = true
defer { isLoading = false }
profile = try? await UserService.fetch(id: userId)
}
}Best Practices
Do:
- Adopt Swift 6 Strict Concurrency: Ensure all view models and background tasks conform to
@MainActorand Sendable protocols. - Decompose Large Views into Subviews: Break body properties into discrete subviews to allow SwiftUI to localize re-evaluations.
- Leverage Standard Semantic Colors: Use
.foregroundStyle(.primary)and.background(.background)to support Light and Dark modes automatically. - Provide View Previews with Static Mock Data: Utilize
#Previewmacro with sample models for instant canvas rendering.
Don't:
- Store non-transient state in
@State:@Stateis for view-owned local state; domain business models belong in observable ViewModels. - Block the main actor with heavy computations: Move image processing and JSON decoding to non-isolated background actor tasks.
- Overuse
AnyView: Type-erasure prevents SwiftUI from performing structural diffing optimizations; use@ViewBuilderinstead.
Troubleshooting
| Error | Cause | Solution |
Type '...' does not conform to protocol 'View' | The body property is missing or doesn't return some View. | Ensure var body: some View returns a valid view hierarchy. |
Modifying state during view update | Changing @State directly inside the body calculation. | Move side effects to .onAppear or buttons/actions. |
Trailing closure passed to parameter of type... | Syntax error in view builder structure. | Check braces {} and modifier placement. |
References
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

