@jabhiji @waohqc @amit12we I found a way!
I initialize some dummy ActivityAttributes and ContentState then use
attributes.previewContext(contentState, viewKind: .dynamicIsland(.compact))
Full example
struct HuntLiveActivityWidget_Previews: PreviewProvider {
static let attributes = HuntAttributes.init(huntID: "1234",
huntName: "Hunt name",
numberOfClues: 10)
static let contentState = HuntAttributes.ContentState(currentClueText: "This is the current clue to be solved.",
currentClueIndex: 0,
currentHuntProgress: 0.1)
static var previews: some View {
attributes
.previewContext(contentState, viewKind: .dynamicIsland(.compact))
.previewDisplayName("Island Compact")
attributes
.previewContext(contentState, viewKind: .dynamicIsland(.expanded))
.previewDisplayName("Island Expanded")
attributes
.previewContext(contentState, viewKind: .dynamicIsland(.minimal))
.previewDisplayName("Minimal")
attributes
.previewContext(contentState, viewKind: .content)
.previewDisplayName("Notification")
}
}