Mulberry/ios/Widget/Test/TestWidget.swift
astar76 927219bf77 Add Mulberry for iOS (1.0.6) under ios/
SwiftUI port of the Android app with the desktop feature set; built on Linux,
linked and signed on a jailbroken iPhone. History imported from the standalone repo.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-27 23:23:51 -05:00

30 lines
1.1 KiB
Swift

import WidgetKit
import SwiftUI
// Diagnostic widget: no AppIntents, no shared code. Tells apart "WidgetKit rejects the extension" from
// "the AppIntents in the real widget break it".
struct TestEntry: TimelineEntry { let date: Date }
struct TestProvider: TimelineProvider {
func placeholder(in context: Context) -> TestEntry { TestEntry(date: Date()) }
func getSnapshot(in context: Context, completion: @escaping (TestEntry) -> Void) { completion(TestEntry(date: Date())) }
func getTimeline(in context: Context, completion: @escaping (Timeline<TestEntry>) -> Void) {
completion(Timeline(entries: [TestEntry(date: Date())], policy: .never))
}
}
struct TestWidget: Widget {
var body: some WidgetConfiguration {
StaticConfiguration(kind: "MulberryTest", provider: TestProvider()) { _ in
Text("Mulberry test widget").containerBackground(.purple, for: .widget)
}
.configurationDisplayName("Mulberry test")
.description("Diagnostic widget.")
.supportedFamilies([.systemSmall])
}
}
@main
struct TestWidgets: WidgetBundle {
var body: some Widget { TestWidget() }
}