How do I get the root directory of my iOS app?
I am able to access the temporary directory for the current user of my iOS app, and I am able to access the bundle path as the following code shows:
print(FileManager.default.temporaryDirectory)
print(Bundle.main.bundlePath)
How do I access the root directory of the app for the current user? I need to create a cache directory or a Documents directory according to the instructions in the documentation in this link:
(https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/FileSystemOverview/FileSystemOverview.html#//apple_ref/doc/uid/TP40010672-CH2-SW13)
The beta version of Xcode provides for a property that gives access to the home directory, but the latest release of Xcode does not.
Solution 1:
let fileManager = FileManager.default
let pathOfDir = fileManager.currentDirectoryPath
print(pathOfDir)
This is use for get your root directory