(Swift, macOS, storyboards)
I can find the total height of the screen:
let totalHight = NSScreen.main?.frame.height
To know the real space I have to subtract 23 px for the Menu Bar.
let usableHight = totalHight - 23
But on some occasions the user may not have the Menu Bar active (System Preferences > General > uncheck Automatically hide and show the menu bar)
Is there a way to know if the Menu Bar is hidden or show? or perhaps there is another way to know the real usable height of the screen?
Try the following
let usableHight = NSMenu.menuBarVisible() ? totalHight - 23 : totalHight
Here is a simple test that works:
let totalHeight = 400
var usableHeight = NSMenu.menuBarVisible() ? totalHeight - 23 : totalHeight
print(usableHeight)
NSMenu.setMenuBarVisible(false)
usableHeight = NSMenu.menuBarVisible() ? totalHeight - 23 : totalHeight
print(usableHeight)