An iOS app that visually clones Spotify's app and consumes the official Spotify's Web API to show(and play) songs, podcasts, artists and more.

Overview

SpotifyClone

An iOS app that visually clones Spotify's app and consumes the official Spotify's Web API to show(and play) songs, podcasts, artists and more.

The app can play a 30-second preview of a song, otherwise, to play the full song it would be necessary to have a physical device and the real Spotify app installed(requirements of the Spotify iOS SDK).

I've built the project by myself to learn more about iOS development, and to consolidate already learnt concepts by putting them into practice. By no means the project is perfect, so feel free to open issues or make pull requests with your own new features.

I hope you enjoy the app. Feel free to hit me up!

-Gabriel


Home Screen Search Screen Track Details Screen Playlist Details Screen
Screen Shot 2021-10-11 at 11 59 25 AM Screen Shot 2021-10-11 at 12 00 41 PM Screen Shot 2021-10-11 at 11 59 34 AM Screen Shot 2021-10-11 at 12 00 36 PM
Artist Details Screen Podcast Details Screen Album Details Screen Active Searching Screen
Screen Shot 2021-10-11 at 12 00 11 PM Screen Shot 2021-10-11 at 12 01 16 PM Screen Shot 2021-10-11 at 11 59 43 AM Screen Shot 2021-10-11 at 12 01 01 PM





How to set up (>5 min)

  1. Fork this project and git clone ...
  2. Create/login with your Spotify Account in the Spotify for Developers website.
  3. Go to dashboard and select 'Create an app'.
  4. Give the name and description that you want and in the dashboard select the app that you've just created.
  5. Go to your local clone of the project in your machine and open 'YourSensitiveData.swift' (./SpotifyClone/SpotifyCloneProject/YourSensitiveData).
  6. Back in your application page of the dashboard, copy the 'Client ID' and 'Client Secret' and paste them in 'YourSensitiveData.swift'.
  7. Again in the dashboard select 'Users and access' an then click in 'Add new user'(if you try to log-in into an account in the app without adding it here, your app will crash with error 403 because Spotify's API doesn't allow that).
  8. Great! Now you just need to run the app!

If you have any problem, feel free to contact me on github





Concepts & Technologies Used

  • Swift
  • Consuming a REST API
  • Caching
  • AVFoundation to play and control audio
  • Combine (minor use)
  • SwiftUI
  • XCode Instruments
  • Memory Management and Cache Cleaning
  • Grand Central Dispatch
  • Dependency Injection
  • CocoaPods

External Dependencies:

  • Alamofire
  • Introspect (really small use)
  • SwiftLint



Turn on the video volume

Screen.Recording.2021-10-23.at.6.23.36.PM.mov
Searching-and-Playing.mov
Podcast-Playing.mov
Playlist-Playing.mov

Stuttering is due to simulator lag and shouldn't happen on real device.



Code Overview

ViewModels

Main

  • Navigation
  • Source of the Spotify's Authentication Key to the subviewmodels

Auth

  • Coordinator: Controls the WebView responses
  • Contacts Service(/APIAuthentication) to get the Authentication Key
  • Controls the state of AuthScreen

Home

  • Contacts Service(/HomePageAPICalls) to get media(tracks, podcasts, playlists, albums, artists and episodes) data from the API
  • Controls HomeSubpages(playlistDetail, trackDetail, etc…)
  • Controls the state of HomeScreen

Search

  • ActiveSearchViewModel: Contacts Service(/SearchPageAPICalls) to get response data(based on what the user searched) from the API ¹
  • Contacts Service(/SearchPageAPICalls) to get media data from API ²
  • Controls SearchSubpages(activeSearching, playlistDetail, trackDetail, etc…)
  • Controls the state of DetailScreen

Details

  • Contacts Service(/MediaDetailsPageAPICalls) to get the detailed data, for a specific item(the item that was clicked), from the API
  • Controls the state of DetailScreen

¹ The viewmodel for when the user is actively searching for an item.
² The viewmodel for when the user just opened the SearchScreen, it's similar to a discover screen.

Things to do/improve

  • Use protocols to reduce code duplication.
  • Add more animations(like, follow, navigation, etc).
  • Play playlists(one song after another).
  • Use navigation link for navigation.
  • Save that the user is already logged.
  • Unit testing.
  • Solve animation hitches when scrolling in the playlist tracks.
  • Better project architecture.
  • Make the currently playing track bottom bar work.
  • Make the three dots work to open more options.




DeC-SV5W4AEDegt

You might also like...
SPlayer - play mp3/pm4

SPlayer - play mp3/pm4

MusicalInstrument - Play musical instrument in just few lines of swift code

MusicalInstrument Play musical instrument in just few lines of swift code. Requi

An original digital art work for macOS, iOS and web
An original digital art work for macOS, iOS and web

