How to Delete Data from iPhone, iPad
Once you’ve backed everything up to two different storage devices, just in case, or an external drive and a cloud service, it’s time to properly delete all data from your device. If your phone was purchased within the last few years, simply choosing to restore or 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 trying to recover your data.
First, make sure to turn off all services, starting with Find My iPhone — Settings | [Account Name] | Find my | find my iphone and press the toggle switch towards gray; you will need to enter your Apple ID password to disable it completely. Also log out of other devices, such as iMessage, Settings | Posts | Send and receive | the link that is your Apple ID basically | Sign out.
Next, sign out of iCloud completely by going to Settings | [Account Name] | Sign out all the way to the end. Type your Apple ID password. Choose now Delete account. This will also sign you out of your Apple ID on that device.
Now start the erasing process by going to Settings | General | Transfer or Reset iPhone | Erase all content and settings. Then press the Continue at the bottom of the screen and follow the instructions. The process is similar for all iPads since 2011, which also offer encryption when you set up a passcode. To completely clean your tablet, go to Settings | General | Transfer or Reset iPad | Erase all content and settings.