Skip to content

Latest commit

 

History

History
46 lines (28 loc) · 1.8 KB

File metadata and controls

46 lines (28 loc) · 1.8 KB

Pokemon API

Resources needed:

PART 1

  • Create and call a function that fetches data from the Pokemon API to fetch a list of Pokemon. This is the endpoint: /pokemon
  • In your data tasks' completion handler, convert the returned data object to JSON, and print your converted jsonObject to the debug console.
  • Use a Pokemon struct that conforms to the Codable protocol (it will only have two properties at this point: name and url)
  • Handle the HTTP error object returned and any other validation you want to include (status, data, etc.)

PART 2

Create a table view that supports pagination:

  • Uses a cell to present the name of the Pokemon from the JSON response returned
  • When scrolled to the end of the currently available data, the app must fetch new data to enable pagination.
  • Check the section "Resource lists and pagination" straight from the docs: https://pokeapi.co/docs/v2.html/ In the end you will have a table view that keeps on getting new data for Pokemon as you reach the end of the scroll.

PART 3

  • Besides just showing the name of the Pokemon, include their picture in the cell.
  • Use this library to load pictures: Kingfisher

Example implementations

  • Example 1

  • Example with images in table view

demo

Inspiration: Sample projects using the Pokemon API

Alternative API: https://swapi.dev

If you don't feel like fetching Pokemon, use the Star Wars API.

  • Using the /people/ endpoint
  • Use a cell to present the "name" and 1 other property/items (i.e.. "height") from the JSON response returned