super.viewDidLoad()
let url = URL(string: "https://pokeapi.co/api/v2/pokemon?limit=151")!
let session = URLSession(configuration: .default)
session.dataTask(with: url, completionHandler: {(data, response, error) in
print("Datatask!")
guard let data = data else {
print("No data!")
return }
do {
let _ = try JSONDecoder().decode(PokemonList.self, from: data)
} catch let error {
print("\(error)")
}
})
}
.resume()
.resume()
Обсуждают сегодня