Previous episode: 05. Using AsyncSequence in Views
Next episode: 07. Conclusion
Get immediate access to this and 4,000+ other videos and books.
Take your career further with a Kodeco Personal Plan. With unlimited access to over 40+ books and
4,000+ professional videos in a single subscription, it's simply the best investment you can make in
your development career.
Your challenge is to handle one more error. What if the server stops while you're in the live ticker view? Is your app still running from episode five? To make sure the prices are updating, tap live ticker again. In terminal, press control C to stop the server. In the app, there's no error message as far as the app is concerned, the AsyncSequence task completed and its job is done. The app needs to reset ticker symbols when the AsyncSequence ends, and then navigate back to symbol list view. Remember to restart your server. Your challenge is to handle one more error. What if this server stops while you're in the live ticker view? If the AsyncSequence ends the for loop and start ticker exits. So add code after the for loop to set ticker symbols to an empty array. Remember to use main actor. In ticker view, add a view modifier that keeps track of the number of elements in ticker symbols and dismisses the view if this value resets to zero. Use the presentation mode environment property already included in ticker view. Good luck. (upbeat music plays) Welcome back. Hopefully you had success with handling this error but let's go over how I did it and get on the same page. In Little John model, in start ticker below the for loop, I added this code. In ticker view I added this below the task closure. Build and run. Select some stocks. Tap live ticker, then stop your server. Use the app switcher to get to the terminal and press control C. And now the app automatically dismisses the live ticker screen and returns to the symbol list. Remember to restart your server.
All videos. All books.
One low price.
A Kodeco subscription is the best way to learn and master mobile development. Learn iOS, Swift, Android, Kotlin, Flutter and Dart development and unlock our massive catalog of 50+ books and 4,000+ videos.