From b87c18e8025088e62adfac80235467a059ff74d6 Mon Sep 17 00:00:00 2001 From: radude89 Date: Wed, 26 Jun 2024 08:24:37 +0300 Subject: [PATCH] Migrate onChange to newer API --- .../Gather/Gather/Sources/Gather/Views/TimerView.swift | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/FootballGather/Packages/UseCases/Gather/Gather/Sources/Gather/Views/TimerView.swift b/FootballGather/Packages/UseCases/Gather/Gather/Sources/Gather/Views/TimerView.swift index fe38d8c..faf7c1e 100644 --- a/FootballGather/Packages/UseCases/Gather/Gather/Sources/Gather/Views/TimerView.swift +++ b/FootballGather/Packages/UseCases/Gather/Gather/Sources/Gather/Views/TimerView.swift @@ -38,7 +38,11 @@ struct TimerView: View { .alert(LocalizedString.timeIsUpTitle, isPresented: $viewModel.timeIsUp) { Button(LocalizedString.ok, role: .cancel) {} } - .onChange(of: scenePhase, perform: onScheneChanged) + .onChange(of: scenePhase, { _, newValue in + Task { + await viewModel.onScenePhaseChanged(to: newValue) + } + }) .task { await viewModel.askForNotificationPermissions() } } @@ -67,10 +71,6 @@ struct TimerView: View { .accessibilityLabel(viewModel.actionButtonAccessibilityLabel) } - private func onScheneChanged(to newValue: ScenePhase) { - Task { await viewModel.onScenePhaseChanged(to: newValue) } - } - } // MARK: - Preview