This site is retired and is no longer updated since November 2021. Please visit our new website at https://www.teamscode.org for up-to-date information!
Getting Started with iOS

Hello! The first step in developing in iOS is to get Xcode on your computer. Please note that Xcode is not available on any other operating system other than macOS.

Xcode

Xcode is a programming environment for making applications for apple products. This course will be focussing only on devices that run iOS. This includes iPhones, iPads, etc. Xcode can be used to both write and test code. You can even test how the code you have written will work on an actual iPhone or iPad using the simulators Xcode provides.

Installation

Xcode is available on the Mac App Store. Search for Xcode on the App Store and download it. Again, I repeat that you need a Mac to develop for Apple devices.

Swift

The programming language we are going to use to make apps is called Swift. Swift is a programming language used to make iOS apps. The first part of this course will be focussed on teaching Swift concepts that are absolutely required to make apps. We will also be looking at concepts that are not used very often but come up once in a while. However, we will not be going into too much detail about them. Links will be provided to learn more about those concepts.

PART ONE : SWIFT

Variables

A variable is something that holds a value. Every variable has a name and type. The type of a variable is the type of value that will be stored in the variable. If the value that is going to be stored in a variable is 290, the type will be integer. This is because 290 is an integer.

Variables also have a name. This makes it easy to refer to the value they store and differentiate between multiple variables. It is also used as a label that tells us what the variable is storing the value of. In Swift, variables are defined like this:

   var numberOfWheelsInACar : Int = 90

Int is the type, numberOfWheelsInACar is the name and 4 is the value stored in the variable. Int is a keyword that denotes integer in Swift. var is also a keyword. It denotes that we are creating a variable. Int means that the variable we are creating is an integer. Other basic variable types given to us by Swift include String, Double, Float, Bool, etc.

Vocab Bar
String A type that can store a string of characters. This includes sentences and words.
Bool A type that has only two possible values:true and false.
Int A type that can hold integer values anywhere between -2,147,483,648 and 2,147,483,647.
Float A type that can store a decimal value upto a 32-bit accuracy.
Double A type that can store a decimal value upto a 64-bit accuracy.

The types of variables mentioned above are not the only ones! In fact there are hundreds of types that Swift provides us with for various reasons. As we learn more, you will learn to define your own type too.

Now, let’s switch over to something totally different from our current discussion.

Comments

When a large group of people work on the same code, it is very helpful if the code had annotations of what it does. That’s what comments are. Everything that is a comment will be ignored by the compiler(the part of Swift that interprets your code). There are two kinds of comments in Swift:Single line and Multi line

Single line comments let you comment only until the end of the line you start your comment on, while multi line comments let you extend your comments to any number of lines.

Single line comment syntax:

   // YOUR COMMENT

Everything after the // is a comment in this case.

Multi line comment syntax:

   /* YOUR COMMENT 
       GOES
       HERE*/

Everything between /* and */ is a comment in this case.

Written by Valliappan Valliappan

Notice any mistakes? Please email us at learn@teamscode.com so that we can fix any inaccuracies.