-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature [RM79] Character List View Model #82
Conversation
ViewModel provides characterCardStates
Changed from get to load considering function does not return anything
//Image(uiImage: characterCardState.image) | ||
//.resizable() | ||
//.aspectRatio(contentMode: .fit) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They not to commit commented out code.
private func getIsAlive(character: Character) -> Bool { | ||
if character.status == "Alive" { | ||
return true | ||
} | ||
|
||
return false | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I remember correctly there is also state unknown
. is the bool correct choice here?
private func getFirstEpisode(character: Character) -> String? { | ||
if let firstEpisode = character.episodeURLs.first { | ||
return firstEpisode | ||
} | ||
|
||
return nil | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you're returning nil this code doesn't do anything. you could just call character.episodeURLs.first
|
||
func loadCardStates() { | ||
characterRepository.getCharacters { characters in | ||
for character in characters { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about using .map
here
https://github.com/orgs/novoda/projects/1#card-66586073
Built a view model which provides card states to the character list view. A card state factory was also built for utility.