The course is part of this learning path
This course focuses on iOS special features including face recognition, custom keyboards, sticker packs, and more.
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
To get the most out of this course, you should have some basic knowledge of iOS.
Hi, within this lecture, we can see what is GitHub and how we can use it in our projects. And also, we're going to see how to use terminal, which is a good skill for us. So, in here we have the first commit, second commit, and the initial commit. So, we can go back and forth whenever we want using the Sourcetree application, right? So, what happens if I want to add this to a GitHub so that I can share my codes to the other developers, or I can collaborate with other developers to work on my projects simultaneously? So, after you create and sign in with your account, you can easily create new repositories, new projects in your GitHub account, and you can share your projects on GitHub. And it's not only saving the project codes, it's saving the Git versions as well. So, we can track what's going on inside of a project by tracking the gits. Of course, you have to make sure that your GitHub is account connected to your Sourcetree application in order to do what I'm about to show you. So, if you click on 'New' to create a new repository, meaning a new project on GitHub, you have to choose a repository name. So, I'm going to go for 'GitTest' and if you see this okay button here, it means that it's okay to go, and that's a good name. And under here, you will see two options, one is public and the other one is private. So, public means everyone can see your project on GitHub and private means no one can see your project on GitHub unless you invite them. But in order to make this private, you have to have premium GitHub account, so you have to pay for it.
So, we're good to go with public anyway. And in here, you will see 'Initialize this repository with a README' option and this will create a README file that you can write the instructions but I'm not going to do that, I'm going to show you how to manually do that later on. And if you create a repository, you will see a screen like this. In the screen, you will find some commands that you have to run on your terminal. And you have to run these commands on your project folder. So, in our case GitTestProject folder. And if you have never worked with terminal before, don't worry, I'm going to show you how to do that, and what's a terminal really.
So, click Command and Space on your keyboard. So, let me put everything down for a while, so we have a clear screen, and hit Command and Space on your keyboard. So, it will bring up the Search menu, and in here, I'm going to write 'terminal'. So, as you can see, this is the terminal that we are looking for, when you see it, just click on it and it will open a terminal for you. So, let me zoom in a little bit so you can see it better. So, you can come over here to 'View' and say 'Bigger' and once you are good to go you can stop, but I'm actually going to make it a little bit bigger so you can see it better. So, this is the terminal. This is where we run commands. So, when we type a command, the computer or the Mac OS will execute that command for us, of course, if the command is valid. And if you have worked with Linux before, I am pretty sure that you're familiar with this kind of concept. But if you're not, don't worry, I'm just going to show you the basics.
So, for example if you say 'clear' and hit 'Enter', it will clear the screen. So, 'clear; is a command. So, it's executed to command and now we are getting the result out of it. So, in this command-line in this terminal, I can write whatever I want, as long as it makes sense. For example, if I say 'ls', it means list the folders and files that I'm currently in. So, I'm in my user folder, So, I'm in the Atils folder and inside of that folder I have these folders and files. So, I can move in or out of this folder by using a command called 'cd'. For example, if I want to go to documents or downloads, I can use the cd command and I can browse to through folders in my terminal.
So, I have to write exactly as it is shown in here. So, with a capitalized D, for example. And if I do lowercase d, it won't work. For example, if you say 'cd Downloads', it will change directory. So, cd stands for changing directory to Downloads folder. Now, I'm inside the Downloads folder. If I say ls right now, I'm going to see the files and folders in the Downloads folder. So, if I open the downloads folder from here, for example, this is exactly what I'm seeing, right? So, these are the files and folders inside my Downloads folder. So, that's the list that I'm getting. So, I want to go into iOS Complete and then GetTestProject because that's where I should run these commands that are given to me by GitHub. And in order to go through that file, I'm going to say iOS, and beware that we have a space in here. So, in order to do this, I'm going to hit 'Tab' on my keyboard and it will autocomplete it for me. So, as you can see, we have to use a backslash before a space, and if you don't remember that you can just type the first three characters of your folder and hit Tab, it will autocomplete it for you. Now, I'm inside iOS Complete. Now, I'm going to write 'Git' and hit Tab, and as you can see it auto-completed it for me. Now, I'm inside of GitTestProject.
Now, if I run 'ls', I will see the available files and folders in here like this. So, that's where I want to run these commands that are given to me by GitHub in order to connect my GitHub project, GitHub repository to my local file, so that I can push all of these files and folders to my GitHub repository. So, if you zoom in a little bit, you will see some commands in here. So, these are basic UNIX or Linux or Mac OS commands. So, echo means write something, and these two braces means write this GitTest inside of README file. And this means that initialize the git process, and then we're going to add an add README file to our git. So, this is where we create the README file and we're going to commit this for the first time. So, it's going to write first commit. And then, we're going to connect this GitTest.git, this repository to our local file, and then we're going to push the origin master. And in order to run all of these commands, you can just copy them and paste in your terminal or you can just write one by one. It really doesn't matter, but I believe we can just copy them in order to be practical here. So, let's go for copy and let's come here and right click and say 'paste', and here you go. I believe I should hit 'Enter' one more time to run the last command. And I'm pushing the repository to... Pushing the project to my repository right now,
and once it's done, I can click over here to see My project is already here. So, that's good. As you can see, we have created this project 21 minutes ago, and we have changed this file 11 minutes ago. And if you come to 'ViewController.swift', you will see the print git and print get 2. So, that's cool. And remember, we have done these commits in the Sourcetree. If we haven't done any commits yet, it will push the original view controller file. So, it will just push the initial commit and then we're going to have to come here, commit the changes and then push this manually from the Sourcetree. So, let me actually show you how this goes because you might need it to push the changes to the GitHub account later on. For example, let me bring up my project file from here, and I'm going to add git3. I'm not going to prepare for anything. Let me delete this and I'm just going to print git3, yeah that's it. And I'm going to save this. Once I do that, it should reflect on the Sourcetree, and as you can see it says that there are uncommitted changes. So, let's commit those changes and say 'third commit'. And let's commit. And now if I say 'Push', it will push my project to my GitHub repository. So, let's say 'Push' and click 'OK'. And, of course, in order to do that, I'm going to have to give my password here. And this is not my GitHub password, this is my local computer password. It's going to take GitHub from my key chain and push the project for me. And as you can see, it changed. It has changed 29 seconds ago and we see the git3 right now. So, it's kind of cool. We can see all the changes. We can see, when did we do the changes? What did we change and everything?
And we can go back and forth between commands anytime we want. So, working with Git is actually kind of cool. So, if you're a developer or if you're a freelancer, it doesn't matter, you're going to be needing it eventually. So, I suggest you work with Git if you're working on an important project so that you can go back and save your project if something fails, or just use Git to share it on GitHub to collaborate with other developers or share your codes with everyone in the world. So, that's it for right now. We're going to stop here and continue within the next lecture.
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.