From e47f4a704ea257a572a50adcad7491b45b4885c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bruno=20Pantalea=CC=83o?= Date: Tue, 7 Nov 2023 17:06:34 +0100 Subject: [PATCH] Improvement --- Sources/App/Settings/SettingsDetailViewController.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Sources/App/Settings/SettingsDetailViewController.swift b/Sources/App/Settings/SettingsDetailViewController.swift index 6daf8d321..dd29c045b 100644 --- a/Sources/App/Settings/SettingsDetailViewController.swift +++ b/Sources/App/Settings/SettingsDetailViewController.swift @@ -459,12 +459,12 @@ class SettingsDetailViewController: HAFormViewController, TypedRowControllerType } } - scenesUpdateObserver = scenes.observe { _ in - toggleAllSwitch.cellUpdate { cell, row in + toggleAllSwitch.cellUpdate { [weak self] cell, _ in + self?.scenesUpdateObserver = scenes.observe { _ in cell.switchControl.setOn(scenes.filter(\.actionEnabled).count == scenes.count, animated: true) } - toggleAllSwitch.updateCell() } + toggleAllSwitch.updateCell() form +++ Section(L10n.SettingsDetails.Actions.Scenes.title) <<< toggleAllSwitch