Hello!
I've tested/implemented TipKit in SwiftUI and UIKit but it seems that the close, i.e. X, button doesn't work in UIKit but does in SwiftUI. Not sure if this is a bug or I have to do something different about it in UIKit.
Testing with Xcode 15 Beta 8
Thanks!
The tipView does not close itself when close button clicked but tells the tip by changing the value of 'shouldDisplayUpdates' property. You can observe this property to add or remove a tip.
For TipUIView, you do not need to directly add the subview after viewDidLoad, just insert the following code after viewDidLoad to observe the tip status.
private var tipObservationTask: Task<Void, Never>? tipObservationTask = tipObservationTask ?? Task { @MainActor in for await shouldDisplay in catTracksFeatureTip.shouldDisplayUpdates { if shouldDisplay { // tells that a tip should display // add your TipUIView instance and add layout constraints } else { // tells that a tip should dismiss, e.g. the user clicked closed // remove your TipUIView instance } } }
For TipUIPopoverViewController, try the same way by presenting and dismissing the TipUIPopoverViewController instance.
More reference please see https://developer.apple.com/documentation/tipkit/tipuipopoverviewcontroller