How to delete data from an iPhone, iPad
Once you’ve backed up everything to two different storage devices, just in case, or an external drive and a cloud service, it’s time to properly remove all data from your device. If your phone was purchased within the past several years, simply choosing to restore or factory reset your device will work just fine.
iPhones running iOS 5, which debuted in 2012, or later include hardware encryption when you set a passcode. This makes it extremely difficult for anyone who tries to recover your data.
First, be sure to turn off all services, starting with Find My iPhone — Settings | [Account Name] | Find My | Find My iPhone and tap the toggle switch to gray; you’ll have to enter your Apple ID password to fully turn it off. Sign out of other devices, such as iMessage, Settings | Messages | Send & Receive | the link that is your Apple ID at the bottom | Sign Out.
Then sign out of iCloud completely by going to Settings | [Account Name] | Sign Out all the way at the end. Type in your Apple ID password. Now choose Delete Account. That will sign you out of your Apple ID on that device, too.
Now start the wipe process by going to Settings | General | Transfer or Reset iPhone | Erase All Content and Settings. Then tap the Continue at the bottom of the screen and follow the prompts. The process is similar for any iPad since 2011, which also offer encryption when you set up a passcode. To completely wipe your tablet clean, go to Settings | General | Transfer or Reset iPad | Erase All Content and Settings.