Skip to content
tmorales2000Public

About

Dump an Apple framework's documentation to plain text via the developer.apple.com JSON API

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

appledoc.sh

Dump an Apple framework's documentation to plain text, straight from the JSON API that backs developer.apple.com/documentation.

Apple's docs site is a client-side app. For a page at https://developer.apple.com/documentation/<path>, the actual content lives at https://developer.apple.com/tutorials/data/documentation/<path>.json. This script crawls that API starting from a framework (or any symbol) and emits readable text: title, abstract, and declaration for each symbol, indented by hierarchy depth.

This is handy for getting a framework's docs into a single text file you can grep, diff, or feed to an LLM — particularly useful for frameworks or APIs that are newer than a model's training cutoff.

Why

If you're working with a recent or beta Apple framework, your editor's autocomplete and an LLM's training data can both be behind what's actually shipping. This script gets you a flat, readable snapshot of the official docs so you (or a tool) have current ground truth to work from.

Requirements

  • bash
  • curl
  • jq

Usage

./appledoc.sh <path> [-d DEPTH] [-o OUTFILE] [-q QPS] [--resume]
  • <path> — the bit after /documentation/, e.g. swiftui or swiftui/view
  • -d, --depth — how deep to recurse into child symbols (default 1)
    • 0 = just this page
    • 1 = top-level symbols + their signatures (good for browsing)
    • 2+ = members of each type (gets large; thousands of requests)
  • -o, --out — output file (default: <path-with-underscores>.txt)
  • -q, --qps — max requests/second, be polite to Apple (default 4)
  • --resume — reuse the on-disk cache from a prior run instead of refetching
  • -h, --help — show help

Examples

./appledoc.sh swiftui                      # top-level SwiftUI symbols
./appledoc.sh swiftui/view -d 2            # View and its members, deep
./appledoc.sh foundation -d 1 -o fnd.txt   # to a named file

Sample output

## View
   A type that represents part of your app's user interface and provides
   modifiers that you use to configure views.
   protocol View

  ## body
     The content and behavior of the view.
     associatedtype Body : View

Notes

  • This is an unofficial tool. It scrapes the public JSON endpoint that backs Apple's own docs website — it is not an Apple API and isn't affiliated with or endorsed by Apple. Be polite with -q (the default of 4 requests/second is a reasonable starting point); if you see fetch failures, lower it.
  • Only covers published docs. Unreleased/beta SDK symbols won't be on the server — use xcrun swift symbolgraph-extract against the beta SDK for those.
  • Responses are cached under a temp directory; --resume points back at the newest cache from a prior run so you can re-crawl without refetching everything.

License

MIT — see LICENSE.

About

Dump an Apple framework's documentation to plain text via the developer.apple.com JSON API

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages