Hi,
I can't understand what's not working. But i'm workign through a tutorial trying to send text from a text field to another controller and when I click the button to sned, the programme crashes and the message is Coding is:
class ViewController: UIViewController {
@IBOutlet weak var textToSendField: UITextField!
override func viewDidLoad() {
super.viewDidLoad()
/
}
@IBAction func showMe(sender: AnyObject) {
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
/
}
/
/
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
let messageController = segue.destinationViewController as MessageViewController
messageController.messageData! = textToSendField.text?
}
The error messgae is:
: 'UIViewController' is not convertible to 'MessageViewController'; did you mean to use 'as!' to force downcast?
if I change it to as! then I get the following error
Value of optional type 'String?' not unwrapped; did you mean to use '!' or '?'?
Not quite sure what's going on, can anyone help?
R