Created
April 8, 2018 02:21
-
-
Save mitulmanish/3ae6d6d229138f59358c8d01893bb4ec to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TVShowsViewModel: ViewModelProtocol { | |
var items: [TVShow] = [TVShow]() | |
typealias Item = TVShow | |
var resourceType: ResourceType { | |
return .tv | |
} | |
required init?() { | |
guard let data = try? getData(forResourceType: resourceType) else { | |
return nil | |
} | |
items = extractItems(fromData: data) | |
} | |
func imageUrl(forIndex index: Int) -> String? { | |
return items[index].sanitizedImageUrlString | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment