How do I get the documents directory in Swift?
I've done it a hundred times in Objective-C.
The expression I found for doing this in Swift is:
let documentsPath: String = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0] as String
When I run my app and stop in the debugger and try to display this string, the debugger prints "<variable not available>".
If I ignore that and try to create a file anyway, the file handle comes back nil:
let filePath = "\(documentsPath)/data.bin"
let file: FileHandle? = FileHandle(forWritingAtPath: filePath)