In swift, we can actually access all the global variables and there is not concept of data hiding.
But you may often encounter some issues in setting the global objects’ property when you decare them as optional(var myView:UIView?). The question mark(?) makes it optional allowing to accept nil values. The solution is use ! ?????
Let assume, you have a declared a variable named as shown below.

class myClass{
var myView:UIView?
}

Lets assume you have function setView. To set the value, you need to do as shown in the following.

class myClass{
   var myView:UIView?
   func setView(){
        myView = UIView(frame: self.view.frame)
        myView!.backgroundColor = UIColor.clearColor()
   }
}

If you don’t use !, you may get compiler error “Cannot assign to the result of this expression error”