iphone restart issue

Hello,

I am building an ios app using swiftui. when i connect the phone to my mac and run the app to my phone from xcode my phone restarts. i dont have this issue in the simulator. I fixed the memory leaks and it still does it. Does anyone know what can cause this issue and how I can detect it?

Thank you

iphone restart issue
 
 
Q