]>
Commit | Line | Data |
---|---|---|
1 | import SwiftUI | |
2 | ||
3 | struct OutputSettings: View { | |
4 | ||
5 | @AppStorage("outputFormats") var outputFormats: OutputFormatSetting = .all | |
6 | @AppStorage("frameRate") var frameRate = 10.0 | |
7 | ||
8 | private var anyState: String { "\(outputFormats), \(frameRate)" } | |
9 | ||
10 | var body: some View { | |
11 | Form { | |
12 | VStack (alignment: .center) { | |
13 | LabeledContent("GIF Framerate") { | |
14 | Slider(value: $frameRate, in: 4...10, step: 1) { | |
15 | Text("\(Int(frameRate))").font(.body).frame(width: 24) | |
16 | } minimumValueLabel: { | |
17 | Text("4") | |
18 | } maximumValueLabel: { | |
19 | Text("10") | |
20 | } | |
21 | }.font(.headline) | |
22 | Picker(selection: $outputFormats, label: Text("Output Formats").font(.headline)) { | |
23 | Text("GIF & MP4") | |
24 | .tag(OutputFormatSetting.all) | |
25 | .padding(.horizontal, 4.0) | |
26 | .padding(.vertical, 2.0) | |
27 | Text("Only GIF") | |
28 | .tag(OutputFormatSetting.gifOnly) | |
29 | .padding(.horizontal, 4.0) | |
30 | .padding(.vertical, 2.0) | |
31 | ||
32 | Text("Only MP4") | |
33 | .tag(OutputFormatSetting.mp4Only) | |
34 | .padding(.horizontal, 4.0) | |
35 | .padding(.vertical, 2.0) | |
36 | }.pickerStyle(.radioGroup) | |
37 | } | |
38 | Spacer() | |
39 | } | |
40 | .onChange(of: anyState) { _ in | |
41 | NotificationCenter.default.post(name: .reloadConfiguration, object: nil, userInfo: nil) | |
42 | } | |
43 | } | |
44 | } | |
45 | ||
46 | #Preview { | |
47 | OutputSettings() | |
48 | } |