UITextView not initialized in xCode 9

Hello. Ever since I switched to xCode 9, using a UITextView stopped working:


@IBOutlet weak var txtPirepText: UITextView!

override func viewDidLoad()
{
       if UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiom.pad
       {
           self.txtPirepText = UITextView(frame: CGRect(x: 60, y: 380, width: 900, height: 280))
           
           print("IS THIS VALUE NIL? ",self.txtPirepText)
                  
           self.txtPirepText.font = UIFont(name: "Arial-BoldMT", size: 17)
           self.txtPirepText.textColor = UIColor.black
       }
}


The print shows that the value is nil and the application crashes on trying to set a text. It worked just fine in the previous versions of iOS.

Does such initialization not work any more? Thank you!

Replies

txtpirepText is declared weak.


Dirk