Marketplace
swiftui-patterns
Master SwiftUI with declarative UI, state management, custom views, animations, and modern iOS development patterns.
$ Installer
git clone https://github.com/spjoshis/claude-code-plugins /tmp/claude-code-plugins && cp -r /tmp/claude-code-plugins/plugins/swift-development/skills/swiftui-patterns ~/.claude/skills/claude-code-plugins// tip: Run this command in your terminal to install the skill
SKILL.md
name: swiftui-patterns description: Master SwiftUI with declarative UI, state management, custom views, animations, and modern iOS development patterns.
SwiftUI Patterns
Build modern iOS apps with SwiftUI's declarative syntax, state management, and reactive patterns.
Core Patterns
Basic View
struct ContentView: View {
@State private var count = 0
var body: some View {
VStack {
Text("Count: \(count)")
.font(.largeTitle)
Button("Increment") {
count += 1
}
.buttonStyle(.borderedProminent)
}
.padding()
}
}
ObservableObject
class UserViewModel: ObservableObject {
@Published var users: [User] = []
@Published var isLoading = false
func fetchUsers() async {
isLoading = true
defer { isLoading = false }
do {
users = try await UserService.fetchUsers()
} catch {
print("Error: \(error)")
}
}
}
struct UserListView: View {
@StateObject private var viewModel = UserViewModel()
var body: some View {
List(viewModel.users) { user in
Text(user.name)
}
.task {
await viewModel.fetchUsers()
}
}
}
Custom ViewModifier
struct CardModifier: ViewModifier {
func body(content: Content) -> some View {
content
.padding()
.background(Color.white)
.cornerRadius(10)
.shadow(radius: 5)
}
}
extension View {
func cardStyle() -> some View {
modifier(CardModifier())
}
}
Best Practices
- Use @State for local view state
- Use @StateObject for view models
- Use @ObservedObject for passed objects
- Leverage SwiftUI previews
- Extract reusable components
- Use proper property wrappers
- Implement accessibility
Resources
Repository

spjoshis
Author
spjoshis/claude-code-plugins/plugins/swift-development/skills/swiftui-patterns
1
Stars
0
Forks
Updated3d ago
Added1w ago