The ability to take your iPhone, iPod touch, or iPad into an Apple Store for service is great—but handing over all of your personal info? Not so much. If you’re getting your iOS device replaced, selling it, or simply handing an older model over to a family member, you’ll want to get all your contacts, calendars, and other personal data off the device—and luckily, there’s an easy, built-in feature in iOS for doing exactly that.
Open the Settings app, tap on General, and scroll to the bottom of the screen until you see the button for Reset. Tap on that, and then tap Erase All Content and Settings.
The device will have you verify that this is what you want to do—you are erasing everything, after all—and will then do its thing, rebooting afterwards into the same state it was in when you first took it out of the box.
.