If you change your iPhone's passcode and forget it soon after, iOS 17 has a new option available to help out. Specifically, it is now possible to reset an iPhone's new passcode with the previous passcode for up to 72 hours after the change is made.
If you enter an incorrect passcode, tapping on "Forgot Passcode?" at the bottom of the screen will lead to another screen with a "Try Passcode Reset" option. Tapping this option allows you to enter the iPhone's previous passcode and create a new passcode.
As a safeguard, an option in the Settings app lets you expire the previous passcode immediately so that it cannot be used to reset the new passcode.
As of the first beta of iOS 17, it is still possible to change an Apple ID account's password with an iPhone's passcode, despite a Wall Street Journal report in February highlighting instances of thieves spying on an iPhone user's passcode in public and then stealing the device in order to gain widespread access to the device. In an interview with Daring Fireball's John Gruber last week, Apple's software engineering chief Craig Federighi said Apple has continued to "look at other ways to address this," but no changes have been made as of yet.
iOS 17 will be released later this year for the iPhone XS and newer, and it is currently available in beta with a free Apple developer account.
Source: Macrumors