Yes, unlocking your iPhone without a passcode will erase all data, but if you’ve been regularly backing up your iPhone via iCloud or iTunes, you can restore everything after resetting.