We will pass a string to class second.
let text =
"This is example text"
In ViewController.swift, function for button to open second class like
this.
func next(sender: UIButton){
let vc = second()
vc.passingtext = text
self.presentViewController(vc, animated: true, completion: nil)
}
Ignore red mark error.
Go to class second.swift, copy to above override
var
passingtext = " "
Add to viewDidLoad
la.text = passingtext
Run to see result.
No comments:
Post a Comment