TipKit
Display tips that help people discover features in your app.
Overview
Use TipKit to show contextual tips that highlight new, interesting, or unused features people haven’t discovered on their own yet.
[Image]
Define your tip content, and the conditions under which they appear, with the Tip protocol. Then draw attention to new features using the TipView.
As you design tips for your app, ensure you don’t overwhelm your users. Use tips sparingly to highlight nonobvious features people haven’t discovered on their own. Similarly, avoid displaying tips each time someone uses your app. Tips can become distracting when they appear unnecessarily. Don’t use tips to guide people through your app, or for advertising and promotion purposes.
For design guidance on tips, see Human Interface Guidelines > Offering help.
import SwiftUI
import TipKit
// Define your tip's content.
struct FavoriteLandmarkTip: Tip {
var title: Text {
Text("Save as a Favorite")
}
var message: Text? {
Text("Your favorite landmarks always appear at the top of the list.")
}
var image: Image? {
Image(systemName: "star")
}
}
@main
struct LandmarkTips: App {
// Create an instance of your tip.
var favoriteLandmarkTip = FavoriteLandmarkTip()
var body: some Scene {
WindowGroup {
VStack {
// Place the tip view near the feature you want to highlight.
TipView(favoriteLandmarkTip, arrowEdge: .bottom)
Image(systemName: "star")
.imageScale(.large)
Spacer()
}
.task {
// Configure and load your tips at app launch.
do {
try Tips.configure()
}
catch {
// Handle TipKit errors
print("Error initializing TipKit \(error.localizedDescription)")
}
}
}
}
}Topics
Essentials
Content
Configuration
Views
UIKit Views
AppKit Views
Display rules
View Style
Testing
showAllTipsForTesting()showTipsForTesting(_:)hideAllTipsForTesting()hideTipsForTesting(_:)resetDatastore()