title: how make REST API Call with Model class in swift 3 ios
body: <p><strong>i want to make REST API call in swift 3.0 with model classes of API code . Can any one help me to solved my issue?</strong></p>
  
  <pre><code>let USER_LIST_FIRMWISE_URL = "\(BASE_URL2)user_list_firm_wise.php"
  
  func userListFirmwiseRequest(firmid:String) -&gt; URLRequest {
          let Url = URL(string: (utility?.USER_LIST_FIRMWISE_URL)!)
          var request = URLRequest(url: Url!)
          request.httpMethod = "POST"
          request.cachePolicy = .reloadIgnoringCacheData
          let paramString = "firm_id=\(firmid)"
          request.httpBody = paramString.data(using: String.Encoding.utf8)
          return request
      }
  
  
  func getuserList() -&gt; Void {
  
          var request = mainApp.reqRes?.userListFirmwiseRequest(firmid: firmID)
          request?.httpMethod = "POST"
          print("request")
  
          EZLoadingActivity.show("", disableUI: true)
          let task = URLSession.shared.dataTask(with: request!) { (data: Data?, response: URLResponse?, error: Error?) in
  
              DispatchQueue.main.async
                  {
                      do {
  
  
                          guard let data = data, error == nil else {
                              print("Error=\(String(describing: error))")
                              return
                          }
                          if let httpStatus = response as? HTTPURLResponse, httpStatus.statusCode != 200{
                              print("Status code should be 200, but is \(httpStatus.statusCode)")
                              print("Response String:\(String(describing: response))")
                          }
  
                          let jsonString = try? JSONSerialization.jsonObject(with: data, options: [])
  
                          guard let JsonObject = try? jsonString as AnyObject else{
                              return
                          }
  
                          guard let Success = try? JsonObject["success"] as! Int else{
                              return
                          }
                          print("Succee Resul :\(Success)")
  
                          if Success &gt; 0{
                              guard let Message = try? JsonObject["message"] as Any else{
                                  return
                              }
  
                              guard let JsonObjectForUser = try? Message as? AnyObject else {
                                  return
                              }
                          }
  
  
                          let json = try JSONSerialization.jsonObject(with: data, options: .mutableContainers) as? NSDictionary ?? nil
  
                          if let parseJSON = json {
                              let dataDic = parseJSON.value(forKey: "message") as! NSMutableArray
  
  
                              self.arrayUserNameList = dataDic.value(forKey: "user_name") as! [String]
  
                              self.arrayUserData = dataDic
                              print(self.arrayUserNameList)
  
                              self.picker.reloadAllComponents()
                              EZLoadingActivity.hide()
                          }
                      } catch{
                          print(error)
                          EZLoadingActivity.hide()
                      }
              }
  
          }
  
          task.resume()
  
      }
  </code></pre>
  
  <p>i have used general code of NSurlsession for API call but it's too much code i have to write every time in every call. so i want common class for API CAll. but how to make common class for API call in swift 3.0</p>