In our app, we have a light mode and a dark mode that switch the text colors and background colors. Theme is an enum with cases light and dark. We have methods for switching the colors, such as:
var textColor: UIColor {
switch self {
case .light:
return UIColor(red:60/255.0, green:60/255.0, blue:60/255.0, alpha: 1.0)
case .dark:
return UIColor(red: 240.0/255.0, green: 248.0/255.0, blue: 255.0/255.0, alpha: 1.0)
}
}
And we have an apply method that applies the Theme to all of the views we use in our app:
func apply(){
defaults.set(rawValue, forKey: "selectedTheme")
UIApplication.shared.delegate?.window??.tintColor = tintColor
let navBarAppearance = UINavigationBar.appearance()
navBarAppearance.barStyle = barStyle
navBarAppearance.backgroundColor = backgroundColor
navBarAppearance.barTintColor = backgroundColor
navBarAppearance.tintColor = tintColor
navBarAppearance.isTranslucent = false
navBarAppearance.titleTextAttributes = [NSAttributedString.Key.foregroundColor: textColor]
let tabBarAppearance = UITabBar.appearance()
tabBarAppearance.barStyle = barStyle
tabBarAppearance.backgroundColor = backgroundColor
tabBarAppearance.barTintColor = backgroundColor
let toolBar = UIToolbar.appearance()
toolBar.backgroundColor = backgroundColor
toolBar.tintColor = backgroundColor
toolBar.barStyle = barStyle
toolBar.isTranslucent = false
toolBar.barTintColor = backgroundColor
UITableViewCell.appearance().backgroundColor = backgroundColor
UILabel.appearance(whenContainedInInstancesOf: [UITableViewCell.self]).textColor = textColor
UILabel.appearance().textColor = textColor
UITextField.appearance().keyboardAppearance = keyboardColor
UITextField.appearance().textColor = textColor
UITextField.appearance().backgroundColor = backgroundColor
UITextView.appearance().textColor = textColor
UITextView.appearance().backgroundColor = backgroundColor
MultiSelectSegmentedControl.appearance().tintColor = tintColor
MultiSelectSegmentedControl.appearance().backgroundColor = backgroundColor
UISegmentedControl.appearance().tintColor = tintColor
UISegmentedControl.appearance().backgroundColor = backgroundColor
UIButton.appearance().tintColor = tintColor
BigButton.appearance().backgroundColor = Theme.current.tintColor
BigButton.appearance().tintColor = Theme.current.backgroundColor
UIPickerView.appearance().backgroundColor = Theme.current.backgroundColor
UIPickerView.appearance().tintColor = Theme.current.tintColor
UITableView.appearance().backgroundColor = backgroundColor
UITableView.appearance().separatorColor = cellSelectionColor
UISearchBar.appearance().backgroundColor = backgroundColor
UISearchBar.appearance().barTintColor = tintColor
UISearchBar.appearance().searchBarStyle = .minimal
UITextView.appearance().backgroundColor = backgroundColor
UITextField.appearance(whenContainedInInstancesOf: [UISearchBar.self]).textColor = textColor
UISwitch.appearance().onTintColor = tintColor
let colorView = UIView()
colorView.backgroundColor = cellSelectionColor
UITableViewCell.appearance().selectedBackgroundView = colorView
}
When one selects text in our app and presses the "look up" button in the popup menu item, the popup that appears looks right. However, when you click on some of the views (such as dictionary and siri knowledge), the background or text colors appear to have been changed. Example:
How can we control the text color on this popup?
EDIT: The goal is to find the name of the UI Object that is created when the UIMenuItems are pressed. It’s not in the XCode Debugger Inspector, nor is it in self.view.subviews. It seems to be some kind of built-in object that is hidden from the rest of the processes.

