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: 
ViewPostImeInputStage ACTION\_DOWN is a bug that occurs stemming from the rare instance where your layout is rejected and you are no longer able to click on any clickable items, and what occurs instead is a ViewPostImeInputStage ACTION\_DOWN with every button press (and no action). The solution for this is simple, wrap your layout content with a parent. So if you xml format was

```
<LinearLayout <---root layout
...
<!-- your content -->
</LinearLayout> <-- root layout end

```

change to

```
<FrameLayout <---root layout
   <LinearLayout <-- parent wrap start
   ...
<!-- your content -->
   </LinearLayout> <-- parent wrap end
</FrameLayout> <-- root layout end

```

This solution should resolve that conflict. Atleast this is what has worked for me. Cheers!
None of the solutions above worked to me. Pretty strange bug, wondering if some view is intercepting the touch events and broking it, maybe some appcompat stuff, there is a lot of touch intercepts over there…

Anyway, I workarounded the problem adding a transparent `View` over my real broken button and adding the click listener on this view, pretty ugly but it worked `¯\_(ツ)_/¯`

e.g. imagine the error happened in this layout:

```
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_margin="16dp">

    <Button
        android:id="@+id/broken_button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentStart="true"
        android:layout_alignParentTop="true"
        android:layout_marginStart="0dp"
        android:layout_marginTop="0dp"
        android:text="Hello world" />

</RelativeLayout>

```

I added the transparent view and I set the click on it.

```
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_margin="16dp">

    <Button
        android:id="@+id/broken_button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentStart="true"
        android:layout_alignParentTop="true"
        android:layout_marginStart="0dp"
        android:layout_marginTop="0dp"
        android:text="Hello world" />

    <View
        android:id="@+id/workaround_button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignStart="@+id/broken_button"
        android:layout_alignTop="@+id/broken_button"
        android:layout_alignEnd="@+id/broken_button"
        android:layout_alignBottom="@+id/broken_button" />

</RelativeLayout>

```

Again, it is an ugly solution, but still a solution.