I need to check the value of a variable returned from a function in Swift with a type of UnsafeMutablePointer?.
Here's the declaration:
var isDirectory: UnsafeMutablePointer<ObjCBool>?
When I print it out:
print(isDirectory)
I get:
nil
I am not very well versed in mixing Swift with Objective-C. Any help would be appreciated.
Here is my actual entire code:
let directoryURL: URL = try! FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor: nil, create: false)
let pathOldLocalStorage: String = directoryURL.path + "/OldLocalStorage"
FileManager.default.createFile(atPath: pathOldLocalStorage, contents: nil, attributes: nil)
var isDirectory: UnsafeMutablePointer<ObjCBool>?
let fileExists: Bool = FileManager.default.fileExists(atPath: pathOldLocalStorage, isDirectory: isDirectory)
print("fileExists=", fileExists, "isDirectory=", isDirectory as Any)
Here is the debug window results:
fileExists= true isDirectory= nil