Skip to content

deonmenezes/mobile-app-skill / skills/swiftui-expert-skill

swiftui-expert-skill

Verified

Use when writing, reviewing, or refactoring SwiftUI code for iOS or macOS, including state and `@Observable` data flow, view composition, resizable layouts, safe areas, display scale, performance, lists, environment, localization, animation, Liquid Glass, and API migration. Also use for iPhone Duo, foldable, or large-display layouts (`NavigationSplitView` on large displays, iPhone tab sidebar, two-column reflow, foldable grids, `ArrangementView`, `ReservedRegion`), hinge effects, vertical bars, `@State` initialization or synthesized-property diagnostics, `@ContentBuilder` ambiguity, `reorderable` drag/drop, custom `AsyncImage` `URLSession`, swipe actions outside List, item-bound `alert`/`confirmationDialog`, `ToolbarOverflowMenu`, `AnimatableValues`, Document APIs (`Document`/`DocumentReader`), and Instruments `.trace` capture or analysis.

FileKindSize
SKILL.mdskill md11.4 KB
agents/openai.yamlconfig228 B
assets/logo-small.pngbinary29.0 KB
assets/logo.pngbinary389.5 KB
assets/logo.svgother2.0 KB
references/accessibility-patterns.mdmarkdown5.9 KB
references/animation-advanced.mdmarkdown11.2 KB
references/animation-basics.mdmarkdown6.7 KB
references/animation-transitions.mdmarkdown7.9 KB
references/charts-accessibility.mdmarkdown6.1 KB
references/charts.mdmarkdown16.8 KB
references/document-apps.mdmarkdown11.1 KB
references/environment-patterns.mdmarkdown7.1 KB
references/focus-patterns.mdmarkdown8.7 KB
references/image-optimization.mdmarkdown10.4 KB
references/iphone-duo.mdmarkdown7.4 KB
references/latest-apis.mdmarkdown24.8 KB
references/layout-best-practices.mdmarkdown20.6 KB
references/liquid-glass.mdmarkdown12.4 KB
references/list-patterns.mdmarkdown20.5 KB
references/localization.mdmarkdown9.7 KB
references/macos-scenes.mdmarkdown9.5 KB
references/macos-views.mdmarkdown10.8 KB
references/macos-window-styling.mdmarkdown8.6 KB
references/modifier-patterns.mdmarkdown2.5 KB
references/performance-patterns.mdmarkdown11.7 KB
references/previews.mdmarkdown8.1 KB
references/scroll-patterns.mdmarkdown10.6 KB
references/sheet-navigation-patterns.mdmarkdown15.0 KB
references/soft-deprecation.mdmarkdown2.9 KB
references/state-management.mdmarkdown21.5 KB
references/styled-text-editing.mdmarkdown8.7 KB
references/text-patterns.mdmarkdown1.6 KB
references/toolbar-patterns.mdmarkdown9.9 KB
references/trace-analysis.mdmarkdown14.1 KB
references/trace-recording.mdmarkdown5.8 KB
references/view-structure.mdmarkdown28.3 KB
references/webkit-integration.mdmarkdown9.5 KB
scripts/analyze_trace.pyscript9.9 KB
scripts/instruments_parser/__init__.pyscript69 B
scripts/instruments_parser/causes.pyscript5.9 KB
scripts/instruments_parser/correlate.pyscript6.2 KB
scripts/instruments_parser/events.pyscript10.6 KB
scripts/instruments_parser/hangs.pyscript3.4 KB
scripts/instruments_parser/hitches.pyscript4.5 KB
scripts/instruments_parser/summary.pyscript9.1 KB
scripts/instruments_parser/swiftui.pyscript6.6 KB
scripts/instruments_parser/time_profiler.pyscript4.3 KB
scripts/instruments_parser/xctrace.pyscript3.5 KB
scripts/instruments_parser/xml_utils.pyscript7.4 KB
scripts/record_trace.pyscript10.6 KB

scripts/instruments_parser/xctrace.py

View on GitHub
"""Thin wrapper around the `xctrace` CLI."""
from __future__ import annotations

import subprocess
import xml.etree.ElementTree as ET
from dataclasses import dataclass
from pathlib import Path


@dataclass(frozen=True)
class RunInfo:
    """Per-run metadata and schemas. Instruments traces can hold multiple runs."""
    number: int
    template_name: str | None
    duration_s: float | None
    start_date: str | None
    end_date: str | None
    schemas: frozenset[str]


@dataclass(frozen=True)
class TraceInfo:
    xctrace_version: str
    runs: tuple[RunInfo, ...]

    def get_run(self, number: int) -> RunInfo:
        for r in self.runs:
            if r.number == number:
                return r
        available = ", ".join(str(r.number) for r in self.runs)
        raise KeyError(f"run {number} not in trace (available: {available})")


def version() -> str:
    out = subprocess.run(
        ["xctrace", "version"], capture_output=True, text=True, check=True
    )
    return out.stdout.strip()


def toc(trace_path: Path) -> TraceInfo:
    """Export the trace's table of contents and return per-run metadata.

    The TOC is small (a few KB) so we load it fully rather than streaming.
    """
    xml_bytes = _run_export(trace_path, ["--toc"])
    root = ET.fromstring(xml_bytes)

    instruments = _find_text(root, ".//instruments-version") or ""

    runs: list[RunInfo] = []
    for run_el in root.iterfind("./run"):
        number_attr = run_el.get("number")
        if not number_attr:
            continue
        try:
            number = int(number_attr)
        except ValueError:
            continue
        if number <= 0:
            continue

        schemas: set[str] = set()
        for table in run_el.iterfind("./data/table"):
            schema = table.get("schema")
            if schema:
                schemas.add(schema)

        summary = run_el.find("./info/summary")
        if summary is not None:
            template = _find_text(summary, "./template-name")
            duration = _find_text(summary, "./duration")
            start = _find_text(summary, "./start-date")
            end = _find_text(summary, "./end-date")
        else:
            template = duration = start = end = None

        runs.append(RunInfo(
            number=number,
            template_name=template,
            duration_s=float(duration) if duration else None,
            start_date=start,
            end_date=end,
            schemas=frozenset(schemas),
        ))

    runs.sort(key=lambda r: r.number)
    return TraceInfo(
        xctrace_version=instruments,
        runs=tuple(runs),
    )


def export_schema(trace_path: Path, schema: str, run: int = 1) -> bytes:
    """Export one schema's data as XML bytes from the given run.

    Callers are expected to iterparse the result rather than build a full tree
    for large schemas (time-profile can be tens of MB).
    """
    xpath = f'/trace-toc/run[@number="{run}"]/data/table[@schema="{schema}"]'
    return _run_export(trace_path, ["--xpath", xpath])


def _run_export(trace_path: Path, extra_args: list[str]) -> bytes:
    cmd = ["xctrace", "export", "--input", str(trace_path), *extra_args]
    proc = subprocess.run(cmd, capture_output=True, check=False)
    if proc.returncode != 0:
        raise RuntimeError(
            f"xctrace export failed ({proc.returncode}): "
            f"{proc.stderr.decode(errors='replace').strip()}"
        )
    return proc.stdout


def _find_text(root: ET.Element, path: str) -> str | None:
    el = root.find(path)
    return el.text if el is not None and el.text else None
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 471kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall