I tried to google it but all the tutorials are in swift 3 or below. All I know is that you have to use a JSONEncoder in swift and have to send the JSON data from swift.
Thanks for the help.
I tried to google it but all the tutorials are in swift 3 or below. All I know is that you have to use a JSONEncoder in swift and have to send the JSON data from swift.
Thanks for the help.
Go through this link to know how to install Alamofire.
How to install the Alamofire 4.0 in Xcode 8.0
Use this code to send your data to server.
// https://www.yourAPIHostedWebsite.com/endpoints/
let url = "http://www.example.com/index.html?name=santosh&country=nepal"
Alamofire.request(url, method: .get)
.validate(statusCode: 200..<300)
.responseJSON { response in
print(response)
}.resume()
Now you need a code in your server to store datas. Here a very simple code which gets value. I hope you know how to store data to Mysql database on server side. If not this link might be helpful to start.
<?php
$name = $_GET["name"];
$country = $_GET["country"];
if($name || $country) {
// Now store these values to your database.
}
?>