Documentation Archive


Xcode Overview

Using File Saving

Xcode automatically saves changes to source, project, and workspace files as you work. This feature requires no configuration, because Xcode continuously tracks your changes and saves them in memory. Xcode then writes these changes to disk whenever you:

  • Build and run your app

  • Commit files to a source code repository

  • Close the project

  • Quit Xcode

You can also manually save changes to disk by choosing File > Save.

Xcode lets you revert files and entire projects to a previous state; you can also discard those changes. You use source control management to keep track of changes at a fine-grained level.

Reverting to the Last Saved Version of a File

To discard all changes you’ve made to a file since it was last saved to disk, choose File > Revert to Saved. The Revert to Saved command operates only on the file that has the editing focus. Give editing focus to a file either by clicking its editor pane or by selecting it in the project navigator. For example, you experiment with a new user interface layout and then decide to revert to the previous layout. Or you need to undo some code changes because they introduced a problem.

The Revert to Saved command always returns the contents of the file to the last saved version on disk. If you prefer to back out changes one change at a time, use the Undo command in the Edit menu.