a simple swift client to easily work with xivapi
- Xcode -> File -> Add Package Dependency
- paste this repository url:
https://github.com/Eisenhuth/xivapi-swift.git
- Add Package
import Foundation
import xivapi_swift
//create the client, either with or without a key
let xivapi = xivapiClient()
let xivapiWithKey = xivapiClient(private_key: "my-api-key")
let tincture = await xivapi.getItem(itemId: 39727)
let tinctureRecipe = tincture?.Recipes?.first
let recipe = await xivapi.getRecipe(id: tinctureRecipe!.ID!)
let ingredients = recipe?.ingredients
let ingredientIds = recipe?.ingredientIds
for id in ingredientIds! {
let response = await xivapi.getItemName(itemId: id)
let name = response?.Name
print(name!)
}