Enhanced SwiftUI debugging with structured view insights and render tracking.
import SwiftUI
import SwiftUIDebugScan
struct FeatureRootView: View {
var body: some View {
List {
FeatureLeafView()
FeatureLeafView()
FeatureLeafView()
}
.debugScan("FeatureRootView")
}
}Console Output:
🧩 [FeatureRootView]
• 📂 file: FeatureRootView.swift
• 📚 module: Feature
• 🎨 redraws: 1
• ⏱️ timestamp: 2025-07-21 14:05:40 +0000
- View Metadata: Track file, module, and render counts
- Debug Complex UIs: Essential for large, server-driven applications
- Performance Insights: Identify over-rendering and optimization opportunities
- Targeted Debugging: Focus on root views without log noise
✅ Apply to root views:
NavigationView {
HomeScreen()
}.debugScan("HomeNavigation")❌ Avoid on leaf views:
// Avoid - creates excessive log output
Text("Button").debugScan("ButtonText")Recommended targets:
- Screen root views
- Major container views
- Complex custom components
- Views with performance concerns
Set SWIFTUI_DEBUG_SCAN_VERBOSE=1 for detailed diagnostics:
- 🧵 Call stack and thread info
- 💾 Memory and CPU usage
- ⏱️ Performance timing
- 📊 System metrics
dependencies: [
.package(url: "https://github.com/ConsultingMD/swift-ui-debug-scan", from: "0.2.0")
]Xcode: File > Add Packages → Enter URL above
- Download
DebugScan.swift - Drag the file into your project
- Skip the
import SwiftUIDebugScanline - start using.debugScan()immediately
Contributions welcome! See CONTRIBUTING.md for guidelines.
Quick fixes: Fork → Change → Test → PR
New features: Open issue first to discuss