I am trying to change the background color of a SwiftUI popover tip to always be white. Currently, when we switch between light and dark mode, the background of the popoverTip changes color. I want it to remain white all the time.
Please note that I am using a popoverTip using TipKit, and my code is in SwiftUI and not UIKit. For UIKit, there are ways to get around this issue such as:
let popoverController = TipUIPopoverViewController(sampleTip, sourceItem: sampleButton)
popoverController.view.tintColor = UIColor.orange
however, I cannot find an approach for my popoverTip to have a constant white background color. Any tips or ideas are highly appreciated.
Approaches tried:
I tried creating a custom tip style, “MyTipStyle: TipViewStyle” but this only changes the components within the tooltip, and not the background color of the tip itself.
Text("To")
.popoverTip(tip3, arrowEdge: .leading, action: {_ in})
.tipViewStyle(MyTipStyle())
I added:
UIView.appearance(whenContainedInInstancesOf: [TipUIPopoverViewController.self]).tintColor = .white
UIView.appearance(whenContainedInInstancesOf: [TipUIPopoverViewController.self]).backgroundColor = .white
UIView.appearance(whenContainedInInstancesOf: [TipUIPopoverViewController.self]).overrideUserInterfaceStyle = .light
all have been unsuccessful in changing the background of the tooltip itself, and they change the background of the components within it instead.