assertRestrictions method
void
assertRestrictions()
Throws an assertion error if this instance violates any of the following restrictions:
autoHideDock
andhideDock
are mutually exclusive: You may specify one or the other, but not both.autoHideMenuBar
andhideMenuBar
are mutually exclusive: You may specify one or the other, but not both.- If you specify
hideMenuBar
, it must be accompanied byhideDock
. - If you specify
autoHideMenuBar
, it must be accompanied by eitherhideDock
orautoHideDock
. - If you specify any of
disableProcessSwitching
,disableForceQuit
,disableSessionTermination
, ordisableMenuBarTransparency
, it must be accompanied by eitherhideDock
orautoHideDock
. autoHideToolbar
may be used only when bothfullScreen
andautoHideMenuBar
are also set.
Implementation
void assertRestrictions() {
assert(
!options.contains(NSAppPresentationOption.autoHideDock) ||
!options.contains(NSAppPresentationOption.hideDock),
'autoHideDock and hideDock are mutually exclusive: You may specify one '
'or the other, but not both.');
assert(
!options.contains(NSAppPresentationOption.autoHideMenuBar) ||
!options.contains(NSAppPresentationOption.hideMenuBar),
'autoHideMenuBar and hideMenuBar are mutually exclusive: You may '
'specify one or the other, but not both.');
assert(
!options.contains(NSAppPresentationOption.hideMenuBar) ||
options.contains(NSAppPresentationOption.hideDock),
'If you specify hideMenuBar, it must be accompanied by hideDock.');
assert(
!options.contains(NSAppPresentationOption.autoHideMenuBar) ||
(options.contains(NSAppPresentationOption.hideDock) ||
options.contains(NSAppPresentationOption.autoHideDock)),
'If you specify autoHideMenuBar, it must be accompanied by either '
'hideDock or autoHideDock.');
assert(
(!options.contains(NSAppPresentationOption.disableProcessSwitching) &&
!options.contains(NSAppPresentationOption.disableForceQuit) &&
!options.contains(
NSAppPresentationOption.disableSessionTermination) &&
!options.contains(
NSAppPresentationOption.disableMenuBarTransparency)) ||
(options.contains(NSAppPresentationOption.hideDock) ||
options.contains(NSAppPresentationOption.autoHideDock)),
'If you specify any of disableProcessSwitching, disableForceQuit, '
'disableSessionTermination, or disableMenuBarTransparency, it must be '
'accompanied by either hideDock or autoHideDock.');
assert(
!options.contains(NSAppPresentationOption.autoHideToolbar) ||
(options.contains(NSAppPresentationOption.fullScreen) &&
options.contains(NSAppPresentationOption.autoHideMenuBar)),
'autoHideToolbar may be used only when both fullScreen and '
'autoHideMenuBar are also set.');
}