I'm seeing an unexplained crash on my iOS app built with SwiftUI. It only affects some users, and I can't manage to reproduce locally.
Here is the stack trace:
Fatal Exception: NSInvalidArgumentException
<_TtGC7SwiftUI41StyleContextSplitViewNavigationControllerVS_19SidebarStyleContext_: 0x110859800>
is pushing the same view controller instance(<_TtGC7SwiftUI41StyleContextSplitViewNavigationControllerVS_14NoStyleContext_: 0x11088a400>)
more than once which is not supported and is most likely an error in the application : `com.myapp`
Fatal Exception: NSInvalidArgumentException
0  CoreFoundation                 0x1893a186c __exceptionPreprocess
1  libobjc.A.dylib                0x19e3bcc50 objc_exception_throw
2  UIKitCore                      0x18b575514 -[UINavigationController pushViewController:transition:forceImmediate:]
3  UIKitCore                      0x18b5751f4 -[UINavigationController pushViewController:animated:]
4  UIKitCore                      0x18b6047c8 __45-[UISplitViewControllerPanelImpl showColumn:]_block_invoke
5  UIKitCore                      0x18b57eda8 -[UINavigationController _executeSplitViewControllerActions:]
6  UIKitCore                      0x18b6045bc -[UISplitViewControllerPanelImpl showColumn:]
7  UIKitCore                      0x18b5e4c54 -[UISplitViewController showColumn:]
8  SwiftUI                        0x1903784f4 closure #1 in closure #1 in NavigationBridge_PhoneTV.push(_:onto:animated:)
9  SwiftUI                        0x19042728c thunk for @escaping @callee_guaranteed () -> ()
10 UIKitCore                      0x18c23f544 -[_UIAfterCACommitBlock run]
11 UIKitCore                      0x18bd6700c _runAfterCACommitDeferredBlocks
12 UIKitCore                      0x18bd559a0 _cleanUpAfterCAFlushAndRunDeferredBlocks
13 UIKitCore                      0x18bd89bb4 _afterCACommitHandler
14 CoreFoundation                 0x18931c358 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__
15 CoreFoundation                 0x1893165c4 __CFRunLoopDoObservers
16 CoreFoundation                 0x189316b74 __CFRunLoopRun
17 CoreFoundation                 0x18931621c CFRunLoopRunSpecific
18 GraphicsServices               0x1a0ee2784 GSEventRunModal
19 UIKitCore                      0x18bd56ee8 -[UIApplication _run]
20 UIKitCore                      0x18bd5c75c UIApplicationMain
21 MYAPP                          0x100dbecc0 main + 7 (PushupsMode.swift:7)
22 libdyld.dylib                  0x188fd66b0 start
Looking at PushupsMode.swift:7 it seems completely unrelated:
import Foundation
extension WorkoutModel {
    mutating func startPushups() {
        var pushupsCount = 10 + p.intensityOptionPicked * 10
        
        if(round > 6 || round < 3) { // <<--- this is the line crashing
            pushupsCount = Int(pushupsCount / 2)
        }
        // More code after that point
    }
}
The round variable is defined in another file, but there's nothing really significant around it:
import Foundation
import SwiftUI
struct WorkoutModel: Identifiable {
    // bunch of stuff before
    var round: Int = -1
    // bunch of stuff after
} 
Obviously looking at the error message, it seems like something is getting pushed twice... however since I'm using SwiftUI I'm not entirely sure how I could have even done that.
Any pointers would be appreciated!
 
     
    