//parameters
let loginString = String(format: "email=%@&password=%@", userNameTF.text!, passwordTF.text!)
let postData = loginString.data(using: .utf8)
// create post request
let url = URL(string: @"http://www.google.com")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
// insert json data to the request
request.httpBody = postData
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data, error == nil else {
print(error?.localizedDescription ?? "No data")
return
}
let responseJSON = try? JSONSerialization.jsonObject(with: data, options: [])
if let responseJSON = responseJSON as? [String: Any] {
print(responseJSON)
}
}
task.resume()
}
Sign up here with your email
1 comments:
Write commentshttps://iosdevcenters.blogspot.com/2016/11/how-to-change-uitexefield-placeholder.html
ReplyConversionConversion EmoticonEmoticon