From 9cd3037798904319e3fcea2f97fdb03c1ae40c65 Mon Sep 17 00:00:00 2001 From: Ahmed-Naguib93 Date: Thu, 19 Dec 2024 10:09:44 +0200 Subject: [PATCH] Address review comment --- .../Dashboard/View/DashboardViewModel.swift | 24 +++++++------------ 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/Horizon/Horizon/Sources/Features/Dashboard/View/DashboardViewModel.swift b/Horizon/Horizon/Sources/Features/Dashboard/View/DashboardViewModel.swift index c43fc75443..589ada9585 100644 --- a/Horizon/Horizon/Sources/Features/Dashboard/View/DashboardViewModel.swift +++ b/Horizon/Horizon/Sources/Features/Dashboard/View/DashboardViewModel.swift @@ -30,7 +30,6 @@ final class DashboardViewModel: ObservableObject { // MARK: - Input - var onEvent: (HorizonUI.NavigationBar.Trailing.Event) -> Void = { _ in} var viewController: WeakViewController = .init() // MARK: - Private variables @@ -61,8 +60,6 @@ final class DashboardViewModel: ObservableObject { .map { "Hi, \($0)" } .replaceError(with: "") .assign(to: &$title) - - configNavigationBarEvents() } // MARK: - Inputs @@ -77,19 +74,14 @@ final class DashboardViewModel: ObservableObject { // MARK: - Private Functions - private func configNavigationBarEvents() { - onEvent = { [weak self] event in - guard let self else { - return - } - switch event { - case .mail: - mailDidTap() - case .notebook: - notebookDidTap() - case .notification: - notificationsDidTap() - } + func onEvent(event: HorizonUI.NavigationBar.Trailing.Event) { + switch event { + case .mail: + mailDidTap() + case .notebook: + notebookDidTap() + case .notification: + notificationsDidTap() } } }