From 2c9f00d19fa21be5ca8df6c1b6891fd538bf02e2 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Thu, 6 May 2021 21:52:14 -0400 Subject: [PATCH] Fix compose poll durations not being set/persisted --- Tusker/Screens/Compose/ComposePollView.swift | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Tusker/Screens/Compose/ComposePollView.swift b/Tusker/Screens/Compose/ComposePollView.swift index 2158a8a6f..87f5efb4b 100644 --- a/Tusker/Screens/Compose/ComposePollView.swift +++ b/Tusker/Screens/Compose/ComposePollView.swift @@ -22,11 +22,7 @@ struct ComposePollView: View { @Environment(\.colorScheme) var colorScheme: ColorScheme - @State private var duration: Duration { - didSet { - poll.duration = duration.timeInterval - } - } + @State private var duration: Duration init(draft: Draft, poll: Draft.Poll) { self.draft = draft @@ -84,6 +80,9 @@ struct ComposePollView: View { backgroundColor .cornerRadius(10) ) + .onChange(of: duration, perform: { (value) in + poll.duration = value.timeInterval + }) } private var backgroundColor: Color {