Why a TipKit configured with a weekly frequency, on the following example, when the app is launched on the View1, the tip is displayed. I thought that going to View2 and come back to View1 should not redisplayed the tip (at least until one week).
What do I miss?
import SwiftUI
import TipKit
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 {
var body: some Scene {
WindowGroup {
TabView {
View1()
.tabItem {
Label("View1", systemImage: "house")
}
View2()
.tabItem {
Label("View2", systemImage: "house")
}
}
.task {
do {
// uncomment to reset all tips status
// try? Tips.resetDatastore()
try Tips.configure([
.displayFrequency(.weekly),
.datastoreLocation(.applicationDefault)
])
}
catch {
print("Error initializing TipKit \(error.localizedDescription)")
}
}
}
}
}
struct View1: View {
let favoriteLandmarkTip = FavoriteLandmarkTip()
var body: some View {
VStack {
TipView(favoriteLandmarkTip, arrowEdge: .bottom)
Image(systemName: "star")
}
}
}
struct View2: View {
var body: some View {
Text("View2")
}
}