Question: I would like to access a variable from my rootViewController from within a different viewController (it‘s a CollectionViewCell).

```
window!.rootViewController = ViewController()

```

I declare the var like so:

```
import UIKit

class ViewController: UIViewController {

    var testString : String = "Test";

    override func viewDidLoad() {    
[…]

```

And try to access it this way:

```
import UIKit

class MainCollectionViewCell: UICollectionViewCell {
    override init(frame: CGRect) {
        […]
        super.init(frame: frame)

        let mainView = self.window!.rootViewController
        var testStringFromMainView = mainView.test
[…]

```

But all I keep getting is:

```
Type of expression is ambiguous without more context

```

Strange thing is, when I try for example

```
mainView.view.backgroundColor = UIColor.redColor()

```

it works.

I can’t figure out what I am doing wrong. Any help is appreciated!

Answer: 
I got the same problem as yours,and I tried portfoliobuilder's way but it didn't work.
And then I just make some changes on my code,then it worked.
I just set every instance of my button an OnlickListener interface instead of letting my Class inplements the View.OnClickListener~

```
button.setOnclickListener(new View.OnClickListener){
public void onClick(View v){//...
}
}

```

INSTEAD OF

```
public YourClass implements View.OnClickListener{...
public void OnClick(View v){
switch(v.getId()){
case://...
break;}}}

```
I had this happen to me on the first click of a CardView inside a RecyclerView. It turns out the CardView XML set:

```
android:focusable="true"
android:focusableInTouchMode="true"

```

Once I removed that, the first click (and subsequent clicks) worked fine, and I no longer had the error with ACTION\_DOWN.