Setting window properties in a Storyboard-based project

I used to use this code in a project based on xib:

override func windowDidLoad() {
    super.windowDidLoad()
    
    window!.titlebarAppearsTransparent = true
    self.window!.titleVisibility = NSWindowTitleVisibility.Hidden
    self.window!.styleMask = NSFullSizeContentViewWindowMask
    window!.movableByWindowBackground = true
}

Now that I rewrote the app basing it on Storyboards, the code don’t work anymore. Any idea because this happens?

OK, I resolved with this code:

    override func viewDidAppear() {
    super.viewDidAppear()
    
    self.view.window?.titlebarAppearsTransparent = true
    self.view.window?.movableByWindowBackground = true
    self.view.window?.titleVisibility = NSWindowTitleVisibility.Hidden
}

Instead to put the code in windowDidLoad(), I put it in viewDidAppear().
Instead to use self.window!, I use self.view.window?