layer.cornerRadius works in viewDidAppear but not in viewDidLoad

We have classes BaseTextField and BaseButton.

txt1 and btn1 are objects of the above classes respectively.

This below code works in viewDidAppear, but not in viewDidLoad.

txt1.layer.cornerRadius = 8.0
btn1.layer.cornerRadius = 8.0
btn1.titleLabel?.font = .boldSystemFont(ofSize: 17.0)

In viewWillLayoutSubviews, only the button changes the layer but not the textfield.

Can someone throw some light?

layer.cornerRadius works in viewDidAppear but not in viewDidLoad
 
 
Q