Last active
October 30, 2017 19:39
-
-
Save soxjke/0cc9bf43994103b08c6d26064f19e9b3 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
import Foundation | |
enum LocationState { | |
case notYetRequested | |
case notAvailable | |
case available | |
} | |
enum LocationRequestState { | |
case none | |
case updating | |
case success(latitude: Double, longitude: Double, timestamp: TimeInterval) | |
case error(error: Error) | |
} | |
struct AppLocation { | |
let locationState: LocationState | |
let locationRequestState: LocationRequestState | |
} | |
enum GeopositionRequestState { | |
case none | |
case updating | |
case success(geoposition: Geoposition) | |
case error(error: Error) | |
} | |
enum WeatherRequestState { | |
case none | |
case updating | |
case success(currentWeather: Weather, forecast: [Weather]) | |
case error(error: Error) | |
} | |
struct AppWeather { | |
let geopositionRequestState: GeopositionRequestState | |
let weatherRequestState: WeatherRequestState | |
} | |
struct AppState { | |
let location: AppLocation | |
let weather: AppWeather | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment