This project is about creating a simple in-game information searching app for the video game Diablo 3, using the official Blizzard API. The Blizzard API provides not only the Diablo 3 API, but also APIs for Starcraft 2, WoW, and the Overwatch League. It is possible that Blizzard may open up the Diablo 4 API after the game's release. As the Blizzard API already provides access to APIs for other popular games like Starcraft 2, WoW, and the Overwatch League, it would not be surprising if they added Diablo 4 to their list of available APIs. We will have to wait and see what Blizzard decides to do, but the potential for a new API is exciting for both players and developers alike.

In this project, I will create a Diablo 3 api app(act, artisan, and recipe info etc…), and also use SwiftUI and TCA. This app dose not cover the complete UI, but rather focuses solely on networking with the Blizzard API and parsing data received from it.

artwork-0131-large.jpg

1️⃣ Create Blizzard Api access

First, we need to login with our account on the Battlenet development portal. The link is down below:

If you do not currently have an account, you will need to create one and also register an authenticator.

Screenshot 2023-04-26 at 12.44.28 PM.png

After completing the previous step, proceed to click on API Access and then Create Client. Note, you should not share the Client ID and Client Secret generated during this process with anyone. Additionally, please be aware that Blizzard only supports HTTP and HTTPS URIs. Therefore, if you wish to add login access to your application, you will need to set up your own server to achieve this.

Finally, it is recommended that you consult Blizzard’s documentation. For this project, the relevant documentations are provided below:

2️⃣ Setting up Xcode project

In order to use the Blizzard API, we require both the Client ID and Client Secret. Therefore, it is imperative that we securely store these credentials within the project. I will use the xconfig file.

1. create configuration file into the project.

  1. create configuration file into the project.

Click File > New > File… and create a configuration file. I named Secrets.