You should add @IBOutlet property to your UIViewController class.
class YourViewController: UIViewController {
@IBOutlet weak var label: UILabel! // link it with UILabel in the storyborad.
}
Then you will able to have an access to UILabel:
if let page = UIStoryboard().instantiateViewController(withIdentifier: "features_view_controller") as? YourViewController {
page.label //your label, which is currently nil, because the view controller still does not draw view.
}
But if you need update, for example, the label text, then you should prepare "data transfer object" and pass it to your view controller. After view did load, you can update UILabel. Example below:
class YourViewController: UIViewController {
@IBOutlet weak var label: UILabel!
var text: String? //text for label.
override func viewDidLoad() {
super.viewDidLoad()
label.text = text
}
}
if let page = UIStoryboard().instantiateViewController(withIdentifier: "features_view_controller") as? YourViewController {
page.text = "Test"
//show page (present or push view controller) or manually send command for drawing view (page.view)
}