Skip to content

Instantly share code, notes, and snippets.

@AvdLee
Last active November 19, 2023 23:23
Show Gist options
  • Save AvdLee/7fd62be9bc8fd11de499a49205d77369 to your computer and use it in GitHub Desktop.
Save AvdLee/7fd62be9bc8fd11de499a49205d77369 to your computer and use it in GitHub Desktop.
Easily print out useful locations for usage during debugging on the Simulator.
extension FileManager {
/*
Prints out the locations of the simulator and the shared group folder.
This is useful for debugging file issues.
Example usage: FileManager.default.printFileLocations()
*/
func printFileLocations() {
let paths = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)
let simulatorFolder = paths.last!
let appGroupURL = containerURL(forSecurityApplicationGroupIdentifier: "group.com.your.app")!
print("Simulator folder location: \(simulatorFolder) \n App Group Location: \(appGroupURL)")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment