Mirror Apple's entire Sample Code Library to your machine with one command — all frameworks, all years, ~650 projects.
It talks to the same JSON API that powers developer.apple.com, resolves every sample's official download archive, verifies it against Apple's published SHA‑512 checksum, and extracts it into a tidy per‑framework folder tree.
samples/
├── Metal/ modern-rendering-with-metal/ …
├── SwiftUI/ …
├── UIKit/ …
├── visionOS/ …
└── … (~140 frameworks)
It does not redistribute Apple's code. Every archive is fetched directly from Apple's own servers (
docs-assets.developer.apple.com). This repo ships only the downloader and a manifest (the list of sample URLs Apple publishes). The sample code itself never lives here — that's whatsamples/(git‑ignored) on your machine is for.
The Sample Code Library page is JavaScript‑rendered and organized by framework, so there's no "download all" button and the projects span many years. Existing GitHub mirrors commit Apple's code verbatim (a licensing grey area that tends to get DMCA'd). This is a downloader instead — closer to youtube-dl's model: share the tool, not the content.
Python 3.8+. Standard library only — no pip install, no dependencies.
# See what's available (frameworks + counts)
python apple_sample_downloader.py list
# Download everything (~30 GB, extracted, into ./samples)
python apple_sample_downloader.py download
# Just a few frameworks
python apple_sample_downloader.py download --framework Metal SwiftUI visionOS
# Keep the zips, or don't extract at all
python apple_sample_downloader.py download --keep-zip
python apple_sample_downloader.py download --no-extract
# Custom output dir / parallelism
python apple_sample_downloader.py download --out ~/AppleSamples --workers 12Each finished sample drops a .complete marker. Re‑run the same command and it skips everything already downloaded and retries only what's missing or failed — so a dropped connection on sample 500/650 costs you nothing.
manifest.json is committed so download works out of the box. When Apple adds new samples, rebuild it:
python apple_sample_downloader.py build-manifest # re-crawl Apple's API
python apple_sample_downloader.py index # regenerate INDEX.md| Command | What it does |
|---|---|
download |
Download (and extract) samples. Resumable. The main one. |
list |
Print frameworks and sample counts. |
build-manifest |
Re‑crawl Apple's API and rewrite manifest.json. |
index |
Write a human‑readable INDEX.md catalog. |
Run any command with -h for its flags.
Apple's docs are built with Swift‑DocC. The rendered HTML hydrates from JSON at developer.apple.com/tutorials/data/…. For any sample page, that JSON contains a references entry of type: "download" pointing at the real .zip plus its checksum. The tool:
- Reads
documentation/samplecode.json(the whole library, by framework) and the per‑yearupdates/wwdcYYYY.jsonpages. - Resolves each sample page's JSON to find its download URL + SHA‑512.
- Downloads, verifies the checksum, and extracts.
- The
tutorials/data/**.jsonendpoints are not an official, documented API. Apple could change the structure and break this tool. It has been stable for years (DocC depends on it), but no promises. - Be polite: the default 8 workers is gentle on Apple's CDN. Cranking
--workersvery high is rude and may get you rate‑limited. - Respect Apple's sample code license / terms for anything you do with the downloaded projects.
MIT — for this tool. The downloaded Apple sample code is Apple's, under Apple's terms.