Learn Courses My Dashboard

Cannot parse JSON from very first step

I am stuck on module 2, while trying to decode JSOn file.
Let say my JSON file is datas.json ( as shown on the left column of Xcode). I declared the first step of decode JSON like:
let pathString = Bundle.main.path(forResource: “datas”, ofType: “json”)
but the error occurs: can not find “bundle” in scope
anyone can tell me what I did wrong please

I found the answer. WHen I create a new file (DataServices), I’ve deleted the first line including “import Foundation”

Haha it happens! You need this at the top of almost every file

1 Like