Skip to content

Instantly share code, notes, and snippets.

@victor-gesit
Created June 18, 2022 17:53
Show Gist options
  • Save victor-gesit/5c1c564b595a2aaefeb4e23fa6491336 to your computer and use it in GitHub Desktop.
Save victor-gesit/5c1c564b595a2aaefeb4e23fa6491336 to your computer and use it in GitHub Desktop.
30: move the string literal out to a util and pass it in as a variable. Also, remove the force unwrap.
35: make `self` weak to avoid a retain cycle.
50: isLoading is a boolean. No need for comparison with `!false`. `if isLoading` should do.
61: Declare showDetailView as a @State variable and pass $showDetailView into isActive.
67: You may want to move all string literals out to somewhere central, to ease localization in the future
90: after fetching the albums, I see no where `isLoading` is toggled back, to hide the `ProgressView`. Pass the responsibility of managing the loading state (`isLoading`) to the view model, and make it a @Published variable. That way you can easily toggle it when the API call is completed.
107: Did you mean to map the response from the API call? URL does not have a map function, or does it? Did you mean to declare `coverArtUrl` as an array? There will be an error there.
126: You're not checking to see if if UIImage(data:) resolves to nil. That force unwrap may cause a crash.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment