TipGroup
A collection of tips that can be presented one at a time using a specific order or based on the first tip eligible for display.
Declaration
final class TipGroupOverview
Use this class to group multiple tips together and have them presented one at a time. You display tips in a specific order with an TipGroup.Priority.ordered priority or display the first tip eligible for display with a TipGroup.Priority.firstAvailable priority.
TipGroup has a TipGroup.Priority.firstAvailable default priority.
struct TrailDetails: View {
let trail: Trail
@State
var trailDetailTips = TipGroup {
FindTrailheadTip()
ExposureRatingTip()
SlopeProfileTip()
}
var body: some View {
ScrollView(.vertical) {
// Trail title
Text(trail.name)
.font(.title)
NavigateToTrailButton(trailLocation: trail.location)
.popoverTip(trailDetailTips.currentTip as? FindTrailheadTip)
// Trail exposure rating
TipView(trailDetailTips.currentTip as? ExposureRatingTip, arrowEdge: .bottom)
Text("Exposure Rating: \(trail.exposureRating)")
// Trail slope angle
TipView(trailDetailTips.currentTip as? SlopeProfileTip, arrowEdge: .bottom)
Text("Slope Angle: \(trail.slopeAngle)°")
}
}
}