ARTICLE AD BOX
I am using the TipKit in my iOS 16+ app to show usage hints to the user. Since TipKit is available from iOS 17+ I use the protocoal based wrapper shown below.
While displaying tips works fine in general, I noticed that tips keep re-appearing, until they are actively dismissed using the X-close button within the tip. While a tap outside also dismisses the tip, it seems not to be sufficient to mark the tip as displayed and prevent it from showing again.
Is this a general / intended behaviour or a problem with my setup?
Is there any way to use tap outside to prevent tips from showing multiple times?
Tips should be as least annoying as possible. Thus a simple tap outside should be enough to stop them from showing again.
Full setup:
/// Protocol for ensuring compatibility. /// Enables tips to be passed and stored as properties without availability issues. @available(iOS, obsoleted: 17, message: "This will be removed once we only support iOS 17+") public protocol TipSupport { @available(iOS 17, *) var tip: AnyTip { get } } @available(iOS 17, *) public extension Tip where Self: TipSupport { var tip: AnyTip { AnyTip(self) } } public extension View { /// Helper for making the `popupTip` modifier available for iOS <17. @available(iOS, obsoleted: 17, message: "Can be removed once we only support iOS 17+") @ViewBuilder func popupTip(_ tipSupport: TipSupport?, arrowEdge: Edge = .top) -> some View { if #available(iOS 17, *), let tip = tipSupport?.tip { self.popoverTip(tip, arrowEdge: arrowEdge) } else { self } } }Now I can use tips in my code:
struct TipTestView: View { // let sampleTip = SampleTip() var body: some View { Text("Hello, World!") .popupTip(SampleTip()) //.popupTip(sampleTip) // no difference } } struct SampleTip: Tip, TipSupport { var id: String { "SampleTip" } var title: Text { Text("Some Title") } var message: Text? { Text("More information") } var image: Image? { Image(systemName: "hand.tap") } }TipKit is configured in my app setup:
.task { if #available(iOS 17, *) { #if DEBUG //try? Tips.resetDatastore() #endif try? Tips.configure([ .datastoreLocation(.applicationDefault), .displayFrequency(.immediate) ]) } }