79337455

Date: 2025-01-07 21:57:23
Score: 1.5
Natty:
Report link

I have been dealing with the same issue and found the solution on https://furnacecreek.org/blog/2024-12-07-centering-nswindows-with-nshostingcontrollers-on-sequoia

Here is the OP's sample code with the one line fix added:

let contentView = WelcomeView()
let hostingVC = NSHostingController(rootView: contentView)
onboardWindow?.contentViewController = hostingVC
onboardWindow?.updateConstraintsIfNeeded() // fixes zero size issue
Reasons:
  • Probably link only (1):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Luke Griffioen