id
The tip’s unique identifier.
Declaration
var id: String { get }Overview
By default the type name of the Tip conforming struct will be used as the tip’s id. Specifying a custom id allows you to create reusable tips based on their content.
struct NewTrailTip: Tip {
let newTrail: Trail
var id: String {
"NewTrailTip-\(newTrail.id)"
}
}
struct TrailList: View {
let newTrail: Trail
var body: some View {
// Creates a different tip for each new trail.
let newTrailTip = NewTrailTip(newTrail)
TipView(newTrailTip)
}
}