Here's the code:
let jsonData = NSData(contentsOfFile: "/Users/7stud/xcode_projects/iOS/my_json.json")
That code is in a playground, and I get nil for jsonData. I didn't type the path: I dragged the file from Finder to a Terminal window, which enters the full path of the file at the point of the cursor. Then I copied that absolute path and pasted it into my code--so no typo.
According to the docs:
NSData
+ dataWithContentsOfFile:
Creates and returns a data object by reading every byte from the file specified by a given path.
Declaration OBJECTIVE-C
+ (instancetype)dataWithContentsOfFile:(NSString *)pathParameters
path | The absolute path of the file from which to read data.Return Value
A data object by reading every byte from the file specified by path. Returns nil if the data object could not be created.
There's no Swift definition.