If you intend to sell your iPhone or give it to a friend or family member then there are a number of things you need to do to set the iPhone to factory default settings.
If you don’t remove things like your iCloud and Apple ID from the device then the next person who has it will not be able to use it properly.
Aaron from Zollotech has put together a great video on how to reset your device, in order to do this you will need your passcode and also your iCloud password.
As we can see from the video there are a number of steps you need to follow to ensure the iPhone is properly reset back to the factory default. Make sure you follow the steps related to iCloud otherwise the next person who has the handset may have issues with it.
Source & Image Credit: Zollotech