Swiftpack.co - juliand665/LeagueKit as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by juliand665.
juliand665/LeagueKit v0.2.0
Swifty access to League of Legends data
⭐️ 1
🕓 4 years ago
.package(url: "https://github.com/juliand665/LeagueKit.git", from: "v0.2.0")



Swift Package Manager compatible MIT licensed

LeagueKit

Swifty access to League of Legends data


Installation

LeagueKit uses the Swift Package Manager. Simply add .package(url: "https://github.com/juliand665/LeagueKit.git", .branch("master")) to the dependencies in your Package.swift file.

If you're using an older version of Xcode (pre-11), there's both a release and a branch with the old, Carthage-compatible version.

Usage

Static Data

To get started, update an object manager using the static data client, e.g.:

let champs = Champions.shared
StaticDataClient.shared.update(champs)

Once you've done that, you can access the values and do as you please:

let cait = champs.contents["Caitlyn"]!
let attackSpeed = cait.stats.attackSpeed.value(atLevel: 10)
let image = NSImage(byReferencing: cait.imageURL)
let results = champs.assets(matchingQuery: "ca")

Dynamic API

The current API for this is pretty limited, but it does cover several endpoints, e.g. the free champion rotation:

let dynamicClient = DynamicAPIClient(apiKey: myAPIKey, region: .euw)
dynamicClient.send(ChampionRotationRequest()).then { rotation in
	print("free champs:")
	print(rotation.freeChampions
		.map { "• \(champs[$0]!.name)" } // using the static data to find out which name corresponds to which ID
		.joined(separator: "\n")
	)
}

GitHub

link
Stars: 1
Last commit: 4 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Dependencies

Release Notes

Initial SwiftPM Release
4 years ago
  • migrated to use SwiftPM rather than Carthage
  • updated to Swift 5

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics