title: How do I send a message on iMessage App Extension as a text in the input field?
body: <p>I have this iMessage app Extension with which when I press the data on the cell in the Table..this data would be sent. But i keep getting it in the format of a MessageTemplate. All I need is it to be sent as a normal text o n the input field. Please help!  </p>
  
  <p>I went through Apple Documentations and found out this function:   </p>
  
  <pre><code>func insertText(_ text: String,completionHandler: ((Error?) -&gt; Void)? = nil)
  </code></pre>
  
  <p>And This is my code:</p>
  
  <pre><code> func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
      print("cell selected at row \(indexPath.row)")
  
              let entry = filteredContacts[(indexPath as NSIndexPath).row]
              let name = entry.name
              let phone = entry.phone
  
              let layout = MSMessageTemplateLayout()
              layout.caption = name
              layout.subcaption =  score
  
              let message = MSMessage()
              message.layout = layout
  
      self.activeConversation?.insert(message, completionHandler: nil)
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/3FVJI.png" rel="nofollow noreferrer">This is how the message gets sent(The first part of the image) I want it to be sent as normal text( like the second part of the image):</a></p>
  
  <p>Please Help!! Thanks in advance!</p>