ios-debugging/SKILL.md
Master iOS debugging with LLDB, Instruments, crash log analysis, and debugging techniques. Use when debugging crashes, memory issues, performance problems, or understanding code execution. Triggers on debug, LLDB, breakpoint, crash, Instruments, debugger, console, stack trace, symbolicate, memory graph.
npx skillsauth add abanoub-ashraf/manus-skills-import ios-debuggingInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
4 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
You are an expert in iOS debugging. When this skill activates, help diagnose and fix issues efficiently.
# Print variable
(lldb) po myVariable
(lldb) p myVariable # Prints with type info
(lldb) v myVariable # Frame variable (faster)
# Print expression
(lldb) e print("Debug")
(lldb) expression myVar = 42
# Print object description
(lldb) po self
(lldb) po [self description]
# View memory
(lldb) memory read myPointer
(lldb) x/16xb myPointer # 16 bytes in hex
# List breakpoints
(lldb) breakpoint list
(lldb) br l
# Set breakpoint
(lldb) b MyClass.myMethod
(lldb) breakpoint set -n viewDidLoad
(lldb) b -f ViewController.swift -l 42
# Conditional breakpoint
(lldb) breakpoint set -n fetchUser -c 'userId == "123"'
# Breakpoint action
(lldb) breakpoint command add 1
> po self.state
> continue
> DONE
# Disable/Enable
(lldb) breakpoint disable 1
(lldb) breakpoint enable 1
# Delete
(lldb) breakpoint delete 1
# Watch variable changes
(lldb) watchpoint set variable myProperty
(lldb) w s v self.count
# Watch expression
(lldb) watchpoint set expression -- &myVariable
# List watchpoints
(lldb) watchpoint list
# Step over
(lldb) next
(lldb) n
# Step into
(lldb) step
(lldb) s
# Step out
(lldb) finish
(lldb) f
# Continue
(lldb) continue
(lldb) c
# View call stack
(lldb) bt # Backtrace
(lldb) bt all # All threads
# Switch frames
(lldb) frame select 3
(lldb) up # Go up one frame
(lldb) down # Go down one frame
# List threads
(lldb) thread list
# Switch thread
(lldb) thread select 2
# Thread backtrace
(lldb) thread backtrace
# Thread info
(lldb) thread info
# View heap allocations
(lldb) command script import lldb.macosx.heap
(lldb) ptr_refs 0x12345678
# Object reference count
(lldb) p CFGetRetainCount(myObject)
# Memory regions
(lldb) memory region myPointer
Debug → View Debugging → Capture View Hierarchy
Features:
- 3D view of view hierarchy
- Inspect constraints
- Find overlapping views
- Check hidden views
Debug → Debug Memory Graph
Look for:
- Purple exclamation marks (leaks)
- Retain cycles in reference chains
- Unexpected strong references
Settings → Developer → Network Link Conditioner
Test with:
- 3G, Edge, LTE profiles
- 100% Loss
- High Latency
import os
private let logger = Logger(subsystem: "com.app.myapp", category: "networking")
func fetchData() {
logger.debug("Starting fetch")
logger.info("Fetching from \(url, privacy: .public)")
logger.warning("Slow response: \(duration)s")
logger.error("Failed: \(error.localizedDescription)")
logger.fault("Critical: Database corrupted")
}
// With privacy
logger.info("User: \(userID, privacy: .private)")
logger.info("Count: \(count, privacy: .public)")
1. Open Console.app
2. Select your device/simulator
3. Filter by:
- Subsystem: com.app.myapp
- Category: networking
- Type: Error, Fault
func debugPrint(_ items: Any..., file: String = #file, function: String = #function, line: Int = #line) {
#if DEBUG
let fileName = (file as NSString).lastPathComponent
print("[\(fileName):\(line)] \(function) →", items)
#endif
}
// Output: [ViewController.swift:42] viewDidLoad() → Starting
# Find dSYM
mdfind -name .dSYM | xargs -I{} dwarfdump -u {}
# Symbolicate crash log
symbolicatecrash crash.log MyApp.dSYM > symbolicated.log
# Using atos
atos -arch arm64 -o MyApp.dSYM/Contents/Resources/DWARF/MyApp -l 0x100000000 0x100001234
Cause: Accessing deallocated memory
Debug:
1. Enable Zombie Objects (Scheme → Diagnostics)
2. Enable Address Sanitizer
3. Check for force unwrapping optionals
Cause: Swift runtime error (force unwrap nil, array bounds)
Debug:
1. Check stack trace for fatalError
2. Look for implicitly unwrapped optionals
3. Check array indices
Cause: Assertion failure or abort() called
Debug:
1. Check console for assertion message
2. Look for precondition failures
3. Check for unhandled exceptions
# Find CPU bottlenecks
1. Product → Profile → Time Profiler
2. Record app usage
3. Look for heavy stack traces
4. Expand call tree to find hot spots
# Track memory usage
1. Product → Profile → Allocations
2. Look for:
- Memory growth over time
- Large allocations
- Transient allocations in loops
# Find memory leaks
1. Product → Profile → Leaks
2. Red bars indicate leaks
3. Expand to see allocation stack trace
4. Common causes:
- Strong reference cycles in closures
- Delegate not weak
- Timer not invalidated
# Analyze network calls
1. Product → Profile → Network
2. See all HTTP requests
3. Check response times
4. Identify redundant calls
// Add to suspected class
deinit {
print("✅ \(Self.self) deallocated")
}
// If deinit never prints → retain cycle
// Common fixes:
class MyClass {
// Weak delegate
weak var delegate: MyDelegate?
// Weak self in closures
someService.fetch { [weak self] result in
guard let self else { return }
self.handleResult(result)
}
// Weak capture in Combine
cancellable = publisher
.sink { [weak self] value in
self?.handle(value)
}
}
// Add task identifiers
func fetchData() async {
let taskID = UUID().uuidString.prefix(8)
print("[\(taskID)] Start fetch")
defer { print("[\(taskID)] End fetch") }
// ... fetch logic
}
// Check thread
print("Thread: \(Thread.current)")
print("Is main: \(Thread.isMainThread)")
// Print body evaluations
var body: some View {
let _ = print("🔄 \(Self.self) body evaluated")
VStack {
// ...
}
}
// Use Self._printChanges() (iOS 15+)
var body: some View {
let _ = Self._printChanges()
VStack {
// ...
}
}
// Visual debug
.border(.red)
.background(.blue.opacity(0.3))
// Print sizes
.background(GeometryReader { geo in
Color.clear.onAppear {
print("Size: \(geo.size)")
}
})
Product → Scheme → Edit Scheme → Run → Arguments
Environment Variables:
- CFNETWORK_DIAGNOSTICS=3 # Network debugging
- SQLITE_ENABLE_THREAD_ASSERTIONS=1
- CA_DEBUG_TRANSACTIONS=1 # Core Animation
Arguments Passed On Launch:
- -com.apple.CoreData.SQLDebug 1
- -com.apple.CoreData.Logging.stderr 1
# In scheme environment variables:
MallocStackLogging=1 # Log allocations
MallocScribble=1 # Fill freed memory with 0x55
MallocGuardEdges=1 # Guard pages around allocations
development
Design principles for building polished, native-feeling SwiftUI apps and widgets. Use this skill when creating or modifying SwiftUI views, iOS widgets (WidgetKit), or any native Apple UI. Ensures proper spacing, typography, colors, and widget implementations that look and feel like quality apps rather than AI-generated slop.
data-ai
Design and implement SwiftUI views, components, and app architecture. Use when creating new SwiftUI views, implementing MVVM/TCA patterns, managing state with @Observable, @State, @Binding, or @Environment, designing navigation flows, or structuring iOS app architecture. Triggers on SwiftUI, view model, state management, navigation, coordinator pattern.
development
Implement, review, or improve SwiftUI animations and transitions. Use when adding implicit or explicit animations with withAnimation, configuring spring animations (.smooth, .snappy, .bouncy), building phase or keyframe animations with PhaseAnimator/KeyframeAnimator, creating hero transitions with matchedGeometryEffect or matchedTransitionSource, adding SF Symbol effects (bounce, pulse, variableColor, breathe, rotate, wiggle), implementing custom Transition or CustomAnimation types, or ensuring animations respect accessibilityReduceMotion.
testing
Audit SwiftUI views for accessibility (iOS + macOS) with patch-ready fixes