I am trying to add a UIView then a UILabel as a subview on Mac OS and iPad. if I call the following function in loadView() and run the iPad simulator the background turns white and my UILabel appears in the middle where its supposed to. If I run the Mac OS simulator, the background turns white but I have no text. The app is a UIKit app with the checkbox to run on Mac using Mac Catalyst checked.
Any ideas as to why its not showing my UILabel when I run on Mac OS Sim?
func coreIdea() {
view = UIView()
coreIdeaLabel = UILabel()
view.backgroundColor = UIColor.white
coreIdeaLabel.translatesAutoresizingMaskIntoConstraints = false
coreIdeaLabel.textAlignment = .center
coreIdeaLabel.text = "CoreIdea"
coreIdeaLabel.font = UIFont.systemFont(ofSize: 24)
view.addSubview(coreIdeaLabel)
NSLayoutConstraint.activate([
coreIdeaLabel.centerXAnchor.constraint(equalTo: view.centerXAnchor),
coreIdeaLabel.centerYAnchor.constraint(equalTo: view.centerYAnchor)
])
}