title: How to create a Dynamic link in Firebase programmatically? Swift
body: <p>I would like to create a firebase dynamic, but I can't get error in <code>components.shorten</code> </p>
  
  <blockquote>
    <p>The operation couldn’t be completed. Long link is not parsable.</p>
  </blockquote>
  
  <p>I am following the firebase docs, but I can get the desired outcome.</p>
  
  <pre><code> @IBAction func createGroupAction(_ sender: Any) {
  
      let dynamicLinkDomain = "https://a5481.app.goo.gl/"
      let appBundleID = "com.vividapartments.myStr.com"
  
      let params:[String : String] = [
          "ibi": appBundleID,
          "isi": "1222420082",
          "efr":"1",
          "groupID":"-LDSfWKKbWjyrXiFljT3",
          "chatID":"-LDSfWKMbm9mSE2a6EIe"
      ]
  
      // general link params
      let urlParams = params.flatMap ({ (key,value) -&gt; String in
          return "\(key)=\(value)"
      }).joined(separator: "&amp;")
  
  
      guard let deepLink = URL(string:"https://www.mystr.com/groups?\(urlParams)") else {return}
  
      print("deepLink is \(deepLink)")
      //prints:
      //deepLink is https://www.mystr.com/groups?isi=1222420082&amp;chatID=-LDSfWKMbm9mSE2a6EIe&amp;efr=1&amp;ibi=com.vividapartments.myStr.com&amp;groupID=-LDSfWKKbWjyrXiFljT3
  
      let components = DynamicLinkComponents(link: deepLink, domain: dynamicLinkDomain)
  
      let iOSParams = DynamicLinkIOSParameters(bundleID: appBundleID)
      iOSParams.minimumAppVersion = "1.5"
      components.iOSParameters = iOSParams
  
      //1. Build the dynamic long link
      let longlLink = components.url
      print("The long link is \(longlLink!)")
      //prints:
       //The long link is https://https://a5481.app.goo.gl//?link=https%3A%2F%2Fwww%2Emystr%2Ecom%2Fgroups%3Fisi%3D1222420082%26chatID%3D%2DLDSfWKMbm9mSE2a6EIe%26efr%3D1%26ibi%3Dcom%2Evividapartments%2EmyStr%2Ecom%26groupID%3D%2DLDSfWKKbWjyrXiFljT3&amp;ibi=com%2Evividapartments%2EmyStr%2Ecom&amp;imv=1%2E5
  
      //Set the length of a short Dynamic Link
      let options = DynamicLinkComponentsOptions()
      options.pathLength = .unguessable
      components.options = options
  
      //2. Or create a shortened dynamic link
      components.shorten { (shortURL, warnings, error) in
          if let error = error {
              print("error is \(error.localizedDescription)")
              //prints:
              //error is The operation couldn’t be completed. Long link is not parsable: https://https://a5481.app.goo.gl//?link=https%3A%2F%2Fwww%2Emystr%2Ecom%2Fgroups%3Fisi%3D1222420082%26chatID%3D%2DLDSfWKMbm9mSE2a6EIe%26efr%3D1%26ibi%3Dcom%2Evividapartments%2EmyStr%2Ecom%26groupID%3D%2DLDSfWKKbWjyrXiFljT3&amp;ibi=com%2Evividapartments%2EmyStr%2Ecom&amp;imv=1%2E5
              return
          }
  
          // TODO: Handle shortURL.
          print("shortURL is \(String(describing: shortURL))")
      }
  }
  </code></pre>