Post

Replies

Boosts

Views

Activity

Reply to [SWIFT] Accessing and controlling @IBOutlet variables from other ViewControllers.
Hi @spiralkiss did you first present or push the view controller in which the @IBOutlet you are trying to access is present. You can access the @IBOutlet in another view controller after presenting it or pushing it over the current view controller if let vc = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "TwoVC") as? TwoVC{ self.present(vc, animated: true) //testLbl is an @IBOutlet in TwoVC it won't crash because the View controller is already presented and IBOutlets are loaded vc.testLbl.text = "Test" }
Topic: UI Frameworks SubTopic: UIKit
Nov ’24