-
Notifications
You must be signed in to change notification settings - Fork 13
Spectator Live Game
Spectator methods provide informations about participants in current games.
- LiveGame(by: SummonerId, on: Region)
- FeaturedGames(on: Region)
- SummonerId: Represents the unique identifier of a summoner. See Summoners to get this identifier.
- Region: The region where the summoner plays.
Since this method is asynchrone, there is not return value. Response will be provided with a handler closure with parameters: (GameInfo?, String?)
. GameInfo contains informations about a live game with its participants and will be nil only if summoner was not found on this region or is not currently playing. The String parameter contains the first error description encountered if existing.
league.lolAPI.getLiveGame(by: SummonerId("xc8IRVLGV1Gb75sbz8JoLdRvIJ_yAKNsSG1RBQVtnGZqZV8"), on: .EUW) { (liveGame, errorMsg) in
if let liveGame = liveGame {
print("Success!")
}
else {
print("Request failed cause: \(errorMsg ?? "No error description")")
}
}
- Region: The region where the summoner plays.
Since this method is asynchrone, there is not return value. Response will be provided with a handler closure with parameters: (FeaturedGames?, String?)
. FeaturedGames contains a list of GameInfo objects. GameInfo contains informations about a live game with its participants. Result will be nil only if an error occured. The String parameter contains the first error description encountered if existing.
league.lolAPI.getFeaturedGames(on: .EUW) { (featuredGames, errorMsg) in
if let featuredGames = featuredGames {
print("Success!")
}
else {
print("Request failed cause: \(errorMsg ?? "No error description")")
}
}