What are Apple Legacy Contacts and how to add them
While no one wants to plan for the death of themselves or a loved one, adding legacy contacts ensures that data is passed on from generation to generation.

Apple's Legacy Contacts allows users to authorize people to access their data after they die, ensuring media like photos and videos can be passed on to future generations. When someone dies unexpectedly, family members often cannot turn to help. They don't have the passwords they need to access their digital lives, and since most people store their most precious data on their devices, memories can be lost forever. But starting with iOS 15.2, iPadOS 15.2, and macOS 12.1, users can set an end-of-life plan for their Apple ID and iCloud data to avoid these situations.
Adds a legacy contact to a user's Apple ID account, delegating access to that person's data after the user's death. Only users can manually add Legacy Contacts to their accounts, and the data can only be accessed after that person's death. Legacy Contacts can use user-generated access keys and their death certificates to request data -- including photos, messages, notes, files, downloaded apps, and device backups. They will have three years to manage and access the data before Apple permanently deletes it. Legacy contacts won't have access to purchased movies, music, books, and other subscriptions, etc. Or look up the user's stored payment information.
Add A Legacy Contact In Apple ID Settings

There are some requirements that must be met to add legacy contacts to an Apple ID account. First, an Apple ID must be signed into an Apple device running iOS 15.2, iPadOS 15.2, macOS 12.1 or later, so users may have to update their devices first. The account must also use a two-factor authentication method, and the person adding the old contact must be at least 13 years old.
With the Settings, System Preferences, or System Settings app open, tap or click your user name at the top of the screen to open their Apple ID settings. Then, click the "Password and Security" tab. Press the "Legacy Contact" tab, which Apple explains is "someone you trust who can access the data in your account after your death."
Click "Add Old Contact" and press the blue "Add Old Contact" button after reading the information page to continue the process. After entering your passcode or authenticating with Face ID or Touch ID, choose who to add as legacy contacts. Users can tap "Add someone else" to add a person from their contacts or select a person from a list Members of the Family Sharing group are automatically included.
Once Legacy Contact is added, users will need to decide how to use their access keys. It can be shared with old contacts via message or saved as a file that can be printed. A paper copy can then be provided directly to the estate contact, or stored with other estate planning documents such as a will. Legacy Contacts is a useful end-of-life planning tool that ensures digital data can be shared with loved ones after a user passes away.
More: How to turn on iCloud's Advanced Data Protection