Is there any source code Swift detects when users transfer to a new iPhone?

I have tried to check any source code from the Apple Document API, but there is no clue how to solve the following business requirement.