Post

Replies

Boosts

Views

Created

I get the error "Unexpectedly found nil while implicitly unwrapping an Optional value" when calling a protocol method
When viewersTapped is clicked I want to pass the value of currentTitle from the storeViewController to the liveViewController by using a protocol. language protocol labelMaker {   func labelMaker(value: String) } class storeViewController: UIViewController {  var labelDelegate: labelMaker!  @IBAction func viewersTapped(_ sender: UIButton) {     labelDelegate.labelMaker(value: sender.currentTitle!) } } where it will be displayed within a label in the liveViewController. language class liveViewController: UIViewController { let storeView = storeViewController()     @IBOutlet var onlineViewers: UILabel! override func viewDidLoad() {  super.viewDidLoad()           storeView.labelDelegate = self } } extension liveViewController: labelMaker {   func labelMaker(value: String) {     onlineViewers.text = value } But as soon as viewersTapped is clicked I am met with the error "Unexpectedly found nil while implicitly unwrapping an Optional value"
12
0
1.1k
Feb ’21