The simplest way I've found to avoid this madness is to always switch to my main app's scheme and select "Any iOS Device" before staging/committing. If that results in a change for you, you'll have to commit that change, but that should be the last time you have to if as long as you always select "Any iOS Device" before staging/committing going forward.
I filed a feedback, FB11280425, about this awful behavior on 8/16/22. Still no response from Apple and the problem persists in the latest Xcode 14.1/iOS 16.1 betas.
Here's the sample project I created for it: https://github.com/gcox/SwiftUIBugs/tree/main/SwiftUI_ForEach_Behavior
This problem has been resolved in macOS 13. That said, it's concerning that whatever the underlying fix was has not been back-ported to macOS 12.x. I worry the fix was unintentional since it has been fixed since early in the macOS 13 beta cycle. If the fix was intentional, that means Apple has known about the problem for months without fixing the issue in macOS 12.x, which seems unlikely. I hope this doesn't get reintroduced.
The simplest way I've found to avoid this madness is to always switch to my main app's scheme and select "Any iOS Device" before staging/committing. If that results in a change for you, you'll have to commit that change, but that should be the last time you have to if as long as you always select "Any iOS Device" before staging/committing going forward.
I filed a feedback, FB11280425, about this awful behavior on 8/16/22. Still no response from Apple and the problem persists in the latest Xcode 14.1/iOS 16.1 betas.
Here's the sample project I created for it: https://github.com/gcox/SwiftUIBugs/tree/main/SwiftUI_ForEach_Behavior
This problem has been resolved in macOS 13. That said, it's concerning that whatever the underlying fix was has not been back-ported to macOS 12.x. I worry the fix was unintentional since it has been fixed since early in the macOS 13 beta cycle. If the fix was intentional, that means Apple has known about the problem for months without fixing the issue in macOS 12.x, which seems unlikely. I hope this doesn't get reintroduced.