@@ -36,14 +36,14 @@ class DocumentationWindowController: NSWindowController {
3636 private func observeViewerState( ) {
3737 guard let dvc = documentationViewController else { return }
3838 observations. insert (
39- dvc. observe ( \DocumentationViewController . viewerState) { ( dvc, _) in
39+ dvc. observe ( \DocumentationViewController . viewerState) { [ weak self ] ( dvc, _) in
4040 if dvc. viewerState != . ready {
4141 return
4242 }
4343
4444 dvc. useNativeScrollbars ( true )
4545
46- guard let window = self . window else { return }
46+ guard let window = self ? . window else { return }
4747 switch window. effectiveAppearance. name {
4848 case . aqua:
4949 dvc. useDarkMode ( false )
@@ -59,26 +59,26 @@ class DocumentationWindowController: NSWindowController {
5959 private func observeDocumentTitle( ) {
6060 guard let dvc = documentationViewController else { return }
6161 observations. insert (
62- dvc. observe ( \DocumentationViewController . documentTitle) { ( dvc, _) in
63- self . window? . title = dvc. documentTitle ?? " DevDocs "
62+ dvc. observe ( \DocumentationViewController . documentTitle) { [ weak self ] ( dvc, _) in
63+ self ? . window? . title = dvc. documentTitle ?? " DevDocs "
6464 }
6565 )
6666 }
6767
6868 private func observeDocumentURL( ) {
6969 guard let dvc = documentationViewController else { return }
7070 observations. insert (
71- dvc. observe ( \DocumentationViewController . documentURL) { ( dvc, _) in
72- self . documentation. url = dvc. documentURL
71+ dvc. observe ( \DocumentationViewController . documentURL) { [ weak self ] ( dvc, _) in
72+ self ? . documentation. url = dvc. documentURL
7373 }
7474 )
7575 }
7676
7777 private func observeEffectiveAppearance( ) {
7878 guard let window = self . window else { return }
7979 observations. insert (
80- window. observe ( \NSWindow . effectiveAppearance) { ( win, _) in
81- guard let dvc = self . documentationViewController else {
80+ window. observe ( \NSWindow . effectiveAppearance) { [ weak self ] ( win, _) in
81+ guard let dvc = self ? . documentationViewController else {
8282 return
8383 }
8484 switch window. effectiveAppearance. name {
0 commit comments