Pokemon To Shakespearean Kit Build Status

This kit provide 3 functions intergrate PokéAPI and Shakespeare translator API


pikachu!


Search pokemon's English description with name

public func getPokemonEnglishDescription(with name: String, callback: @escaping ((String)->())) 

Search pokemon's English description with name and translated it to Shakespeare style

public func getShakespeareanDescription(with name: String, callback:@escaping ((String)->()))

Search pokemon's sprites(images) with name

public func getPokemonSprites(with name: String, callback: @escaping ((PokemonResource?)->()))

There will be 8 images url in the PokemonResource.sprites


Install

Clone the repository and open PokemonToShakespeareanKit.xcodeproj and command + b build.
There will build a PokemonToShakespeareanKit.framework for ios.
Add this framework to your project.
Then import PokemonToShakespeareanKit to your code

import PokemonToShakespeareanKit

Then use the functions. For example

getShakespeareanDescription(with: name) {[weak self] (description) in
                guard let self = self else {return}
                DispatchQueue.main.async {
                    self.label.text = description
                }
            }
            
getPokemonSprites(with: name) {[weak self] (result) in
                guard let self = self else {return}
                if let pokemon = result {
                    DispatchQueue.main.async {
                        
                        self.imageView1.downloaded(from: pokemon.sprites.frontDefault)
                        self.imageView2.downloaded(from: pokemon.sprites.backDefault)
                        self.imageView3.downloaded(from: pokemon.sprites.frontShiny)
                        self.imageView4.downloaded(from: pokemon.sprites.backShiny)
                    }
                }
            }

Take a look at the full example in PokemonToShakespeareanApp.
Open PokemonToShackspeare.xcworkspace.
Select PokemonToShakespeareanApp scheme.
Command + r run the app.


Tests

Open PokemonToShakespeareanKit.xcodeproj and command + u start test.
Tests will pass in first 5 times.
When achieve Shakespeare translator API request limied. 5 request / hour. Tests will fail. (lol)

Don't forget PokéAPI api only accept lowercases

let name = text.lowercased()