Tip
A type that sets a tip’s content, as well as the conditions for when it displays.
Declaration
protocol Tip : Identifiable, SendableOverview
Use this protocol for setting a tip’s content, as well as defining the conditions for when it appears in a view. You create custom tips by declaring types that conform to the Tip protocol. Set your tip’s content by giving it a title, message, image, and a list of actions.
For example, to create a tip with a title, message, and image:
struct FavoriteBackyardTip: Tip {
var title: Text {
Text("Save as a Favorite")
}
var message: Text? {
Text("Your favorite backyards always appear at the top of the list.")
}
var image: Image? {
Image(systemName: "star")
}
}For a tip to be valid, you need to set its title. To control when a tip displays, pass instances of Rule and Option into the rules and options properties of the tip.
After you define your tip’s content, display it in either a TipView or a popoverTip(_:arrowEdge:action:).