I’m at the parsing the JSON into SWIFT Instances and I ran onto small problem,
and this is my code which is the same :
but on mine I have this error and I googled a bit and came up to this solution(solution below), so I wanted to know from the pros is this good way or not. Everything is fine with json file imported properly but maybe something changed so far.
if let path = Bundle.main.path(forResource: "DemoData", ofType: "json"){
let url = URL(filePath: path) (I added. this so problem goes away)
do {
// Read the file and turn it into data
let data = try Data(contentsOf: url)
}
catch {
print("Error occurred: \(error)")
}
// Parse JSON into Swift instances
}