WordClock WordClock versions of various vintages, for various platforms. https://www.simonheys.com/wordclock/ Downloads Currently avaiaible to downloa

HomeHub - Swift app to control my home's smart devices + show spotify current playback
HomeHub - Swift app to control my home's smart devices + show spotify current playback

HomeHub iPad app to control my home's smart devices + show spotify current playb

Replace the system volume popup with a more subtle indicator.
Replace the system volume popup with a more subtle indicator.

Replace the volume popup with a more subtle way to display the volume when the user changes it with the volume rocker. Why and how The iOS default pop

This app demonstrates how to use the Google Cloud Speech API and Apple on-device Speech library to recognize speech in live recorded audio.

SpeechRecognitionIOS This app demonstrates how to use Google Cloud Speech API and Apple on-device Speech library to recognize speech in live audio rec

A small cookbook app created with UIKit using the mealDB API
A small cookbook app created with UIKit using the mealDB API

Your-New-CookBook This is a small cookbook app I created with UIKit using the me

Audite - My SwiftUI app that is using Google's text to speech API
Audite - My SwiftUI app that is using Google's text to speech API

Speech My SwiftUI app that is using Google's text to speech API. Goal is to list

Support for native cross-platform in-app-purchasing API's in Titanium

Support for native cross-platform in-app-purchasing API's in Titanium. This repository represents a modern alternative to ti.storekit (iOS) and ti.inappbilling (Android).

Comments
  • Spotify crashes when I try to log in.

    Spotify crashes when I try to log in.

    Hi, I am kinda new to Swift and coding in general. I have followed the instructions in the read me file and have setup an app within Spotify developer and added a new user. I am stuck on how to log into Spotify within the SpotifyClone. Most likely a simple fix but I appreciate any help! Thank you :)

    opened by rpalmcos 2
  • playing full length tracks

    playing full length tracks

    Can this code play full length tracks if the Spotify app is installed or would that require recoding from Spotify web API to iOS SDK? I have the Spotify app installed and authenticated but SpotifyClone still plays only 30 second demos.
    Do I need to authorize something in the app? Thanks Julian

    opened by orange-artworks 2
  • LoadingView.swift problem

    LoadingView.swift problem

    Hey there, thank you so much for providing such a cool project for open use, tho i'm having a trouble with codes that are related to the loading screen, here's some screenshots about it... Screen Shot 2022-05-18 at 9 40 08 PM Screen Shot 2022-05-18 at 9 41 04 PM Can you guide me with debugging this issue?

    opened by LiamChiron 1
Owner
null
SimplePlayer - A simple application to fetch songs from iTunes Library by searching song's artist

SimplePlayer is a simple application to fetch songs from iTunes Library by searching song's artist.

Maria Angelina 0 Jan 30, 2022
AIB indicates for your app users which audio is playing. Just like the Podcasts app.

Audio Indicator Bars for iOS and tvOS Indicates for your app users which audio is playing. Just like the Podcasts app. Index Requirements and Details

Leonardo Cardoso 285 Nov 23, 2022
The official OS X client to the Radio Paradise web radio.

Introduction Radio Paradise is a unique blend of many styles and genres of music, carefully selected and mixed by two real human beings — enhanced by

Giacomo Tufano 19 Aug 17, 2022
AudioPrism implements the `AnalyserNode` functionality defined in the Web Audio API.

AudioPrism AudioPrism implements the AnalyserNode functionality defined in the Web Audio API. https://webaudio.github.io/web-audio-api/#AnalyserNode U

Yu Ao 2 Dec 20, 2021
SoundManager - A simple framework to load and play sounds in your app.

SoundManager - A simple framework to load and play sounds in your app.

Jonathan Chacón 3 Jan 5, 2022
The easiest way to prepare, play, and remove sounds in your Swift app!

Chirp The easiest way to prepare, play, and remove sounds in your Swift app! ##Installation ###CocoaPods Installation Chirp is available on CocoaPods.

null 309 Dec 17, 2022
KeyAudioManager - A swift package to make it a lot easier to play audio in your app

KeyAudioManager A swift package to make it a lot easier to play audio in your ap

Pedro Esli 3 Apr 28, 2022
Soundable allows you to play sounds, single and in sequence, in a very easy way

Overview Soundable is a tiny library that uses AVFoundation to manage the playing of sounds in iOS applications in a simple and easy way. You can play

Luis Cárdenas 89 Nov 21, 2022
Play and share sound inserts from Medo e Delírio em Brasília, a Brazilian podcast.

Play and share sound inserts from Medo e Delírio em Brasília, a Brazilian podcast.

Rafael Schmitt 18 Dec 26, 2022
Subsonic is a small library that makes it easier to play audio with SwiftUI

Subsonic is a small library that makes it easier to play audio with SwiftUI

Paul Hudson 218 Dec 16, 2022