diff --git a/Minesweeper.xcodeproj/project.pbxproj b/Minesweeper.xcodeproj/project.pbxproj index ae2737f..32e0a10 100644 --- a/Minesweeper.xcodeproj/project.pbxproj +++ b/Minesweeper.xcodeproj/project.pbxproj @@ -192,7 +192,7 @@ attributes = { BuildIndependentTargetsInParallel = 1; LastSwiftUpdateCheck = 1330; - LastUpgradeCheck = 1420; + LastUpgradeCheck = 1520; TargetAttributes = { 3B5AB53727F96F710059BB0A = { CreatedOnToolsVersion = 13.3; @@ -317,6 +317,7 @@ DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; GCC_C_LANGUAGE_STANDARD = gnu11; GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; @@ -378,6 +379,7 @@ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; GCC_C_LANGUAGE_STANDARD = gnu11; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; diff --git a/Minesweeper/Settings/GeneralViewController.swift b/Minesweeper/Settings/GeneralViewController.swift index 89ad8e5..bd0dafb 100644 --- a/Minesweeper/Settings/GeneralViewController.swift +++ b/Minesweeper/Settings/GeneralViewController.swift @@ -49,6 +49,7 @@ class GeneralViewController: NSViewController { @IBAction func toolbarDifficultyCheckboxClicked(_ sender: NSButton) { Defaults[.toolbarDifficulty].toggle() + NotificationCenter.default.post(name: Notification.Name("SetSubtitle"), object: nil) } @IBAction func appearancePopUpChanged(_ sender: NSPopUpButton) { diff --git a/Minesweeper/ViewController.swift b/Minesweeper/ViewController.swift index 413d840..9d2de96 100644 --- a/Minesweeper/ViewController.swift +++ b/Minesweeper/ViewController.swift @@ -18,6 +18,8 @@ class ViewController: NSViewController { override func viewDidLoad() { super.viewDidLoad() + NotificationCenter.default.addObserver(self, selector: #selector(self.setSubtitle(notification:)), name: Notification.Name("SetSubtitle"), object: nil) + if let view = self.skView { let rows, cols, mines: Int @@ -48,4 +50,12 @@ class ViewController: NSViewController { view.window!.subtitle = difficulty } } + + @objc func setSubtitle(notification: Notification) { + if Defaults[.toolbarDifficulty] { + view.window!.subtitle = difficulty + } else { + view.window!.subtitle = "" + } + } }