Skip to content

fburakk/apple-sample-code-downloader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Apple Sample Code Downloader

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 what samples/ (git‑ignored) on your machine is for.

Why

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.

Requirements

Python 3.8+. Standard library only — no pip install, no dependencies.

Usage

# 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 12

Resumable

Each 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.

Refreshing the list

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

Commands

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.

How it works

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:

  1. Reads documentation/samplecode.json (the whole library, by framework) and the per‑year updates/wwdcYYYY.json pages.
  2. Resolves each sample page's JSON to find its download URL + SHA‑512.
  3. Downloads, verifies the checksum, and extracts.

Caveats

  • The tutorials/data/**.json endpoints 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 --workers very high is rude and may get you rate‑limited.
  • Respect Apple's sample code license / terms for anything you do with the downloaded projects.

License

MIT — for this tool. The downloaded Apple sample code is Apple's, under Apple's terms.

About

Download Apple's entire Sample Code Library (~650 projects, all frameworks and WWDC years) in one command. Resumable and checksum verified, straight from developer.apple.com.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages