I have two ViewControllers, FirstViewController
and SecondViewController
. Both have an own Swift file, FirstViewController.swift
and
Try this:
SecondViewController().showAlert(self)
In your second view controller
if let text = textField?.text {
dispatch_async(dispatch_get_main_queue(),{
let alert = UIAlertView(title: "Working!", message: "This function was called from FirstViewController!\nTextField says: \(text)", delegate: nil, cancelButtonTitle: "Okay")
alert.show()
})
}