{
  "schemaVersion": "1.0",
  "item": {
    "slug": "swiftui-performance-audit",
    "name": "Swiftui Performance Audit",
    "source": "tencent",
    "type": "skill",
    "category": "效率提升",
    "sourceUrl": "https://clawhub.ai/steipete/swiftui-performance-audit",
    "canonicalUrl": "https://clawhub.ai/steipete/swiftui-performance-audit",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadMode": "redirect",
    "downloadUrl": "/downloads/swiftui-performance-audit",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=swiftui-performance-audit",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "installMethod": "Manual import",
    "extraction": "Extract archive",
    "prerequisites": [
      "OpenClaw"
    ],
    "packageFormat": "ZIP package",
    "includedAssets": [
      "SKILL.md",
      "references/demystify-swiftui-performance-wwdc23.md",
      "references/optimizing-swiftui-performance-instruments.md",
      "references/understanding-hangs-in-your-app.md",
      "references/understanding-improving-swiftui-performance.md"
    ],
    "primaryDoc": "SKILL.md",
    "quickSetup": [
      "Download the package from Yavira.",
      "Extract the archive and review SKILL.md first.",
      "Import or place the package into your OpenClaw setup."
    ],
    "agentAssist": {
      "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
      "steps": [
        "Download the package from Yavira.",
        "Extract it into a folder your agent can access.",
        "Paste one of the prompts below and point your agent at the extracted folder."
      ],
      "prompts": [
        {
          "label": "New install",
          "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete."
        },
        {
          "label": "Upgrade existing",
          "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run."
        }
      ]
    },
    "sourceHealth": {
      "source": "tencent",
      "slug": "swiftui-performance-audit",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-05-01T08:44:25.115Z",
      "expiresAt": "2026-05-08T08:44:25.115Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=swiftui-performance-audit",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=swiftui-performance-audit",
        "contentDisposition": "attachment; filename=\"swiftui-performance-audit-1.0.0.zip\"",
        "redirectLocation": null,
        "bodySnippet": null,
        "slug": "swiftui-performance-audit"
      },
      "scope": "item",
      "summary": "Item download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this item.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/swiftui-performance-audit"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    },
    "downloadPageUrl": "https://openagent3.xyz/downloads/swiftui-performance-audit",
    "agentPageUrl": "https://openagent3.xyz/skills/swiftui-performance-audit/agent",
    "manifestUrl": "https://openagent3.xyz/skills/swiftui-performance-audit/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/swiftui-performance-audit/agent.md"
  },
  "agentAssist": {
    "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
    "steps": [
      "Download the package from Yavira.",
      "Extract it into a folder your agent can access.",
      "Paste one of the prompts below and point your agent at the extracted folder."
    ],
    "prompts": [
      {
        "label": "New install",
        "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete."
      },
      {
        "label": "Upgrade existing",
        "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run."
      }
    ]
  },
  "documentation": {
    "source": "clawhub",
    "primaryDoc": "SKILL.md",
    "sections": [
      {
        "title": "SwiftUI Performance Audit",
        "body": "Attribution: copied from @Dimillian’s Dimillian/Skills (2025-12-31)."
      },
      {
        "title": "Overview",
        "body": "Audit SwiftUI view performance end-to-end, from instrumentation and baselining to root-cause analysis and concrete remediation steps."
      },
      {
        "title": "Workflow Decision Tree",
        "body": "If the user provides code, start with \"Code-First Review.\"\nIf the user only describes symptoms, ask for minimal code/context, then do \"Code-First Review.\"\nIf code review is inconclusive, go to \"Guide the User to Profile\" and ask for a trace or screenshots."
      },
      {
        "title": "1. Code-First Review",
        "body": "Collect:\n\nTarget view/feature code.\nData flow: state, environment, observable models.\nSymptoms and reproduction steps.\n\nFocus on:\n\nView invalidation storms from broad state changes.\nUnstable identity in lists (id churn, UUID() per render).\nHeavy work in body (formatting, sorting, image decoding).\nLayout thrash (deep stacks, GeometryReader, preference chains).\nLarge images without downsampling or resizing.\nOver-animated hierarchies (implicit animations on large trees).\n\nProvide:\n\nLikely root causes with code references.\nSuggested fixes and refactors.\nIf needed, a minimal repro or instrumentation suggestion."
      },
      {
        "title": "2. Guide the User to Profile",
        "body": "Explain how to collect data with Instruments:\n\nUse the SwiftUI template in Instruments (Release build).\nReproduce the exact interaction (scroll, navigation, animation).\nCapture SwiftUI timeline and Time Profiler.\nExport or screenshot the relevant lanes and the call tree.\n\nAsk for:\n\nTrace export or screenshots of SwiftUI lanes + Time Profiler call tree.\nDevice/OS/build configuration."
      },
      {
        "title": "3. Analyze and Diagnose",
        "body": "Prioritize likely SwiftUI culprits:\n\nView invalidation storms from broad state changes.\nUnstable identity in lists (id churn, UUID() per render).\nHeavy work in body (formatting, sorting, image decoding).\nLayout thrash (deep stacks, GeometryReader, preference chains).\nLarge images without downsampling or resizing.\nOver-animated hierarchies (implicit animations on large trees).\n\nSummarize findings with evidence from traces/logs."
      },
      {
        "title": "4. Remediate",
        "body": "Apply targeted fixes:\n\nNarrow state scope (@State/@Observable closer to leaf views).\nStabilize identities for ForEach and lists.\nMove heavy work out of body (precompute, cache, @State).\nUse equatable() or value wrappers for expensive subtrees.\nDownsample images before rendering.\nReduce layout complexity or use fixed sizing where possible."
      },
      {
        "title": "Common Code Smells (and Fixes)",
        "body": "Look for these patterns during code review."
      },
      {
        "title": "Expensive formatters in body",
        "body": "var body: some View {\n    let number = NumberFormatter() // slow allocation\n    let measure = MeasurementFormatter() // slow allocation\n    Text(measure.string(from: .init(value: meters, unit: .meters)))\n}\n\nPrefer cached formatters in a model or a dedicated helper:\n\nfinal class DistanceFormatter {\n    static let shared = DistanceFormatter()\n    let number = NumberFormatter()\n    let measure = MeasurementFormatter()\n}"
      },
      {
        "title": "Computed properties that do heavy work",
        "body": "var filtered: [Item] {\n    items.filter { $0.isEnabled } // runs on every body eval\n}\n\nPrefer precompute or cache on change:\n\n@State private var filtered: [Item] = []\n// update filtered when inputs change"
      },
      {
        "title": "Sorting/filtering in body or ForEach",
        "body": "List {\n    ForEach(items.sorted(by: sortRule)) { item in\n        Row(item)\n    }\n}\n\nPrefer sort once before view updates:\n\nlet sortedItems = items.sorted(by: sortRule)"
      },
      {
        "title": "Inline filtering in ForEach",
        "body": "ForEach(items.filter { $0.isEnabled }) { item in\n    Row(item)\n}\n\nPrefer a prefiltered collection with stable identity."
      },
      {
        "title": "Unstable identity",
        "body": "ForEach(items, id: \\.self) { item in\n    Row(item)\n}\n\nAvoid id: \\.self for non-stable values; use a stable ID."
      },
      {
        "title": "Image decoding on the main thread",
        "body": "Image(uiImage: UIImage(data: data)!)\n\nPrefer decode/downsample off the main thread and store the result."
      },
      {
        "title": "Broad dependencies in observable models",
        "body": "@Observable class Model {\n    var items: [Item] = []\n}\n\nvar body: some View {\n    Row(isFavorite: model.items.contains(item))\n}\n\nPrefer granular view models or per-item state to reduce update fan-out."
      },
      {
        "title": "5. Verify",
        "body": "Ask the user to re-run the same capture and compare with baseline metrics.\nSummarize the delta (CPU, frame drops, memory peak) if provided."
      },
      {
        "title": "Outputs",
        "body": "Provide:\n\nA short metrics table (before/after if available).\nTop issues (ordered by impact).\nProposed fixes with estimated effort."
      },
      {
        "title": "References",
        "body": "Add Apple documentation and WWDC resources under references/ as they are supplied by the user.\n\nOptimizing SwiftUI performance with Instruments: references/optimizing-swiftui-performance-instruments.md\nUnderstanding and improving SwiftUI performance: references/understanding-improving-swiftui-performance.md\nUnderstanding hangs in your app: references/understanding-hangs-in-your-app.md\nDemystify SwiftUI performance (WWDC23): references/demystify-swiftui-performance-wwdc23.md"
      }
    ],
    "body": "SwiftUI Performance Audit\n\nAttribution: copied from @Dimillian’s Dimillian/Skills (2025-12-31).\n\nOverview\n\nAudit SwiftUI view performance end-to-end, from instrumentation and baselining to root-cause analysis and concrete remediation steps.\n\nWorkflow Decision Tree\nIf the user provides code, start with \"Code-First Review.\"\nIf the user only describes symptoms, ask for minimal code/context, then do \"Code-First Review.\"\nIf code review is inconclusive, go to \"Guide the User to Profile\" and ask for a trace or screenshots.\n1. Code-First Review\n\nCollect:\n\nTarget view/feature code.\nData flow: state, environment, observable models.\nSymptoms and reproduction steps.\n\nFocus on:\n\nView invalidation storms from broad state changes.\nUnstable identity in lists (id churn, UUID() per render).\nHeavy work in body (formatting, sorting, image decoding).\nLayout thrash (deep stacks, GeometryReader, preference chains).\nLarge images without downsampling or resizing.\nOver-animated hierarchies (implicit animations on large trees).\n\nProvide:\n\nLikely root causes with code references.\nSuggested fixes and refactors.\nIf needed, a minimal repro or instrumentation suggestion.\n2. Guide the User to Profile\n\nExplain how to collect data with Instruments:\n\nUse the SwiftUI template in Instruments (Release build).\nReproduce the exact interaction (scroll, navigation, animation).\nCapture SwiftUI timeline and Time Profiler.\nExport or screenshot the relevant lanes and the call tree.\n\nAsk for:\n\nTrace export or screenshots of SwiftUI lanes + Time Profiler call tree.\nDevice/OS/build configuration.\n3. Analyze and Diagnose\n\nPrioritize likely SwiftUI culprits:\n\nView invalidation storms from broad state changes.\nUnstable identity in lists (id churn, UUID() per render).\nHeavy work in body (formatting, sorting, image decoding).\nLayout thrash (deep stacks, GeometryReader, preference chains).\nLarge images without downsampling or resizing.\nOver-animated hierarchies (implicit animations on large trees).\n\nSummarize findings with evidence from traces/logs.\n\n4. Remediate\n\nApply targeted fixes:\n\nNarrow state scope (@State/@Observable closer to leaf views).\nStabilize identities for ForEach and lists.\nMove heavy work out of body (precompute, cache, @State).\nUse equatable() or value wrappers for expensive subtrees.\nDownsample images before rendering.\nReduce layout complexity or use fixed sizing where possible.\nCommon Code Smells (and Fixes)\n\nLook for these patterns during code review.\n\nExpensive formatters in body\nvar body: some View {\n    let number = NumberFormatter() // slow allocation\n    let measure = MeasurementFormatter() // slow allocation\n    Text(measure.string(from: .init(value: meters, unit: .meters)))\n}\n\n\nPrefer cached formatters in a model or a dedicated helper:\n\nfinal class DistanceFormatter {\n    static let shared = DistanceFormatter()\n    let number = NumberFormatter()\n    let measure = MeasurementFormatter()\n}\n\nComputed properties that do heavy work\nvar filtered: [Item] {\n    items.filter { $0.isEnabled } // runs on every body eval\n}\n\n\nPrefer precompute or cache on change:\n\n@State private var filtered: [Item] = []\n// update filtered when inputs change\n\nSorting/filtering in body or ForEach\nList {\n    ForEach(items.sorted(by: sortRule)) { item in\n        Row(item)\n    }\n}\n\n\nPrefer sort once before view updates:\n\nlet sortedItems = items.sorted(by: sortRule)\n\nInline filtering in ForEach\nForEach(items.filter { $0.isEnabled }) { item in\n    Row(item)\n}\n\n\nPrefer a prefiltered collection with stable identity.\n\nUnstable identity\nForEach(items, id: \\.self) { item in\n    Row(item)\n}\n\n\nAvoid id: \\.self for non-stable values; use a stable ID.\n\nImage decoding on the main thread\nImage(uiImage: UIImage(data: data)!)\n\n\nPrefer decode/downsample off the main thread and store the result.\n\nBroad dependencies in observable models\n@Observable class Model {\n    var items: [Item] = []\n}\n\nvar body: some View {\n    Row(isFavorite: model.items.contains(item))\n}\n\n\nPrefer granular view models or per-item state to reduce update fan-out.\n\n5. Verify\n\nAsk the user to re-run the same capture and compare with baseline metrics. Summarize the delta (CPU, frame drops, memory peak) if provided.\n\nOutputs\n\nProvide:\n\nA short metrics table (before/after if available).\nTop issues (ordered by impact).\nProposed fixes with estimated effort.\nReferences\n\nAdd Apple documentation and WWDC resources under references/ as they are supplied by the user.\n\nOptimizing SwiftUI performance with Instruments: references/optimizing-swiftui-performance-instruments.md\nUnderstanding and improving SwiftUI performance: references/understanding-improving-swiftui-performance.md\nUnderstanding hangs in your app: references/understanding-hangs-in-your-app.md\nDemystify SwiftUI performance (WWDC23): references/demystify-swiftui-performance-wwdc23.md"
  },
  "trust": {
    "sourceLabel": "tencent",
    "provenanceUrl": "https://clawhub.ai/steipete/swiftui-performance-audit",
    "publisherUrl": "https://clawhub.ai/steipete/swiftui-performance-audit",
    "owner": "steipete",
    "version": "1.0.0",
    "license": null,
    "verificationStatus": "Indexed source record"
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/swiftui-performance-audit",
    "downloadUrl": "https://openagent3.xyz/downloads/swiftui-performance-audit",
    "agentUrl": "https://openagent3.xyz/skills/swiftui-performance-audit/agent",
    "manifestUrl": "https://openagent3.xyz/skills/swiftui-performance-audit/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/swiftui-performance-audit/agent.md"
  }
}