Contents

hideTipsForTesting(_:)

Hide specified tips regardless of their display rule eligibility for UI testing without certain tips.

Declaration

static func hideTipsForTesting(_ tips: [any Tip.Type])

Parameters

  • tips:

    Array of tips to hide regardless of their display rule eligibility.

Overview

This function can also be called with the launch argument -com.apple.TipKit.HideTips FindTrailheadTip,SlopeProfileTip.

TipKit’s display override testing functions have the following precedence:

Priority

Testing function

First

Showtipsfortesting(_:)

Second

Hidetipsfortesting(_:)

Third

Showalltipsfortesting()

Fourth

Hidealltipsfortesting()

import SwiftUI
import TipKit

@main
struct LandmarkTips: App {
    var body: some Scene {
        WindowGroup {
            ContentView()
        }
    }

    init() {
        setupTips()
    }

    // Configure tips in the app.
    func setupTips() {
        do {
            #if DEBUG
            Tips.hideTipsForTesting([FindTrailheadTip.self, SlopeProfileTip.self])
            #endif

            try Tips.configure()
        }
        catch {
            print("Error initializing TipKit \(error.localizedDescription)")
        }
    }
}

See Also

Testing