3

I am looking to support Apple Music and Spotify in an iOS app (Swift specifically) and I was wondering what the best way to support would be?

Should I just use MusicKit and Spotify iOS SDK and then make models to support data from both?

If so, then how do I find Spotify iOS SDK instances for their structs? For example:

Apple's documentation for Albums shows all of it's instances:

https://developer.apple.com/documentation/musickit/album

But Spotify's documentation for Albums doesn't show many instances:

https://spotify.github.io/ios-sdk/html/Protocols/SPTAppRemoteAlbum.html

Papi
  • 255
  • 1
  • 2
  • 13

1 Answers1

3

That depends on what your app will look like, I guess. Do you want to show Apple Music (AM) and Spotify content alongside each other? Or do you want to strictly separate them into different parts of the app?

For the former, I don’t see a way around creating common structs for albums, artists, tracks, etc. That extra step would ensure your UI always got the same kind of structured object. You’d make the SDK calls, get your AM/Spotify-provided objects, and cast them into the struct you need for your app. You’d probably want to keep track if the struct originated from a AM or a Spotify object.

As to Spotify SDK: If that’s really the only documentation available (which, apparently, it is), you’d probably want to analyze the SDK yourself. What kind of data is returned from these URIs (e.g., JSON/XML data)? What do these SPTAppRemoteAlbum objects actually contain? Can you create intermediary objects for better handling?

a_hausb
  • 161
  • 1
  • 9