Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ViewController:
- //
- // ViewController.swift
- // MultiView
- //
- //
- import UIKit
- class ViewController: UIViewController {
- @IBAction func Go(_ sender: UIButton) {
- self.performSegue(withIdentifier: "goToSecond", sender: self)
- }
- override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
- if segue.identifier == "goToSecond" {
- let destination = segue.destination as! SecondViewController
- destination.username = "Test"
- }
- }
- override func viewDidLoad() {
- super.viewDidLoad()
- // Do any additional setup after loading the view.
- }
- }
- class ViewController2Class : UIViewController {
- @IBAction func Close(_ sender: UIButton) {
- self.dismiss(animated: true, completion: nil)
- }
- override func viewDidLoad() {
- super.viewDidLoad()
- // Do any additional setup after loading the view.
- }
- }
- //
- // SecondViewController.swift
- // MultiView
- //
- //
- import UIKit
- class SecondViewController: UIViewController {
- var username : String = "myNickName"
- override func viewDidLoad() {
- super.viewDidLoad()
- // Do any additional setup after loading the view.
- }
- /*
- // MARK: - Navigation
- // In a storyboard-based application, you will often want to do a little preparation before navigation
- override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
- // Get the new view controller using segue.destination.
- // Pass the selected object to the new view controller.
- }
- */
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement