Every day the number of people dreaming of learning how to create programs is increasing. After collecting information on the network, they come up with the idea that the most promising is the development of applications for iOS - Apple's operating system. In fact, dreaming is one thing, and programming is another. Creating your own application is not easy. But it is not sky-high difficult. What is needed for this?
Programming language
To write programs for a specific platform, you need to use a specific programming language. Application development for iOS and Android is different. If the platform from Google needs to choose the Java language, then for iOS the choice is between Objective-C and Swift. For a long time, development for the iOS platform was conducted only using the Objective-C programming language. Despite the fact that he is many years old, he is still developing and used by a large number of developers. But its minus is a high entry threshold.
Since Apple’s most important source of revenue is its app store, employees are interested in more useful and interesting utilities. For this reason, a conference for developers is regularly held where they talk about changes in operating systems. In 2014, developers were shown the latest Swift programming language, which is developing applications for iOS. Swift is easy to learn, as it has a very simple syntax and is strongly typed. For those who want to learn how to create applications for iOS on their own, this language fits very well.
What you need to get started
In addition to basic programming knowledge, you need to have the following:
- a computer or laptop with OSX on board;
- Xcode development environment, which is free.
This kit makes it possible to run applications in a special simulator directly on the computer. But you need to keep in mind that in the future, you may need to pay $ 99 to get an annual subscription to the developer program. After payment you will be able to:
- run developed programs not in the simulator, but on real devices;
- Host applications on the App Store
- Download new versions of the development environment and iOS.
Newer versions of Xcode include an element such as a sandbox called Playground. Here, the developer can experiment with a new programming language.
Many people want to start writing programs, but they think it is extremely difficult. Of course, in order to become a professional, you need to have a lot of knowledge and vast experience. But in order to create a small application, there is no need to be a professional.
Where does the development of applications for iOS and Android begin? Training takes place in practice. Therefore, you need to start with it. A lot of theory is not always good. Indeed, if a person reads ten textbooks on programming from cover to cover , he will not become a programmer . Need to act.
Playground
This "sandbox" is a wonderful environment for learning a programming language. How does she look? The user enters a line of program code and immediately sees the result of execution. After it becomes clear that the written fragment works as it should, it can simply be transferred to the project. Using the "sandbox" you can solve problems such as:
- mastering the syntax of a programming language;
- Improving programming skills by experimenting with new APIs
- simple arithmetic calculations;
- development of a new algorithm and monitoring of its every step.
IOS Application Development: Getting Started
Theory is, of course, good, but, as mentioned earlier, practice is needed. In order to get acquainted with the “sandbox”, you need to run the Xcode development environment. After starting, the user can see a window in which it is proposed to create a new project or launch Playground. Need a second point. Now you need to come up with a name and save the "sandbox" to any convenient place on the computer. By the way, developing applications for iOS on Windows is also possible, but then you will need to solve a large number of problems. This installation of a pirated operating system, and editing important files, and many errors and crashes.
After saving, the very Playground that is needed will be launched.
At first glance, there is nothing interesting. But it’s worth entering your code there, as the appearance will immediately change.
To get started, you can try to write the following:
var z = 3
for var y = 0; y <10; ++ y {
z + = z * y
}
z
println (“result: (z)”)
After that, the sandbox will change its appearance. The column on the right (the results pane) shows the values for each row that are obtained after execution. Also in the right column, you can enable the display of the time panel, which makes it possible to track changes in time of the selected expression. It also displays console output with text that the program would output.
Code Commenting
Application development for iOS, as well as for other platforms, does not go without the comments that are needed to make it easier for the developer to navigate the code. Comments are lines that are ignored during program execution. They can be either single-line or multi-line.
Variables
So, applications are written in a programming language. The basis of any language is made up of variables. Application development for iOS and Android without using variables is not possible. As the name implies, this is a container that contains a mutable value. Each variable must have a unique name and can contain both numerical and text values. In the Swift programming language, variables are defined using the words var and let. In the second case, the variable cannot change and must be initialized when declared. In the first case, the variable is initialized immediately before use.
Each variable has some type. It can be strings, floating-point numbers (fractional), Boolean values (true and false).
Output Results
The result of the program is displayed in the console. What it is? This is what provides user interaction with the computer. So, before the output console was called the monitor, and the input console - the keyboard. Now the meaning of the terms has changed a bit. This is the name of the program window for input and output commands. Developing applications for iOS often requires the output of some data. To do this, the Swift language provides the print and println commands. The first differs from the second in that it automatically starts from a new line.
Functions
The next basic concept in programming is functions. This is a certain sequence of actions that perform a specific task. Each function is able to take some kind of value, as well as return a result. To use this construct, it must first be declared using the func keyword. After it is indicated the name, as well as parentheses. If any value should be returned, then its type is indicated after the brackets. If there is no return value, then the type can be omitted or the "empty" type can be specified - void. In parentheses are the values that the function takes. To call a function, its name and values for the arguments are indicated.
You can make sure that the name of the parameter when calling the function is required. To do this, it is framed by the symbol "lattice".
So you can write any useful functions that can, for example, calculate the exchange rate, convert one unit of measure to another. Each time you need to use them, you just need to call these functions, and not write the code again.
Now what?
So, as can be seen from the above, the development of applications for iOS with their own hands may well be affordable for everyone. The main thing is to learn the basics of a programming language, get acquainted with the development environment and practice a lot and often. It is practice that helps to make significant progress. But what is described here is only the beginning. Further in the programming world there will be many interesting, complex, fascinating. This will help to always keep the brain in good shape, create something new and make good money. After all, Apple's technology is used all over the world. Therefore, your application will be able to appreciate millions of people.