I'm trying to create a preview for my live activities when it's stale, so I created a preview provider. I followed some examples, but XCode says I'm missing preview context. Am I doing something wrong?
I tried adding .previewContext(WidgetPreviewContext(family: .systemSmall))
but that doesn't seem to work.
Hi,
Sorry to hear you are having problems getting live activity previews working. Recent Xcode releases have added the new #Preview
macro to replace the older PreviewProvider.
The macro versions are especially important for Widget and LiveActivity previewing as they support features that the PreviewProviders don't. Could you try using a preview of the following type:
#Preview("preview name", as: .content, using: MyLiveActivityAttributes.preview) {
MyLiveActivity()
} contentStates: {
MyLiveActivityAttributes.ContentState.mock1
MyLiveActivityAttributes.ContentState.mock2
}
replacing with variables and types from your project