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")
}
}
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?
Post not yet marked as solved
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()
}
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!
Post not yet marked as solved
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?
Post not yet marked as solved
I didn`t find the header file to import when i tried to use TipKit in Objective-C file.
Post not yet marked as solved
I am about to start to develop some Tips for my app in Xcode 15 beta. Where can I find TipKit sample code to reference and where can I find documentation to help me out? I will be integrating these Tips in both SwiftUI and UIKit; how is the functionality the same/different?
Post not yet marked as solved
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?
Post not yet marked as solved
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 ?
Post not yet marked as solved
this functionality run on UIKit?