Learn Courses My Dashboard

Johannes - App Journey Journal

NBA Stats Community App Challenge

Link to project on github

Images of the app

scores_dark_small
scores_light_small

standings_dark_small
standings_light_small

settings_light_small
standings_dark_small

TODO List

  • Create project in Xcode
  • Create GitHub repository
  • Add groups to give the app some structure
  • Create tabview to navigate to the three main views
    • Rename ContentView to AppTabView
    • Add tabView
  • Create 3 views (scores, standings, settings)
  • Request sportsdata.io API key
  • Get Team data
    • Create a Team model
    • Create a TeamsModel class to fetch data
    • Create a helper struct to get a request with the neccesary credentials
  • Show all teams in a picker view on the Settings page
  • Store and read favourite team on device
  • Add app header
    • Create view that contains the app header, which should be shown on each page: page title + NBA logo
    • Add AppHeaderView to each page
  • Scores page
    • Add Score struct to represent a game returned from the api
    • Add ScoresModel to fetch scores from api
    • Add picker for yesterday, today, tomorrow
    • Add list with the scores to view
    • Show favourite team on top
  • Add team logos to project
  • Add date picker to settings screen, so that the user can view scores from the past
  • Update layout of Settings page
    • Use a Form view inside a NavigationView
  • Implement Standings
  • Add picker to filter between east and west standings
  • Highlight favourite team in scores page
    • Add a yellow star in the scores card
    • Push the card for the favourite team to the top
  • Add app icon
  • Add README.md

BUGS I need to fix

  • In the Picker on the settings page. The first team in the picker shows as selected, even if the user has not yet selected a team from the picker.
  • FIXED: ScoreCardView does not show correctly in dark mode

What I learned

  • Don’t use the name of an internal SwiftUI view component as the name of your view.

    • I had to rename my view TabView to AppTapView. Xcode gave the error “Argument passed to call that takes no arguments”, when I tried to use a TabView inside my view of the same name.

    • image

  • Picker view selection binding must be the exact type of the item in the content view of the picker

    • When using a Picker view, the selection binding must match the exact type of the item you are showing in the content view of the picker. My selection binding was an optional. You can pass the item as an optional by using a tag modifier on the item in the content view.

    • image

  • Storing and reading data on device with UserDefaults

    • If you want to store small pieces of non sensitive user data on device so it persist between app launches, than you can user UserDefaults.

    • image

  • Format a date inside a TextView

    • For the scores card, we have to show a time when the game is scheduled. You can easily do this with a style parameter inside a TextView

    • image

    • image

3 Likes

Great start!!