deurell/roomscanner

Restart bug when directly press cancel and start scanning again

Opened this issue · 1 comments

Hi,
I have encounter a bug when running the app (thanks for this great demo btw).

When I start scanning for the first time, everything works ok. But if I press cancel right after the first scanning (when no capturedRoom is generated) and start scanning again, the camera is still working, but no roomplan instruction/scanning progress showing up. And if I hold on for a while, the camera stops working.

I think this bug occurs because the captureView is not reset properly somehow when the scanningView is dismissed. But I don't figure out exactly what happened and how to solve this.

Can you help to review this issue?

After comparing to the wwdc 2022 uikit example, I think I find the reason:

  • for the uikit version, each time when a scan starts, a new RoomCaptureView instance is initiated.
  • but for this swiftui version, the same instance is used.