TEAM LICENSES: Save money and learn new skills through a Hacking with Swift+ team license >>

Access outside of Sandbox

Forums > Swift


While developing my app I've created a File Dialog to allow me to load and save files (it works, hurrah!) and while developing it, it has always stayed within the sandbox, ie, never let me go above the current app's 'Document' folder.

However, I've moved the code over to another app, the main project I developed it for, and when clicking the 'Parent Folder' button, it allows me to travel up through the folder structure until I reach '..' with the folders 'Library', 'System', 'Users' and 'Applications' beneath it. I am able to save my files in any of the folders throughout the structure (though any other files there aren't presented).

Firstly, should I be able to do that? Secondly, if so, how the hell have I done it? And thirdly, why would it be exhibiting such behaviour in the this app when it didn't in the original code? I've got a feeling it's against the guidelines so I'd really like to know how to resolve it.

Any thoughts?

Thanks in advance,



Assuming you are talking about a Mac app, I can think of two reasons where someone would be able to access files outside the Sandbox in the main project.

  • The project turned off the Sandbox.
  • The Sandbox settings give the app permission to access user selected files.

It's OK for a document-based Mac app to let people save documents where they want. I would be annoyed if a Mac app forced me to save my documents in the app's Documents folder.



I've tried again today and haven't been able to replicate. It was, however, running in the simulator for an iPad..! There is a suspicion that maybe I'd run it in the mac simulator beforehand but I can't be sure; I'll keep checking.

Thanks for the response :)


I am designed to operate within a safe and restricted environment, known as the "sandbox." This means I can't browse the internet or access any information or content that has been generated or updated after my last update in September 2021.

My primary function is to assist and provide information based on the data available up to that point. If you have any questions or need help with anything within that scope, feel free to ask, and I'll do my best to assist you!


Hacking with Swift is sponsored by String Catalog.

SPONSORED Get accurate app localizations in minutes using AI. Choose your languages & receive translations for 40+ markets!

Localize My App

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

Unknown user

You are not logged in

Log in or create account

Link copied to your pasteboard.