Grand Prix Stats is an application for Apple TV that provides information about the Formula 1® driver and constructor championships.
The application provides the following information:
Grand Prix Stats includes information from all seasons from year 2000 to year 2015. Navigation between seasons is done using a previous/next season format, where the user can quickly move from one season to another.
Season Navigation Menu
Season Calendar
Race Menu - 2015 United States Grand Prix
Race Results
Qualifying Results
Starting Grid
Fastest Laps
Race Track Layout
Driver’s Championship Standings
Constructor’s Championship Standings
Open the App Store application on your Apple TV and search for “Grand Prix Stats”. The application should appear on the list.
Grand Prix Stats was developed in:
All data displayed by Grand Prix Stats is provided by the Ergast Motor Racing Developer API.
class RaceService {
static let sharedInstance = RaceService()
func loadQualifyingResults(race: Race, callback: [QualifyingResult] -> Void) {
JSONRequest.get("\(Ergast.baseURL)/\(race.season)/\(race.round)/qualifying.json?limit=30") { result in
switch result {
case .Success(let data):
let json = JSON(data!)
let results = json["MRData"]["RaceTable"]["Races"][0]["QualifyingResults"].arrayValue
callback(results.map { QualifyingResult(json: $0) })
case .Failure:
callback([])
}
}
}
func loadRaceResults(race: Race, callback: [RaceResult] -> Void) {
JSONRequest.get("\(Ergast.baseURL)/\(race.season)/\(race.round)/results.json?limit=30") { result in
switch result {
case .Success(let data):
let json = JSON(data!)
let results = json["MRData"]["RaceTable"]["Races"][0]["Results"].arrayValue
callback(results.map { RaceResult(json: $0) })
case .Failure:
callback([])
}
}
}
}
struct Circuit {
var circuitId: String
var name: String
var url: String
var location: Location
init(json: JSON) {
circuitId = json["circuitId"].stringValue
url = json["url"].stringValue
name = json["circuitName"].stringValue
location = Location(json: json["Location"])
}
}