try it
to extract from local path use contentsOfFileelse usecontentsOfURL
let contents: NSData?
do {
contents = try NSData(contentsOfFile: "/Users/User/Desktop/Employee.json", options: NSDataReadingOptions.DataReadingMappedAlways)
} catch _ {
contents = nil
}
print(contents)
if you want to access only contentsOfFileuse the following line
let contents = NSData(contentsOfFile:"/Users/User/Desktop/Employee.json")
print(contents)
source
share