Swift Accessing IBOutlet from another class
<p>So I have got my view controller which has a IBOutlet property that gives the view controller access to an added view(A view dragged into view controller in the storyboard file, the view class also has a UILabel property outlet)
I am trying to modify the text of uilabel in view class.
First I tried directly using view.label.text = "some text", but it didn't work.
Then I wrote a function in the view class to set the label text, magically it worked. Why doesn't the first way work while the second one does?</p>

<pre><code>class Controller : UIViewController {

    @IBOutlet weak var answerResultView: AnswerResultView!

    @IBAction func button(sender : AnyObject){
        answerResultView.text = "some text" //this line doesn't work
        answerResultView.setText("some text")
    }
}

class TheView : UIView {

    @IBOutlet weak var label : UILabel!

    func setText(text : String){ 
        label.text = "Some text"
    }
}
</code></pre>

<p>Thanks so much for any answer</p>