League of Legends API

Today is the first day of class this semester. I still have forty minutes before the section that I TA for starts, so I’m writing about my new iOS project.

The other day I came across with League of Legends API. As a LOL summoner and an iOS developer, I felt obligated to do something with it. The app let users search players with their summoner names and view their stats. In the near future, it will also provide a function like LOL nexus, which shows the summoners a user is playing with before entering the game.

Intuitively, I used a TabViewController as the initial view controller for the app since I have several “categories” of functions. These categories include the following:

  1. basic data about LOL: maps, champions and spells etc.
  2. search for a player by summoner name
  3. view players the user is against

The API is very handy. It also let developers try them out on the webpage, but they could add a search function. I am using Alamofire as the networking tool. I followed the instructions written by Ray Wenderlich to set it up.

There are several things that I noticed when writing the code:

  1. summoner names can contain spaces, I escaped that with

    which translates spaces into “%20″s.

  2. a lot of things returned by the server are optional. I have to unwrap them as soon as possible, otherwise when they are cast into String, “optional” will be there and that is not good to hear.
  3. the status code returned has to be 200 for the app to continue.

Here’s the GitHub Project Page

Comments are closed.