Created
April 8, 2018 02:22
-
-
Save mitulmanish/d035bdc05ee6f42bc9e3f16e78ab0c3a 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 MoviesViewModel: ViewModelProtocol { | |
var resourceType: ResourceType { | |
return .movies | |
} | |
var items: [Movie] = [Movie]() | |
typealias Item = Movie | |
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