Last active
September 6, 2020 18:42
-
-
Save Plnda/05a7760933cc00dbdfa305735b1dfc57 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 WeatherViewModel: NetworkViewModel, ObservableObject { | |
typealias NetworkResource = Weather | |
var resource: Resource<NetworkResource> = .loading | |
var network: Network | |
var route: NetworkRoute = OpenWeatherRoute.weather | |
var bag: Set<AnyCancellable> = Set<AnyCancellable>() | |
init(with network: Network) { | |
self.network = network | |
} | |
} |
Hi Can you please explain this line typealias NetworkResource = Weather.
What is Weather here? Can you please upload the whole source code.
Weather in this case will be the decodable that is returned by the api, so this will be your model that will confirm to Codable / Decodable
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi Can you please explain this line typealias NetworkResource = Weather.
What is Weather here? Can you please upload the whole source code.