Learn Courses My Dashboard

Björn's Stock Tracker App

Hi there,

After wrapping up the SwiftUI foundations course I thought it would be fun to look into the monthly challenge to apply what I learned so far.

I did not spend much time on comparing API’s, I picked Alpha Vantage as this was the first decent one that I found, the quota of max 5 requests / min is a bit of a downside but it provides the info we need so for this challenge it works fine.

For the theme of the app I thought it would be fun to use something ‘notepad-like’, so I downloaded a custom font and made the background slightly yellow. For the icons I used simple SF symbols. I also reused the dashed line from the City Sights App :wink:

So far the app has the basic functionality:

  • add / remove tickers
  • refresh the list to update the numbers
  • persist the list of stocks on update so that it can be read out again when starting a new app session
  • (because for me the percentage changes are way more useful) tap on numbers to switch from absolute to percentage view

Things that I still need to look into

  • validation: check for valid ticker, check for duplicates…
  • error handling: e.g. API errors / quota limit
  • push notifications / alerts


I like the design!! Nice job so far! :clap::clap:

Nice creativity with the Font

Added some features to the app:

  • show error on duplicate or invalid ticker
  • add loading (ProgressView) state when adding a new ticker or when refreshing stocks as this might take some time
  • add detail view with chart and the possibility to add simple alerts which are also persisted using the same method as for the stock watchlist. (actual notifications not implemented yet, will see how far I get)

For the charts I use the Charts third party library: GitHub - danielgindi/Charts: Beautiful charts for iOS/tvOS/OSX! The Apple side of the crossplatform MPAndroidChart.
Lost quite some time on the chart as I wanted to do a candlestick chart but for some reason it would only show the first candle, so I then switched to a simple line chart which seemed to work as expected.

I also found out that unfortunately the data provided by Alpha Vantage has a delay of one day, so it’s not really useable to track intra day movements.

1 Like

Yesterday I managed to get some basic alerting logic in place.
I also updated the list of alerts to show which ones are active (can trigger on refresh).

I will upload the final result tomorrow :slight_smile:

In this challenge I learned quite some new things:

  • how to download and use custom font
  • work with user text input field and handle change / commit / errors
  • work with 3rd party library (charts)
  • work with async group to wait for multiple request completions
  • use of local notifications and setting a delegate to allow notifications while app is running in foreground

Looking forward to the next challenges!