In this course, we're going to build a currency converter app in order to teach you about JSON and APIs. We're going to get some data from the internet, process them, and then display them to the user.
Intended Audience
This course is designed for anyone who wants to:
- Learn about iOS development and coding
- Move into a career as an iOS developer
- Master Swift skills
Prerequisites
To get the most out of this course, you should have some basic knowledge of iOS.
Hi. Within this lecture, we're going to see what a JSON is and how we can use this JSON in order to process this data and show this to the user. So, let me go to Google and search for JSON. So, as you can see, it has its has own website. So, this is JSON.org. And this actually stands for JavaScript object notation. So, this is kind of a way to display data, okay? This is a format. This is standard format in order to display data. So, in order to have an objective notation standard and it looks like this, but we're going to see the real JSON data in a minute. So, let me go down here. You will see a lot of programming languages. So, we don't use JSON only in swift, only in iOS development. So, as you can see, a lot of programming languages have some libraries that can work with JSON format. So, this is a standard format, standard object notation that we can use in a lot of programs, in a lot of softwares, in a lot of programming languages, and a lot of platforms as well so that we can easily use this easily convert this to any data that we may want to display to the user, okay? So, I'm going to go back to my fixer.io and I'm going to show you how our data will look like in real example. And you have to sign up first. So, as you can see, we have some button over here saying that get free API key. And after you sign up, of course, you can log in, but right now I'm going to show you how to create an account, okay? So, when you click on here, you have to choose free plan, and when you choose your free plan. As you can see it asks for an email and the password and other details as well. So, provide your email password, provide your mail address, and postal code, and the city and the country. And after clicking these 'Buttons' clicking these 'Checkboxes' actually, you can just say sign up and create your account. I'm not going to do that because I already have an account. I'm going to be logging in instead. So, if I say sign in, it will bring me a dashboard like this. So, when you sign up, it will bring you a dashboard like this. And in here, this is called Control Panel dashboard and we have our own API access key. So, this is important. We're going to use this in order to get data. If you see an empty string in here like an empty box, you can always click on 'Reset' to get one of these API access keys, okay? So, this is our dashboard and we have a small menu in here. You can upgrade your account, you can just choose a subscription plan, you can change your details from your account page and everything. but right now we're interested in this quick start guide or documentation. So, if you click one of these like documentation, it will take you through a web page in which you can find the details of this API. And of course, I'm going to show you how to work with this, but you will need this URL, okay? As you can see, this is the URL that we want to go if we want to get the data and when we get the data like here in the API response, we're going to be seeing a JSON data. So, this is how it looks like. So, this is a JSON format and here as you can see, we have different values and it looks like some key value pairings in an array, right? So, this is key and this is value. So, this is key, this is value. And as you can see, we got the boolea, we got an integer, we got string, we got a string again, and we got an array. So, we have some various values inside of a string to any dictionary in here as you can see. And we're going to use that information later on. So, it's important to understand your JSON format, it's important to understand what your data will look like once you get it, and this is the response. This is going to be our response from this web page. But before we get this response, we have to create a request. So, in here, in this section, you're going to learn a lot of new things, a lot of new codes, a lot of new techniques. Remember that we're trying to get this response. And in order to get this response, we have to create a request. We have to go to a URL to reach that data, and the URL is written in here. If you copy and paste this into your browser, okay? This is the data that I'm copying right now. If I paste this over here, it will ask me for my API key. Before providing that API key, make sure you delete the spaces between these words, okay? You don't want a space in here in order not to get any error and then delete this API key and replace it with your own API key. So, let me go back and copy mine from here, okay? And let me delete this API key and paste my own API key in here. And as you can see, we get this result in here, okay? So, this is what we are looking for. So, these are the exact steps that we're going to replicate in our own app. So, we're going to go into this URL using of course, programmatic way. So, we're going to create a request inside of our app. The app will go here. It will go to this URL. An app will get this data and display it for us. Of course, after getting this data, we have to process it so that we can be ready to display to the user. But right now, you know the exact steps that we're going to do. So, let's stop here. And within the next lecture, we're going to create our project and start working on it.
Atil is an instructor at Bogazici University, where he graduated back in 2010. He is also co-founder of Academy Club, which provides training, and Pera Games, which operates in the mobile gaming industry.