title: Alamofire HTTP Request
body: <p>i want to send http post request with Alamofire. there is my code for send request in sampleViewController and get response from request. there is a problem i got response from server but when I want to print response in sample view controller my response always return nil. how can check response after get response from server?</p>
  
  <pre><code>  public class PersistencyManager {
  
   func SendPostHttpRequest(baseURL: String, parameter: [String:Any?], content: String) -&gt; Any? {
  
          let url = URL(string: Constant.baseURL)
       var result : Any?
  
          var urlRequest = URLRequest(url: url!)
            urlRequest.setValue("text/html; charset=utf-8", forHTTPHeaderField: "Content-Type")
            urlRequest.setURLEncodedFormData(parameters: parameter)
  
            Alamofire.request(urlRequest).responseJSON { response in
  
              switch response.result {
  
              case .success :
  
  
                if let JSON = response.result.value as? [String:Any] {
                  print("JSON: \(JSON)")
  
                  result = JSON
                }
  
  
  
              case .failure :
  
                result = nil
  
              }
            }
          default:
            break
          }
  
          return result
  
      }
      }
  
  
      class sampleViewController: UIViewController {
  
        @IBOutlet weak var sendButton: UIButton!
        @IBOutlet weak var centerVIew: UIView!
          override func viewDidLoad() {
              super.viewDidLoad()
  
  
  
        }
  
       @IBAction func SendRequest(_ sender: Any) {
  
          let parameters = ["key":Constant.serverKey,"userid":"0" ,"action":"vitrin","step":"list","sort": nil,"filter":nil,"start":String("5"),"end":String("8")]
  
          Constant.libraryAPI.parameters = parameters
          Constant.libraryAPI.requestContent = "String"
  
  
  
            let response = Constant.libraryAPI.GetAPIResponse(parameters: parameters, contentType: "String")
           print(response) //this line call before get response from server
       }
      }
  </code></pre>