TipViewStyle with default dismiss button

I have created a custom TipViewStyle to have more control over the layout in the TipView.

However, I've noticed that by doing so I lose the default "X" dismiss button. I do not see any way to access it from the Configuration. Is my only solution to add an Action to my Tip?

Also, as an aside, has anyone figured out a way to add a shadow other than using the popoverTip? It seems to be clipped...

struct Test: TipViewStyle {
    func makeBody(configuration: Configuration) -> some View {
        HStack() {
            configuration.image?.scaledToFit()

            VStack(alignment: .leading) {
                configuration.title
                configuration.message
            }
        }
    }
}

Answered by FrankSchlegel in 763818022

You can also access the tip through the configuration. I think you can simply add a button to your tip layout that invalidates the tip when tapped:

Button(action: {
    configuration.tip.invalidate(reason: .tipClosed)
}, label: {
    Image(systemName: "xmark")
})
Accepted Answer

You can also access the tip through the configuration. I think you can simply add a button to your tip layout that invalidates the tip when tapped:

Button(action: {
    configuration.tip.invalidate(reason: .tipClosed)
}, label: {
    Image(systemName: "xmark")
})

When you use a custom tip view style, it is treated as a "blank canvas" and you're free to insert any views into it that you like including a custom close button. @FrankSchlegel 's response is correct - you can add your own close button in the custom view, and style it however you wish.

TipViewStyle with default dismiss button
 
 
Q