Make features discoverable with TipKit

RSS for tag

Discuss the WWDC23 Session Make features discoverable with TipKit

Posts under wwdc2023-10229 tag

10 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

Multiple PopoverTip Modifiers in SwiftUI: Persistent Display Glitch
Hello! I've encountered an issue when attempting to add multiple popoverTip modifiers in my SwiftUI code. Regardless of whether there's a specified rule or parameter, the tips begin to constantly appear and disappear. Is this a recognized issue? How can we sequentially display multiple tip popovers on complex views? Even when one tip is invalidated, the glitch persists. Should this be used only for views without any state updates? Here's a sample code that demonstrates the problem: import SwiftUI import TipKit @main struct testbedApp: App { var body: some Scene { WindowGroup { ContentView() } } init() { try? Tips.configure() } } struct PopoverTip1: Tip { var title: Text { Text("Test title 1").foregroundStyle(.indigo) } var message: Text? { Text("Test message 1") } } struct PopoverTip2: Tip { var title: Text { Text("Test title 2").foregroundStyle(.indigo) } var message: Text? { Text("Test message 2") } } struct ContentView: View { private let timer = Timer.publish(every: 0.001, on: .main, in: .common).autoconnect() @State private var counter = 1 var body: some View { VStack(spacing: 20) { Spacer() Text("Counter value: \(counter)").popoverTip(PopoverTip1()) Spacer() Text("Counter value multiplied by 2: \(counter * 2)") .foregroundStyle(.tertiary) .popoverTip(PopoverTip2()) Spacer() } .padding() .onReceive(timer) { _ in counter += 1 } } } #Preview { ContentView() }
2
1
880
Sep ’23
SwiftUI: popoverTip prevents other modal views from appearing
I want to show a tip on a button that will open a modal sheet on tap. The state if the sheet should be presented is held in an ObservableObject view model: @MainActor class ViewModel: ObservableObject { @Published var showSheet = false } struct ContentView: View { var tip = PopoverTip() @ObservedObject var viewModel = ViewModel() var body: some View { Button(action: { viewModel.showSheet.toggle() }, label: { Text("Button") }) .popoverTip(tip) .sheet(isPresented: $viewModel.showSheet) { Text("Sheet") } } } Here is the issue: When the tip is dismissed by tapping outside of it instead of tapping the close button, the tip will always reappear when tapping the button instead of showing the sheet. So effectively there is no way of triggering the actual button action, the tip will always pop up again and prevent the sheet from appearing. This is only an issue when using an ObservableObject to track the sheet state. When using a @State var showSheet: Bool inside the view itself instead, the sheet is shown as expected when tapping the button. It seems to be an issue of timing: Attempting to show the sheet somehow causes the view to be re-evaluated, which causes the tip to reappear (since it wasn't dismissed via close action). And since the tip is presented using modal presentation, the sheet can't be presented anymore. Is this a bug, or is there a simple way to avoid this issue?
3
3
1.3k
Oct ’23
TipKit Image asset tint color
Hello, I have a simple tip that im displaying, but want to change the tint color to something other than the default system blue tint. I tried different approaches that are common in changing image tint color but none seem to work. Is there a special call to achieve that? Note: I'm using UIKit to display the tip. Version 15.0 beta 8 (15A5229m) Thank you! example tip: struct FavoriteTip: Tip { var title: Text { Text("Favorite This Car") } var message: Text? { Text("Favorite this car to receive status updates and more!") } var image: Image? { Image(systemName: "heart.fill") } }
4
0
1.5k
Oct ’23
Popover tips not affected by tip view modifiers
Tips presented using the popoverTip view modifier can't be styled using other tip view modifiers (as of beta 8). For instance, the last two modifiers don't have any effect here: Image(systemName: "wand.and.stars") .popoverTip(tip) .tipBackground(.red) .tipCornerRadius(30) It will look like this: Whereas applying the same modifiers to a TipView changes its look: TipView(tip, arrowEdge: .bottom) .tipBackground(.red) .tipCornerRadius(30) Is this intended behavior? How can we change the appearance of popup tips?
2
0
915
Sep ’23
TipKitMacros throws an error
Hi folks, I'm trying to implement TipKits to understand more better but I'm facing an error while trying to use @Parameter macro. Here is the sample code that I've tried as showed on instruction videos below struct FavoriteLandmarkTip: Tip { @Parameter static var isLoggedIn: Bool = false var title: Text { Text("Save as Favourite") } var message: Text? { Text("Your favorite landmarks always appear at the top of the list.") } var asset: Image? { Image(systemName: "star") } var actions: [Action] { [ Tip.Action( id: "learn-more", title: "Learn More" ), ] } } But I'm getting this error for isLoggedIn property External macro implementation type 'TipKitMacros.ParameterMacro' could not be found for macro 'Parameter(isTransient:customID:)'; the type must be public and provided by a macro target in a Swift package, or via '-plugin-path' or '-load-plugin-library' Could you help me to solve this problem ?
1
0
919
Jul ’23
Tip Kit
I am trying to use tip kit in my demo app but I am unable to access its api's. When I try to call TipsCenter.shared.configure() I am getting Cannot find 'TipsCenter' in scope. I am using the latest Xcode beta and trying in swiftUI. Any solutions?
9
6
3.8k
Jul ’23