Easy access to files saved inside documentDirectory

In Swift Playgrounds on macOS, when we create a new file in .documentDirectory given by FileManager, we can always search for the results in e.g. ~/Library/Developer/Xcode/DerivedData/[project-specific]/Build/Products/Debug . I guess this location may change anytime.

I know that Xcode is not Matlab, but is there a folder / a shortcut / any place in the IDE that includes the resulting files, or even presents a live preview of created files (.csv) for easy inspection?

Answered by Dirk-FU in 737377022

You can alway add

    #if targetEnvironment(simulator)
        print("Documents Directory:\n\(URL.documentsDirectory.path())")
    #endif

somewhere in the initialization of your app code and print the path to the console.

Or use the following app https://github.com/twostraws/ControlRoom for additional features the simulator should have, including access to the documents directory and the directory where the Files App stores its data.

Accepted Answer

You can alway add

    #if targetEnvironment(simulator)
        print("Documents Directory:\n\(URL.documentsDirectory.path())")
    #endif

somewhere in the initialization of your app code and print the path to the console.

Or use the following app https://github.com/twostraws/ControlRoom for additional features the simulator should have, including access to the documents directory and the directory where the Files App stores its data.