Swift Take a variable in second File ButtonViewCon

2019-09-07 05:55发布

问题:

In My project i have two file ViewController.swift and ButtonViewController.swift . In ViewController i have this code

var nomeLabel:String!
func goToView(sender: UIButton!) {
// self.performSegueWithIdentifier("goToView", sender: self) // I used This for Go to Second View in Another moment
var label: UILabel = UILabel()
label.frame = CGRectMake(self.view.frame.size.width/2, 10, 150, 21);
label.backgroundColor = UIColor.blackColor()
label.textColor = UIColor.whiteColor()
label.textAlignment = NSTextAlignment.Center
label.text = "\(self.nomeLabel)"
self.myView.addSubview(label)
})
}

and now I want to take the value of the variable self.nomeLabel in the second file ButtonViewController.swift. how can I view this variable in ButtonViewController.swift ?