NSWindow with unified top and/or bottom bars [Swift]

Long ago I used this code in Xojo to achieve what I want to now do in Swift

#If TargetMacOS Then
  #If TargetCocoa
    Const NSBackingStoreType = 2
    Const NSMaxYEdge = 3
    Const NSMinYEdge = 1
    Const NSTexturedBackgroundWindowMask = 256
    Const NSTitledWindowMask = 1
    Const NSResizabkeWindowMask = 8
    Const NSMiniaturizableWindowMask = 4
    Const NSClosableWindowMask = 2
    Const NSResizableWindowMask=8
    
    w.Frame=9
    
    Declare Sub setBackingType Lib "Cocoa" selector "setBackingType:" ( ObjID As Integer, bufferingType As Integer)
    Declare Sub setStyleMask Lib "Cocoa" selector "setStyleMask:" (obj_id As Integer, mask As Integer)
    Declare Function styleMask Lib "Cocoa.framework" selector "styleMask" (id As Integer) As Integer 
    Declare Sub SetAutorecalculatesContentBorder Lib "AppKit" Selector "setAutorecalculatesContentBorderThickness:forEdge:" (inWindow As WindowPtr, inRecalculates As Boolean, inEdge As UInt32)
    Declare Sub SetContentBorderThickness Lib "AppKit" Selector "setContentBorderThickness:forEdge:" (inWindow As WindowPtr, inBorderThickness As Single, inEdge As UInt32)
    Declare Sub ContentBorderThickness Lib "AppKit" Selector "ContentBorderThicknessForEdge:" (inWindow As WindowPtr, inBorderThickness As Single, inEdge As UInt32)
    
    //Soft Declare Sub setMovableByWindowBackground Lib "Cocoa" selector "setMovableByWindowBackground:" (windowRef As Integer, yesNo As Boolean)
    '
    '
    '
    setBackingType w.Handle, NSBackingStoreType
    //setStyleMask w.Handle, NSTexturedBackgroundWindowMask Or NSTitledWindowMask Or NSClosableWindowMask Or NSMiniaturizableWindowMask Or NSResizableWindowMask
    setStyleMask w.Handle, styleMask(w.Handle) Or NSTexturedBackgroundWindowMask
    
    SetAutorecalculatesContentBorder(w,False,NSMinYEdge)
    SetAutorecalculatesContentBorder(w,False,NSMaxYEdge)
    
    If topHeight>0 Then SetContentBorderThickness(w,topHeight,NSMaxYEdge) '<----set the height top]
    If botHeight>0 Then SetContentBorderThickness(w,botHeight,NSMinYEdge) '<----set the height bottom
    //setMovableByWindowBackground(w.handle, False)
    w.Frame=0
  #EndIf
#EndIf

However, Apple Docs indicate this doesn’t work on non-Textured Windows, yet the Textured Style flag is now deprecated…

The Swift equivalent is supposed to be

	self.setContentBorderThickness(24.0, for: NSRectEdge.maxY)

but the app just bombs

Thread 1: "setContentBorderThickness:forEdge: may not be called with NSMaxYEdge in a non-textured window"

If I use .minY instead… the app doesn’t crash… but the window remains the same