I want to create chat using apple notification and I want when I get the notification pass the data to my Table View to update it I am trying to do a sample example to test how to pass data form app delegate to viewController and it not working can anyone help please My ViewController Code
class ViewController: UIViewController {
var fileDirectory: String = String()
let delegate = UIApplication.sharedApplication().delegate as! AppDelegate
override func viewDidLoad() {
super.viewDidLoad()
NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(ViewController.refreshView(_:)), name: "refreshView", object: nil)
}
func refreshView(notification: NSNotification) {
fileDirectory = delegate.filePath
print("tester")
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
}
I want to access refreshView function from appDelegate