From swift-guardian
Guides advanced SwiftUI animations, transitions, matched geometry effects, and Metal shader integration for iOS/macOS apps.
How this skill is triggered — by the user, by Claude, or both
Slash command
/swift-guardian:swiftui-animationThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Expert guidance for implementing advanced SwiftUI animations and Metal shader integration. Covers animation curves, springs, transitions, matched geometry effects, PhaseAnimator, KeyframeAnimator, and GPU-accelerated shader effects.
Expert guidance for implementing advanced SwiftUI animations and Metal shader integration. Covers animation curves, springs, transitions, matched geometry effects, PhaseAnimator, KeyframeAnimator, and GPU-accelerated shader effects.
// Explicit animation (preferred)
withAnimation(.spring(response: 0.4, dampingFraction: 0.75)) {
isExpanded.toggle()
}
// iOS 17+ spring presets
withAnimation(.snappy) { ... } // Fast, small bounce
withAnimation(.smooth) { ... } // Gentle, no bounce
withAnimation(.bouncy) { ... } // More bounce
// Basic
.transition(.opacity)
.transition(.scale)
.transition(.slide)
.transition(.move(edge: .bottom))
// Combined
.transition(.move(edge: .trailing).combined(with: .opacity))
// Asymmetric
.transition(.asymmetric(
insertion: .move(edge: .bottom),
removal: .opacity
))
@Namespace var namespace
// Source view
ThumbnailView()
.matchedGeometryEffect(id: "hero", in: namespace)
// Destination view
DetailView()
.matchedGeometryEffect(id: "hero", in: namespace)
// Color manipulation
.colorEffect(ShaderLibrary.invert())
// Pixel displacement
.distortionEffect(
ShaderLibrary.wave(.float(time)),
maxSampleOffset: CGSize(width: 20, height: 20)
)
// Full layer access
.layerEffect(ShaderLibrary.blur(.float(radius)), maxSampleOffset: .zero)
Detailed documentation is available in references/:
motion-guidelines.md - HIG Motion design principles
animations.md - Complete animation API guide
transitions.md - View transition guide
metal-shaders.md - GPU shader integration
struct ExpandableCard: View {
@State private var isExpanded = false
var body: some View {
VStack {
RoundedRectangle(cornerRadius: isExpanded ? 20 : 12)
.fill(.blue)
.frame(
width: isExpanded ? 300 : 150,
height: isExpanded ? 400 : 100
)
}
.onTapGesture {
withAnimation(.spring(response: 0.35, dampingFraction: 0.75)) {
isExpanded.toggle()
}
}
}
}
ForEach(Array(items.enumerated()), id: \.element.id) { index, item in
ItemRow(item: item)
.transition(.asymmetric(
insertion: .move(edge: .trailing).combined(with: .opacity),
removal: .move(edge: .leading).combined(with: .opacity)
))
.animation(.spring().delay(Double(index) * 0.05), value: items)
}
Circle()
.fill(.blue)
.frame(width: 20, height: 20)
.scaleEffect(isPulsing ? 1.2 : 1.0)
.opacity(isPulsing ? 0.6 : 1.0)
.onAppear {
withAnimation(.easeInOut(duration: 1.0).repeatForever(autoreverses: true)) {
isPulsing = true
}
}
withAnimation over .animation() modifier for clarity.spring(response: 0.35, dampingFraction: 0.8) - Good default for most interactionswithAnimationwithAnimation when togglingzIndex for proper layering.metal file is added to targetmaxSampleOffset is set correctly for distortion effects2plugins reuse this skill
First indexed Jan 1, 2026
npx claudepluginhub xmgrex/ccx-arsenal --plugin swift-guardianGuides advanced SwiftUI animations, transitions, matched geometry effects, and Metal shader integration for iOS/macOS apps.
Reviews, writes, and fixes SwiftUI animations using modern APIs: withAnimation, PhaseAnimator, KeyframeAnimator, matchedGeometryEffect, symbol effects, and accessibility handling.
Writes Swift animation code using SwiftUI, UIKit, and Core Animation for iOS apps. Covers iOS 18-26 APIs like KeyframeAnimator, PhaseAnimator, matchedGeometryEffect for transitions, gestures, and design implementations.