Post

Replies

Boosts

Views

Activity

Reply to TipKit with NavigationSplitView
I've found a way. // // TestApp.swift // Test // // Created by Michael Fuhrmann on 19/10/2023. // 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) Task { @MainActor in try await Task.sleep(for: .seconds(0.5)) await SecondTip.simpleRuleTipEnabled.donate() } } 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 { static let simpleRuleTipEnabled = Event(id: "simpleRuleTipEnabled") var title: Text {Text("SecondTip")} var message: Text? {Text("SecondTip")} var image: Image? {Image(systemName: "trash")} var rules: [Rule] { #Rule(Self.simpleRuleTipEnabled) { $0.donations.count > 0 } } }```
Oct ’23