A possibly thrown error in let jsonData = try JSONSerialization ... is not handled.
You can ignore a possible error, and crash as penalty if an error occurs:
let jsonData = try! JSONSerialization ...
or return an Optional, so jsonData is nil in error case:
let jsonData = try? JSONSerialization ...
or you can catch and handle the thrown error:
do {
let jsonData = try JSONSerialization ...
//all fine with jsonData here
} catch {
//handle error
print(error)
}
You might want to study The Swift Language