Skip to content

Instantly share code, notes, and snippets.

@skyofdwarf
Created April 9, 2020 05:47
Show Gist options
  • Save skyofdwarf/d6102fc7a2ecd90ab053ee27dd7bdad9 to your computer and use it in GitHub Desktop.
Save skyofdwarf/d6102fc7a2ecd90ab053ee27dd7bdad9 to your computer and use it in GitHub Desktop.
A note about UILabel.textColor in the widget on iOS 13

A note about UILabel.textColor in the widget on iOS 13.

Not checked in the app.

Situation 1

text color set on IB is not shown in dark mode. I set UILabel.textColor in code.

Situation 2

When running the code like the below, the text color of UILabel in myView is not RED. But lazyMyView is RED.

class MyView: UIView {
	@IBOutlet weak var label: UILabel!

	override func awakeFromNib() {
		super.awakeFromNib()

		label.textColor = .red
	}
}

class SomeViewOrVController {
	let myView = MyView.loadFromXib()
	lazy var lazyMyView = MyView.loadFromXib()	
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment