Skip to content

Instantly share code, notes, and snippets.

import UIKit
// MARK:- Protocol Created
protocol SendDataDelegate : class {
func passingData(_ text:String)
}
@IBOutlet weak var txtEnterName: UITextField!
weak var delegate: SendDataDelegate? = nil
@IBAction func btnSendNameClicked(_ sender: UIButton) {
}
//MARK: Call protocol method when user click on button
if delegate != nil {
if (txtEnterName.text?.count)! > 0 {
self.delegate?.passingData(txtEnterName.text ?? "")
self.navigationController?.popViewController(animated: true)
}else{
@IBOutlet weak var lblName: UILabel!
@IBAction func btnGetNameClicked(_ sender: UIButton) {
}
let storySecond = self.storyboard?.instantiateViewController(withIdentifier: "SecondVC") as! SecondVC
storySecond.delegate = self
self.navigationController?.pushViewController(storySecond, animated: true)
//MARK:- Delegate Method
func passingData(_ text: String) {
lblName.text = text
}
var parser = XMLParser()
var arrDetail : [String] = []
var arrFinal : [[String]] = []
var content : String = ""