I'm creating a simple TipViewStyle based on sample code but it fails to compile. It displays: Type 'MyViewStyle' does not conform to protocol 'TipViewStyle'
When I choose the Fix option, it adds this line:
`type alias Body = type'
What should the type be here?
struct MyTipViewStyle: TipViewStyle {
func makeBody(config: Configuration) -> some View {
VStack {
config.title
config.message?
}
}
TipKit
RSS for tagIntelligently educate your users about the right features at the right time with TipKit
Posts under TipKit tag
22 Posts
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I have added a "welcome" tip to my SwiftUI app, which only appears on the main screen the first time the app is launched.
On macOS and iOS, the TipView has an X button that lets the user dismiss the tip.
However, on tvOS there is no such button, and I cannot figure out how to dismiss the tip at all. Using the remote, I am unable to navigate to the tip and highlight it so I can click it to dismiss. Pressing the Home remote button while the tip is displayed has no effect other than closing my app and going back to the tvOS launch screen.
Am I missing something?
struct ContentView: View {
@Environment(TempestDataProvider.self) private var dataProvider
@State private var welcomeTip = WelcomeTip()
var body: some View {
VStack {
Grid {
GridRow {
TemperatureMetricBox(alignment: .leading, backgroundStyle: nil, bottomPadding: true)
WindMetricBox(alignment: .trailing, backgroundStyle: nil, bottomPadding: true)
}
GridRow {
HumidityMetricBox(alignment: .leading, backgroundStyle: nil, bottomPadding: true)
PressureMetricBox(alignment: .trailing, backgroundStyle: nil, bottomPadding: true)
}
GridRow {
RainMetricBox(alignment: .leading, backgroundStyle: nil, bottomPadding: true)
SunMetricBox(alignment: .trailing, backgroundStyle: nil, bottomPadding: true)
}
GridRow {
LightningMetricBox(alignment: .leading, backgroundStyle: nil, bottomPadding: true)
MetricBox(alignment: .trailing, systemImageName: "sensor", backgroundStyle: nil, bottomPadding: true) {
IndicatorLightPanel()
}
}
}
.fixedSize(horizontal: false, vertical: true)
Spacer()
TipView(welcomeTip)
StatusBar()
}
}
}