title: Cannot assign value of type 'Any' to type 'String?'
body: <p>I received <code>Cannot assign value of  type 'Any' to type 'String?'</code>
  when i pass the <code>posts</code> value to <code>cell.textLabel?.text</code>, i have received response from the soap service and i add to posts <code>posts.add(elements)</code>.
  And also i want to pass that <code>Posts</code> to my <code>secondViewController</code> please help, Thankyou</p>
  
  <pre><code>import UIKit
  
  class ViewController: UIViewController ,XMLParserDelegate,UITextFieldDelegate, NSURLConnectionDelegate, UITableViewDelegate , UITableViewDataSource {
  
      @IBOutlet var firstName: UITextField!
  
      @IBOutlet var lastName: UITextField!
  
      @IBOutlet var tableView: UITableView!
  
      var parser = XMLParser()
  
      var posts = NSMutableArray()
  
      var elements = NSMutableDictionary()
      var element = NSString()
      var title1 = NSMutableString()
      var date = NSMutableString()
  
       var xmlData = NSMutableData()
  
      override func viewDidLoad() {
          super.viewDidLoad()
  
          tableView.dataSource = self
          tableView.delegate = self
      }
  
      override func didReceiveMemoryWarning() {
          super.didReceiveMemoryWarning()
          // Dispose of any resources that can be recreated.
      }
  
      func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {
          return posts.count
      }
  
      func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -&gt; UITableViewCell {
  
          let cell = UITableViewCell()
  
          cell.textLabel?.text = posts[indexPath.row] // Cannot assign value of  type 'Any' to type 'String?'
  
          print(indexPath.row)
          return cell
      }
  
      func beginParsing()
      {
          posts = []
          parser = (XMLParser(data:xmlData as Data))
          parser.delegate = self
          parser.parse()
          //tbData!.reloadData()
  
          for element in posts {
              print(element)
          }
      }
  
      func parser(_ parser: XMLParser, didStartElement elementName: String, namespaceURI: String?, qualifiedName qName: String?, attributes attributeDict: [String : String])
      {
          element = elementName as NSString
  
          if (elementName as NSString).isEqual(to: "response")
          {
              elements = NSMutableDictionary()
              elements = [:]
              title1 = NSMutableString()
              title1 = ""
              date = NSMutableString()
              date = ""
  
          }
      }
  
      func parser(_ parser: XMLParser, foundCharacters string: String)
      {
  
  
         // let data = string.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines).uppercased()
  
         // let str = data.replacingOccurrences(of: "&lt;[^&gt;]+&gt;", with: "", options: .regularExpression, range: nil)
  
          if element.isEqual(to: "status")
          {
                   title1.append(string)
  
           }
          else if element.isEqual(to: "message") {
              date.append(string)
          }
      }
  
      func parser(_ parser: XMLParser, didEndElement elementName: String, namespaceURI: String?, qualifiedName qName: String?)
      {
          if (elementName as NSString).isEqual(to: "response")
          {
  
              if !title1.isEqual(nil) {
                  elements.setObject(title1, forKey: "status" as NSCopying)
              }
              if !date.isEqual(nil) {
                  elements.setObject(date, forKey: "message" as NSCopying)
              }
              posts.add(elements)
          }
      }
  
  
      @IBAction func invoke(_ sender: Any) {
  
          let firstNmaeValue = firstName.text
          let lastNameValue = lastName.text
  
          let is_SoapMessage  = String  (format :"&lt;?xml version='1.0' encoding='utf-8'?&gt;&lt;soapenv:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'&gt;&lt;soapenv:Header/&gt;&lt;soapenv:Body&gt;&lt;doRegisterUser soapenv:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'&gt;&lt;firstNameValue&gt;\(firstNmaeValue)&lt;/firstNameValue&gt;&lt;lastNameValue&gt;\(lastNameValue)&lt;/lastNameValue&gt;&lt;/doRegisterUser&gt;&lt;/soapenv:Body&gt;&lt;/soapenv:Envelope&gt;")
  
          let is_URL: String = "http://192.168.43.23/app/app/service/nm.php?wsdl"
  
          let lobj_Request = NSMutableURLRequest(url: NSURL(string: is_URL)! as URL)
          let session = URLSession.shared
  
          lobj_Request.httpMethod = "POST"
          lobj_Request.httpBody = is_SoapMessage.data(using: String.Encoding.utf8)
  
          lobj_Request.addValue("192.168.43.23", forHTTPHeaderField: "Host")
  
          lobj_Request.addValue("text/xml; charset=utf-8", forHTTPHeaderField: "Content-Type")
  
          lobj_Request.addValue(String (is_SoapMessage), forHTTPHeaderField: "Content-Length")
  
          lobj_Request.addValue("http://192.168.43.23/app/app/service/nm.php/doRegisterUser", forHTTPHeaderField: "SOAPAction")
  
          let task = session.dataTask(with: lobj_Request as URLRequest, completionHandler: {data, response, error -&gt; Void in
  
              print("response = \(response)")
  
  
  
  
               let xmlData = NSString(data: data!, encoding: String.Encoding.utf8.rawValue)
  
  
              self.xmlData = NSMutableData(data: data!)
  
              print("Body: \(xmlData)")
  
              self.beginParsing()
  
             print("Status is = \(self.title1)")
  
              print("Message is = \(self.date)")
  
              if error != nil
              {
                  print("Error: ")
              }
  
          })
          task.resume()
  
      }
  
  }
  </code></pre>