Last active
May 30, 2018 08:38
-
-
Save geekforbrains/2a0ac7e3233c4116e1df to your computer and use it in GitHub Desktop.
Print the full path to your iOS simulators documents directory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#if arch(i386) || arch(x86_64) | |
let documentsPath = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)[0] as! NSString | |
NSLog("Document Path: %@", documentsPath) | |
#endif |
A Swift 4 updated-version:
extension UIDevice {
class func printFolderPath() {
let documentsPath = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0]
NSLog("✅ \(documentsPath)")
}
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I use this in the AppDelegate to print out the full path. Makes it easier to quickly access that directory. The #if block ensures its only run in dev mode (simulator).