Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Shuffler

Shuffler lets you start playing music from the last n days, weeks, months or years from your Spotify "liked songs" playlist very quickly. Each drag of the ring adjusts the time range and also shuffles the selected music for you. This was made in the better part of an afternoon, mostly via prompting Amp Agent. It solves a very specific problem for me, as I could not find a way to easily do this from within the spotify app. Enjoy!

shuffler — last 3 days, 26 songs shuffler — last 8 weeks, 170 songs

Requirements

  • Xcode 26+, iPhone running iOS 26+
  • Spotify Premium (required for remote playback)
  • The Spotify app installed on the phone
  • The app runs in Spotify development mode: max 5 allowlisted accounts, added manually in the developer dashboard

Setup

1. Create a Spotify app

  1. Create an app in the Spotify developer dashboard.
  2. Set the redirect URI to exactly:
    musicshuffle://callback
    
  3. Under User Management, add the Spotify account emails of everyone who will use the app (yours included, up to 5).

2. Create Config.xcconfig

The config file is gitignored — create it at the repo root:

SPOTIFY_CLIENT_ID = your_client_id_here

There is no client secret — auth uses Authorization Code + PKCE, so the Client ID is the only credential.

3. Build and run

Open music-shuffle.xcodeproj, select your device, and run.

Development

Run the tests:

xcodebuild test \
  -project music-shuffle.xcodeproj \
  -scheme music-shuffle \
  -destination 'platform=iOS Simulator,name=iPhone 17,OS=26.0.1'

The suite covers time-window math (calendar edges, DST, leap years), library merge/dedupe, the seeded display shuffle, the ring dial engine, token refresh, rate-limit handling, and the playback device fallback — all against mocked transports, no network.

Project layout:

Path What lives there
music-shuffle/Auth/ PKCE flow, Keychain token store
music-shuffle/Spotify/ Typed Web API client (401 refresh, 429 retry)
music-shuffle/Library/ Liked-songs sync + on-disk cache
music-shuffle/Model/ TimeWindow, ShuffleSession (domain logic)
music-shuffle/Playback/ Device selection + wake-Spotify-and-retry dance
music-shuffle/UI/ Ring dial, track list, the one screen

Technical notes

  • No backend, no third-party dependencies. Pure SwiftUI against the Spotify Web API; tokens in the Keychain, track cache on device.
  • Read-only against the Spotify library — no playlists created, nothing modified. Playback goes through PUT /me/player/play with a uris array (max 250 tracks).
  • Library sync caps at the 2,000 most recent liked songs / last 10 years.
  • iPhone, portrait, dark mode only.

About

Last-n music shuffling for Spotify

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages