I have View1 in which button has title and I did successful segue to View2 with passing the Button title String which will be assigned to View 2 Button also.
Now when user go back from View2 to View1 , View1 Button has no value. How can I pass button value to View1?

I tried delegate method.. But no success :

**Edited**

**View1**

```
class PatientBreifInfoViewController: UIViewController, TasksViewDelegate {

    var passName: String!

    @IBOutlet weak var patientName: UIButton!

    override func viewDidLoad() {
        super.viewDidLoad()

        patientName.setTitle(passName, forState: .Normal)
    }

    func setName(name: String) {
        patientName.setTitle(name, forState: .Normal)
        print("View1")
        print(name)
    }

    override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {

        if (segue.identifier == "toTasks") {
            let controller = segue.destinationViewController as! TasksViewController
            controller.delegate = self
            controller.passName = passName
        }
    }

}

```

**View2**

```
protocol TasksViewDelegate: class {
    func setName(patientName: String)
}

class TasksViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {

    var passName : String!

    @IBOutlet weak var backButton: UIButton!
    @IBOutlet weak var tableView: UITableView!
    @IBOutlet weak var patientName: UIButton!

    weak var delegate: TasksViewDelegate?

    override func viewDidLoad() {
        super.viewDidLoad()

        patientName.setTitle(passName, forState: .Normal)
    }

    @IBAction func backButton(sender: AnyObject) {
        delegate!.setName(passName)
        self.navigationController?.popViewControllerAnimated(true)
    }

}

```