I'm facing multiple issues with TipKit. Let's start with this one. It's a NavigationSplitView, side bar has a toolbar button with a .popoverTip as well as the detail view. When launched (iPad landscape for example) only the sidebar tip shows, which is understandable because you wouldn't want two tips to show. However when the sidebar tip is .invalidate the second tip doesn't show. One needs to restart the app. How can I show the detail tip after the sidebar tip has been .invalidate?
import SwiftUI
import TipKit
@main
struct TestApp: App {
let firstTip = FirstTip()
let secondTip = SecondTip()
var body: some Scene {
WindowGroup {
NavigationSplitView {
List(1..<3) { i in
NavigationLink("Row \(i)", value: i)
}
.toolbar {
ToolbarItem {
Button {
firstTip.invalidate(reason: .actionPerformed)
} label: {
Image(systemName: "fireworks")
}
.popoverTip(firstTip, arrowEdge: .top)
}
}
.navigationDestination(for: Int.self) {
Text("Selected row \($0)")
}
.navigationTitle("Split View")
} detail: {
Text("Please select a row")
.toolbar {
ToolbarItem {
Button {
secondTip.invalidate(reason: .actionPerformed)
} label: {
Image(systemName: "trash")
}
.popoverTip(secondTip, arrowEdge: .top)
}
}
}
}
}
init() {
try? Tips.resetDatastore()
try? Tips.configure([
.datastoreLocation(.applicationDefault),
.displayFrequency(.immediate)
])
}
}
struct FirstTip: Tip {
var title: Text {Text("FirtTip")}
var message: Text? {Text("FirtTip")}
var image: Image? {Image(systemName: "trash")}
}
struct SecondTip: Tip {
var title: Text {Text("SecondTip")}
var message: Text? {Text("SecondTip")}
var image: Image? {Image(systemName: "trash")}
}