The most secure way is using professional third-party software like iPhone Data Eraser, which is a reliable and effective tool to smash everything on your iPhone, including contacts, messages, photos, videos, apps, account info, passwords, photos and other personal data.