title: How to build a URL by using Dictionary in Swift
body: <p>So I am messing around with the <code>iMessages</code> Framework, and in order to send data to another user the data must be sent as a <code>URLComponents</code> <code>URL</code>. However I can't figure out how to send a dictionary to use as the <code>messages.url</code> value. </p>
  
  <pre><code>func createMessage(data: dictionary) {
  
      /*
  
       The Dictionary has 3 values, 1 string and two arrays. 
  
      let dictionary = ["title" : "Title Of Dictionary", "Array1" : [String](), "Array2" : [String]() ] as [String : Any]
  
      */ 
  
  
      let components = URLComponents()
  
      let layout = MSMessageTemplateLayout()
      layout.image = UIImage(named: "messages-layout.png")!
      layout.imageTitle = "\(dictionary["title"])"
  
      let message = MSMessage()
      message.url = components.url!
      message.layout = layout
  
      self.activeConversation?.insert(message, completionHandler: { (error: Error?) in
          print("Insert Message")
      })
  }
  </code></pre>
  
  <p>Does anybody know how I can send the dictionary values as <code>URLQueryItems</code> in the <code>URLComponents</code> to save as the <code>message.url</code> ? </p>
  
  <p>PS: I was wondering wether it would be possible to create an extension for the URL to store the dictionary in, that is what I am unsuccessfully trying atm. </p>