TipKit
Apple provides a TipKit framework which allows developers to embed contextual tips and onboarding hints directly within an app.
Tips can be shown as embedded views or popovers. When organizing in a TipGroup they can be shown sequentially.
import SwiftUI
import TipKit
@available(iOS 18.0, *)
struct SampleTipKitView: View {
struct FirstTip: Tip {
let id = "tip.first"
var title: Text { Text("Tips can be embedded") }
var message: Text? { Text("Tips can be embedded in a view") }
var image: Image? { Image(systemName: "circle.square") }
}
struct SecondTip: Tip {
let id = "tip.second"
var title: Text { Text("Tips can be popups") }
var message: Text? { Text("Tips can be shown as popups") }
var image: Image? { Image(systemName: "text.bubble") }
}
struct ResetTip: Tip {
let id = "tip.reset"
var title: Text { Text("Reset Tips") }
var message: Text? { Text("You can reset the tips") }
var image: Image? { Image(systemName: "arrow.counterclockwise") }
}
private let firstTip = FirstTip()
@State private var tips: TipGroup = TipGroup(.ordered) {
SecondTip()
ResetTip()
}
var body: some View {
VStack(spacing: 16) {
Text("TipKit Examples")
.font(.largeTitle)
Spacer()
Text("Tips are provided by TipKit")
TipView(firstTip)
Spacer()
.frame(height: 200)
Text("They can be shown as popups")
.popoverTip(tips.currentTip)
Text("Tips can be reset using Tips.resetDatastore()")
.popoverTip(tips.currentTip)
Spacer()
Spacer()
}
.padding()
.font(.title3)
.task {
try? Tips.resetDatastore()
try? Tips.configure()
}
}
}
@available(iOS 18.0, *)
#Preview {
SampleTipKitView()
}