目录
目录README.md



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")
    )
}
关于
1.2 MB
邀请码
    Gitlink(确实开源)
  • 加入我们
  • 官网邮箱:gitlink@ccf.org.cn
  • QQ群
  • QQ群
  • 公众号
  • 公众号

©Copyright 2023 CCF 开源发展委员会
Powered by Trustie& IntelliDE 京ICP备13000930号