When restoring an iPhone you have the option to restore from a backup or you can restore to factory defaults. If you restore to factory defaults then yes, everything will be gone—your files, your contacts, your apps, and so on. If you have a backup, though, you can rescue your lost data by simply restoring the backup onto your iPhone after it is wiped. We recommend restoring an iPhone if you are having major software issues. So, as always, it is important to backup frequently.