 
 class MessageTextDelegate: NSObject, UITextFieldDelegate {
 
-    let callback: ((_ text:String) -> Void)
-
-    init(msgHandler: @escaping (String) -> Void) {
-        callback = msgHandler
-    }
-
+    var callback: ((_ text:String) -> Void)? = nil
 
     func textFieldShouldReturn(_ textField: UITextField) -> Bool {
         guard let message = textField.text else { return false }
-        callback(message)
+        callback?(message)
         print("Send Message: \(message)")
         textField.resignFirstResponder()
 

        navigationItem.title = "Send Message"

        self.view.backgroundColor = UIColor(patternImage: UIImage(named: "NewBack")!)


    }

}


class SendViewController: UIViewController {

    var textDelegate = MessageTextDelegate()
    
    
 
    @IBOutlet weak var messageTextField: UITextField! {
        didSet {
            self.messageTextField.delegate = self.textDelegate
