Your iPhone can be set to delete everything after ten wrong passcode guesses, which is a great idea from a security perspective. Anyone who steals your phone can’t access your data unless they get really, really lucky.
But some people are understandably nervous about a child (or immature adult) accidentally wiping everything. John Gruber, writing for Daring Fireball, points out that this probably won’t happen:
I had no idea until I looked into it last weekend, but it turns out this feature is far more clever than I realized, and it’s highly unlikely that your kids or jackass drinking buddies could ever trigger it. After the 5th failed attempt, iOS requires a 1-minute timeout before you can try again. During this timeout the only thing you can do is place an emergency call to 911. After the 6th attempt, you get a 5-minute timeout. After the 7th, 15 minutes. These timeouts escalate such that it would take over 3 hours to enter 10 incorrect passcodes.
If you’d like to enable this feature head to Settings > Touch ID/Face ID & Passcode and enable “Erase Data,” as shown above.
What if you forget your passcode? You’d need to wipe your iPhone anyway, because there’s no way to bypass a lost passcode. The only thing you gain by leaving this feature off is more time to remember your passcode, but by enabling it you make it practically impossible for anyone else to gain access by brute forcing. Back up your iPhone regularly if you’re truly worried about this.