How to only display selected crypto coins from an API call

As my first Swift app I like to build a crypto currency converter using Swift UI and struggle to find a way to filter out selected crypto coins from an API call.

For example:
The following API call returns the top 100 crypto coins.
https://api.coingecko.com/api/v3/coins/markets?vs_currency=eur&order=market_cap_desc&per_page=100

  • How can I create a list for the user to select one or multiple coins?

  • How can I display only the information of the selected coins?

I am thinking to store the user selection in an array and filter out the coins from the API that match the same name but can't figure out how to do it.

Any guidance or pointer to learning material that can help me to figure this out would be much appreciated.

You should look in to JSON parsing. Here are a few tutorials I managed to find with a quick Google search:

If you follow those, you should be able to transform the response from that API call in to something usable, which you can then easily filter and display.

1 Like

Thank you Karl!

The first link shows what I am doing currently to get all results to display.
The second link shows how to work with the data and looks like what I need to learn to solve my problem.

Terms of Service

Privacy Policy

Cookie Policy