Skip to main content

post method using alamofire in swift 3

 func addSubscriptionApi(_completeUrl: String) {
        //HUD
        Alamofire.request(_completeUrl, method:.post, parameters:nil, encoding: JSONEncoding.default, headers: nil).responseJSON { response in
            switch(response.result) {
            case .success(_):
                if let data = response.result.value as? NSDictionary
                {
                    print(response.result.value as Any)
                    print(data)
                     print("SUCCESS")
                }
                break
                
            case .failure(_):
                 print("API FAILED")
                print(response.result.error as Any)
                break
            }
        }

    }

Comments

Popular posts from this blog

Set Placeholder in UiTextView in swift 3

//In viewdidLoad add this                DiscriptionTV . text = "Discription"         DiscriptionTV . textColor = UIColor . lightGray         DiscriptionTV . delegate = self          DiscriptionTV . layer . borderColor = UIColor . lightGray . cgColor ; then   //Mark:- textView Delegates          func textViewDidBeginEditing( _ textView: UITextView ) {         if DiscriptionTV . textColor == UIColor . lightGray {             DiscriptionTV . text = nil             DiscriptionTV . textColor = UIColor . white             DiscriptionLab . isHidden = false         }     }          func textViewDidEndEditing( _ textView: UITextView ) { ...