summaryrefslogtreecommitdiffstats
path: root/Solsnu.Widget/Solsnu_WidgetControl.swift
diff options
context:
space:
mode:
authorivar <i@oiee.no>2026-05-07 01:24:28 +0200
committerivar <i@oiee.no>2026-05-07 01:24:28 +0200
commit6eb17a18e901e2d7faa219d7e5a79083a5891dc9 (patch)
tree3d0796e1e567864dfdf7c675f7e8a5a40fb51a95 /Solsnu.Widget/Solsnu_WidgetControl.swift
parent4fb690150b77afced6453e6bdb14cc4cf00d5305 (diff)
downloadsolverv-6eb17a18e901e2d7faa219d7e5a79083a5891dc9.tar.xz
solverv-6eb17a18e901e2d7faa219d7e5a79083a5891dc9.zip
RefactorsHEADmaster
Diffstat (limited to 'Solsnu.Widget/Solsnu_WidgetControl.swift')
-rw-r--r--Solsnu.Widget/Solsnu_WidgetControl.swift55
1 files changed, 0 insertions, 55 deletions
diff --git a/Solsnu.Widget/Solsnu_WidgetControl.swift b/Solsnu.Widget/Solsnu_WidgetControl.swift
deleted file mode 100644
index 686a824..0000000
--- a/Solsnu.Widget/Solsnu_WidgetControl.swift
+++ /dev/null
@@ -1,55 +0,0 @@
-//
-// Solsnu_WidgetControl.swift
-// Solsnu.Widget
-//
-// Created by Ivar Løvlie on 15/12/2025.
-//
-
-import AppIntents
-import SwiftUI
-import WidgetKit
-
-struct Solsnu_WidgetControl: ControlWidget {
- var body: some ControlWidgetConfiguration {
- StaticControlConfiguration(
- kind: "ivarivarivar.Solverv.Solsnu.Widget",
- provider: Provider()
- ) { value in
- ControlWidgetToggle(
- "Start Timer",
- isOn: value,
- action: StartTimerIntent()
- ) { isRunning in
- Label(isRunning ? "On" : "Off", systemImage: "timer")
- }
- }
- .displayName("Timer")
- .description("A an example control that runs a timer.")
- }
-}
-
-extension Solsnu_WidgetControl {
- struct Provider: ControlValueProvider {
- var previewValue: Bool {
- false
- }
-
- func currentValue() async throws -> Bool {
- let isRunning = true // Check if the timer is running
- return isRunning
- }
- }
-}
-
-struct StartTimerIntent: SetValueIntent {
- static let title: LocalizedStringResource = "Start a timer"
-
- @Parameter(title: "Timer is running")
- var value: Bool
-
- func perform() async throws -> some IntentResult {
- // Start / stop the timer based on `value`.
- return .result()
- }
-}
- \ No newline at end of file