To setup a legacy contact you need IOS 15.2 or later. Go to settings and tap yor name at the top, then go to Password & Security, then Legacy contact and tap the + to creat a new one (you can have up to 5) select a contact from the list, and pick a way to save the access key. Remember whom ever you choose must have that access key, your birth date, and a death certificate to access your legacy data (photos etc.)