Simplify splitview observsation.

This commit is contained in:
Brent Simmons committed 2026-10-13 15:44:27 -07:00
1 parent 2ce51a4d39
commit 48776eae5e
1 file changed
+3 -8
+3 -8
View File
@@ -74,8 +74,6 @@ final class MainWindowController: NSWindowController, NSUserInterfaceValidations
private var restoreArticleWindowScrollY: CGFloat?
// Holds the split view controller and the status bar.
private let mainWindowContentViewController = MainWindowContentViewController()
// The split view whose resizing the status bar tracks.
private weak var observedSplitView: NSSplitView?
private var mouseoverLink: String? {
didSet {
updateStatusBarLink()
@@ -1881,12 +1879,9 @@ private extension MainWindowController {
/// Tracks the sidebar divider in the status bar. Call after the split view controller is replaced.
func observeSplitViewForStatusBar() {
if let observedSplitView {
NotificationCenter.default.removeObserver(self, name: NSSplitView.didResizeSubviewsNotification, object: observedSplitView)
}
observedSplitView = splitViewController?.splitView
if let observedSplitView {
NotificationCenter.default.addObserver(self, selector: #selector(handleSplitViewDidResizeSubviews(_:)), name: NSSplitView.didResizeSubviewsNotification, object: observedSplitView)
NotificationCenter.default.removeObserver(self, name: NSSplitView.didResizeSubviewsNotification, object: nil)
if let splitView = splitViewController?.splitView {
NotificationCenter.default.addObserver(self, selector: #selector(handleSplitViewDidResizeSubviews(_:)), name: NSSplitView.didResizeSubviewsNotification, object: splitView)
}
updateStatusBarSidebarDivider()
}