best practices for 'Invalid Parameter Not satisfying: An NSView must be in an NSViewController' scenarios During Custom View Transition on macOS 13.6
I'm building a feature where I've been working on this all day and I'm stuck on something that should probably be simple... I am working with an scenario when trying to perform a custom view transition between two view controllers in my macOS application. Specifically, I'm getting the behavior `Invalid Parameter Not satisfying: An NSView must be in an NSViewController` when I attempt to present a new view controller modally using `presentViewController(_:animator:)`. I'm using macOS 13.6 and have set up a custom animation for the transition. In my code, I have the following setup: ```swift class MainViewController: NSViewController { func showDetailView() { let detailVC = DetailViewController() detailVC.transitioningDelegate = self presentViewController(detailVC, animator: FadeAnimator()) } } class DetailViewController: NSViewController { // Detail view setup } class FadeAnimator: NSObject, NSViewControllerPresentationAnimator { func animatePresentation(of viewController: NSViewController, from fromViewController: NSViewController) { // Custom fade animation code } func animateDismissal(of viewController: NSViewController, from fromViewController: NSViewController) { // Custom fade dismissal code } } ``` I have verified that `DetailViewController` is indeed a subclass of `NSViewController`. Additionally, I have confirmed that each view controller is properly instantiated and their views are loaded. However, the behavior continues when I try to present `DetailViewController`. I suspect it might be related to the missing parent-child relationship between my view controllers. I tried calling `viewDidLoad` of `MainViewController` before the presentation, and ensured that `showDetailView` is getting called after the view has appeared, but nothing seems to work. Has anyone faced a similar scenario or can provide insights on how to properly set up the view controller relationships to avoid this behavior? This is for a CLI tool running on CentOS. Thanks for any help you can provide!