Skip to content

Commit

Permalink
Migrate onChange to newer API
Browse files Browse the repository at this point in the history
  • Loading branch information
radude89 committed Jun 26, 2024
1 parent d8d6d56 commit b87c18e
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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() }
}

Expand Down Expand Up @@ -67,10 +71,6 @@ struct TimerView: View {
.accessibilityLabel(viewModel.actionButtonAccessibilityLabel)
}

private func onScheneChanged(to newValue: ScenePhase) {
Task { await viewModel.onScenePhaseChanged(to: newValue) }
}

}

// MARK: - Preview
Expand Down

0 comments on commit b87c18e

Please sign in to comment.