Tipkit Tips keep popping up after invalidation

I'm using UIKit and setting up TipKit with the suggested defaults

try? Tips.configure([
                .displayFrequency(.immediate),
                .datastoreLocation(.applicationDefault)
])

within

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {

}

Every time I swipe out of the app the tips start reappearing again - even the ones that have been invalidated. Has this happened for anyone else and does anyone else have a solution?

Here's an example of one of my tips

struct createTabTipHomePage: Tip {
        var title = styleTipTitle("Title")
        var message = styleTipMessage("Message")
        var asset: Image {
            Image(systemName: "plus.square")
                .resizable()
        }

        var rules: [Rule] {
            [
                #Rule(TipActions.$homeTrandingScrolledToCreateTrigger) {
                    $0 == true
                }
            ]
        }

        var options: [TipOption] {
            [Tip.MaxDisplayCount(1)]
        }

        func showAction() {
            TipActions.homeTrandingScrolledToCreateTrigger.toggle()
        }

    }
Answered by fl01 in 771211022

The solution for me was to not make the Tip struct private. Now it's remembering its state.

@LogicalLight's solution with setting an ID also solved it. Then you can have the struct private.

I have the same issue here. Xcode 15.0.1, iOS 17.0.3

I've tried these same steps and can't get the tip from popping up each new app launch.

I just tried this:

struct createTabTipHomePage: Tip {
    let id = "MyViewName.createTabTipHomePage"

And now the tip will remember its state properly. And yet my other tips don't need this, so I don't know what's going on.

Accepted Answer

The solution for me was to not make the Tip struct private. Now it's remembering its state.

@LogicalLight's solution with setting an ID also solved it. Then you can have the struct private.

Thanks all. For future readers - the solution was to manually assign each tip with an id like @LogicalLight mentioned. If I had to guess I'd say the assigned tip Id doesn't stay the same between launches.

The Tip protocol documentation reads:

/// The tip's unique identifier.
///
/// If you don't provide a value, the system assigns the name of the type that conforms to the `Tip` protocol during initialization.
var id: String { get }
'''
Tipkit Tips keep popping up after invalidation
 
 
Q