I know that if we do not gave permission to user with Supports opening documents in place
in iOS, user cannot get access to file or folder created with app and it would stay unreachable to user and private to Developer, the code that I am using in iOS is like this one:
let fileName = "sample"
let documentDirectoryUrl = try! FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor: nil, create: true)
let fileUrl = documentDirectoryUrl.appendingPathComponent(fileName).appendingPathExtension("txt")
How ever using this code in macOS would expose our file or data to user! Which I would like keep it private. I am not looking to make it hidden, I am looking to make it impossible to access from user side. How can I do this in macOS?