I'm getting the error:
Fatal error: unexpectedly found nil while unwrapping an Optional value
whenever I try adding text to a text view (bottomTextView) outside of my view controller. My text view is linked to my main view controller. I have another class called Checkbox (subclass of UIButton) that tries to add text to the text view using:
var main_vc = ViewController()
main_vc.bottomTextView.insertText("Checked")
However, I have no problem using the following inside my view controller:
bottomTextView.insertText("Checked")
I can't figure out why this is and how to fix it. Thanks!
EDIT:
My Checkbox class is a subclass of UIButton that has a method that is called whenever a checkbox is clicked. When that checkbox is clicked I want to add text to the text view inside my main view controller.