MTKView crash only on detached Xcode run

MTKView crash only on detached Xcode run

After distributing build via TestFlight I've immediately received couple of crash reports, here's the one. Initially I assumed that some xib is not loaded as I recently switched to XCFrameworks with embedded bundles from fake framework with static lib.

The weird thing was that everyting  was working fine via Xcode run until I exidentaly detached the device and continued my investigation, then I caught the crash and observed a pattern: the crash is only happening to viewcontrollers with MTKView.

Then I've bumped into this question on dev forums: app crashes with EXC_CRASH (SIGABRT), when manually launched on device with Debug build, it would seem that MetalKit framework is not loaded indirectly and to resolve the issue explicit reference is needed: