A Swift wrapper for the Yahoo Fantasy Sports API, with Sign In With Yahoo (OAuth 2.0 / PKCE) for authentication. No external dependencies.
- Yahoo Fantasy Sports API: games, leagues, settings, standings, rosters, players, scoreboard, transactions, draft results (read-only)
- Sign In With Yahoo: OAuth 2.0 authorization code flow with PKCE
- Keychain-backed token storage with silent refresh
- async/await API
- Zero external dependencies
| Platform | Minimum OS | Swift | Installation |
|---|---|---|---|
| iOS | 15.0+ | 6.0+ | SPM |
| macOS | 12.0+ | 6.0+ | SPM |
| tvOS | 15.0+ | 6.0+ | SPM |
| watchOS | 8.0+ | 6.0+ | SPM |
| visionOS | 1.0+ | 6.0+ | SPM |
Add CDYahooKit to your Package.swift:
.package(url: "https://github.com/chrisdhaan/CDYahooKit.git", from: "1.1.0")Or in Xcode: File → Add Packages → Enter https://github.com/chrisdhaan/CDYahooKit.git
See Documentation/Usage.md for comprehensive usage examples, or browse the full API documentation.
Example/iOS Example.xcodeproj is a real, buildable iOS app project demonstrating the full Sign
In With Yahoo + Fantasy Sports flow: OAuth 2.0 + PKCE login, then a row per read-only endpoint —
user games & leagues, league metadata, league settings, standings, team roster, league players,
scoreboard, transactions, and draft results (league- and team-scoped) — each of which runs the
request and pushes a viewer showing the raw, re-indented
XML Yahoo returned (captured through a CDYahooEventMonitor). It depends on CDYahooKit as a
local Swift Package reference to this repository's root, so it builds standalone with no extra
wiring.
This app builds its UI programmatically rather than from a storyboard — a deliberate choice,
kept because there is no .storyboard XML to hand-maintain alongside the project file.
To run it:
- Copy
Example/Secrets.xcconfig.exampletoExample/Secrets.xcconfigand fill in your ownclientId/clientSecret/redirectUrlfrom the Yahoo Developer Network. - Open
Example/iOS Example.xcodeprojin Xcode and run theiOS Examplescheme.
CDYahooKit wraps the Yahoo Fantasy Sports API only. Every other Yahoo developer API this
library once targeted has since been shut down: YQL and the Yahoo Weather API (retired
2019-01-03), the Social Directory / Contacts API (EOL'd 2020-06-30), the official Yahoo Finance
API (killed 2017-05-15), and BOSS Search (shut down 2016-03-31). The only consumer-facing
surface left on developer.yahoo.com is the Fantasy Sports API and Sign In With Yahoo — this
library wraps both.
Christopher de Haan, contact@christopherdehaan.me
CDYahooKit is available under the MIT license. See the LICENSE file for more info.