Thank you. I am trying to get it to display the decoded values from the content model do you know why this is not working? Because with the above method wouldn't I have to input the value myself? here is the function
`func getNFLTeams() {
let headers = [
"x-rapidapi-host": "sportspage-feeds.p.rapidapi.com",
"x-rapidapi-key": ""
]
let urlString = "https://sportspage-feeds.p.rapidapi.com/teams?league=NFL"
let url = URL(string: urlString)
if url != nil {
var request = URLRequest(url: url!, cachePolicy: .reloadIgnoringLocalCacheData, timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request) { data, response, error in
if error == nil {
do {
let decoder = JSONDecoder()
let result = try decoder.decode(NFL.self, from: data!)
print(result)
}
catch {
print(error)
}
}
}
dataTask.resume()
}
}`
I was able to parse the JSON into the app but now I am having trouble displaying the parsed values any help would be great thank you!
@Claude31
Post
Replies
Boosts
Views
Activity
Thank you for your help!