-
-
Save twocentstudios/c4fc39c5a16115b0aa1a230f69281daa to your computer and use it in GitHub Desktop.
Widget #Preview compiler error
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Error: Macro 'Preview(_:as:using:widget:timelineProvider:)' requires that 'TestIntentTimelineProvider' conform to 'AppIntentTimelineProvider' | |
#Preview( | |
as: .systemMedium, | |
using: TestIntent.self, | |
widget: { TestWidget() }, | |
timelineProvider: { TestIntentTimelineProvider() } | |
) | |
// Error: Macro 'Preview(_:as:using:widget:timelineProvider:)' requires that 'TestAppIntentTimelineProvider' conform to 'IntentTimelineProvider' | |
#Preview( | |
as: .systemMedium, | |
using: TestWidgetConfigurationIntent.self, | |
widget: { TestWidget() }, | |
timelineProvider: { TestAppIntentTimelineProvider() } | |
) | |
struct TestWidgetConfigurationIntent: WidgetConfigurationIntent { | |
static var title: LocalizedStringResource = "" | |
} | |
class TestIntent: INIntent {} | |
struct TestEntry: TimelineEntry { | |
var date: Date | |
} | |
struct TestAppIntentTimelineProvider: AppIntentTimelineProvider { | |
typealias Entry = TestEntry | |
typealias Intent = TestWidgetConfigurationIntent | |
func placeholder(in context: Context) -> TestEntry { | |
fatalError() | |
} | |
func snapshot(for configuration: TestWidgetConfigurationIntent, in context: Context) async -> TestEntry { | |
fatalError() | |
} | |
func timeline(for configuration: TestWidgetConfigurationIntent, in context: Context) async -> Timeline<TestEntry> { | |
fatalError() | |
} | |
} | |
struct TestIntentTimelineProvider: IntentTimelineProvider { | |
typealias Intent = TestIntent | |
typealias Entry = TestEntry | |
func getSnapshot(for configuration: TestIntent, in context: Context, completion: @escaping (TestEntry) -> Void) { | |
fatalError() | |
} | |
func getTimeline(for configuration: TestIntent, in context: Context, completion: @escaping (Timeline<TestEntry>) -> Void) { | |
fatalError() | |
} | |
func placeholder(in context: Context) -> TestEntry { | |
fatalError() | |
} | |
} | |
struct TestWidget: Widget { | |
var body: some WidgetConfiguration { | |
EmptyWidgetConfiguration() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment