Search code examples
iosswiftitunes

Generate song suggestions (auto-complete)


I'm developing an app and I want a user to be able to start typing a song name/artist/whatever and then have a list/drop-down show suggestions on the fly depending on what the user typed (preferably as the user is typing).

I was thinking I would need to use some sort of API which queried the iTunes database for songs available for purchase (or any other large database with song information), but I'm open to using any other source.

Does anybody know of an API I can look into or a framework I can use. I don't need a solution in code or anything, I'm simply asking for a nod in the right direction.

Let me know if you need anymore information. Thanks.


Solution

  • Apple exposes a search API for the iTunes Store. That should help you. https://www.apple.com/itunes/affiliates/resources/documentation/itunes-store-web-service-search-api.html

    Here's a writeup by Apple describing the API: https://www.apple.com/itunes/affiliates/resources/blog/introduction---search-api.html

    From there, you just have to hit the endpoint with the appropriate parameters and then display the results. The endpoint is:

    https://itunes.apple.com/search?parameterkeyvalue