iOS App Development Tutorial for Beginners from Start to Finish

iOS Development for Beginners: learn to create iOS applications from scratch
Profession programming is one of the most prestigious and sought after in the software development industry as a niche. Of these, however, the most rapidly growing and highest paid is the development of software for mobile devices.

As you know, In the segment of mobile technologies, without a doubt, Apple with its iPhone smartphone in past presentation in September demonstrated the Cupertino-based company is already 7-th version of the mobile device. Together with her
Apple, introduced a new version of iOS 10.

Now, this is the most significant OSes in the world, as well as its predecessor. It follows from this that the study design for iOS is the most profitable investment of time and money.

«Apple» Ecosystem
Today we will develop a simple mobile app for iOS. Of course, the best suitable native Mac. But if you’re a supporter of Windows or if you simply have no poppies, you can install an operating system macOS under virtual machine in Windows.

In the vastness of the network you will not be too difficult to find some features under the PC version of macOS, popularly known as a Hackintosh. Boldly put it on VMware, VirtualBox virtualku-on your choice.

On a PC keyboard, they are not part of the keys on the Mac-Claves and many combinations of push in Hakintoshe is impossible. It pretty spoils the mood. Otherwise, all operations described below can be successfully performed at Hakintoshe.

The Necessary Knowledge
To program in General and for the iOS in particular, we have to understand Mathematics pretty much and logic may not needed at first, but then will be in demand later.

Modern technologies have freed the programmer from having to have a thorough knowledge of computer architecture, but to understand the basic mechanisms, such as number systems, conversion, speed of work routines or the efficiency of algorithms (the big O), you should.

At a higher level, developer needs iOS deeply, understanding the operating system macOS and the iOS itself. Also, you need to master the “Apple” programming language, Knowledge of Delphi, C++, c # or VB.NET is not of much help. Apple has its own ecosystem, with their own languages: Objective-C and Swift.

Of course, C++ programs are found everywhere, even from Apple. But the used Objective-C by definition, simply because it appeared much earlier (in the mid-eighties of the last century), while Swift is only three years ago (in 2014). Apple has high hopes for a new language and a lot of investing in it.

To support the old software, Objective-C, and a new spell at Swift. To avoid wasting time in vain, all these programming languages can be studied under the strict supervision of programmer teachers.

Tools for Development
As you know, the main developer tool under macOS and iOS
programming Xcode includes tools for creating applications for Mac, iPhone, iPad, Apple TV, Apple Watch. All Apple platforms Xcode contains a build tool interface (Interface Builder), code editor, supports all modern means of working with code.

In addition, without leaving the Xcode, you can test the application; If it is developed for external device, then you can run it in the emulator. The system includes all device emulators, updates which you can resume. In addition, Xcode includes graphical tools for analyzing application performance, including CPU utilization, Diagnostics drive (HDD, SDD and others), the load on the graphics card (OpenGL).

Hotly anticipated version 5.0 development has a stable version available for free download in the App Store. Alpha and beta are distributed by subscription of the developer. Eighth version has incorporated a new language version of Swift, Swift learning tool 3 Playground for the iPad, a new version of Interface Builder, which became faster and allows you to view the layout of your applications on different platforms without the need to deploy the application on the Simulator.

If you have an old version of Xcode, we recommend you Refresh, because we will use the latest version. You can download it from the App Store: with the Xcode 8, you can develop applications for macOS Sierra, iOS, 10 3 watchOS and tvOS 10. There are all of the SDK.

New versions of operacionok have become consistently appear just after Apple’s presentation, held two years ago.

Objective-C Language
You Briefly recall the basics of the language. Objective-C is a compiled object-oriented programming language used for writing applications under the “Apple” of the system. Is a superset of, or, in other words, add-in, over C, deriving from the latter syntax, data types, methods of monitoring the implementation of the programme and adding to it an object-based programming model is a description of the classes and methods.

As in C++, Objective-C objects play a central role, with associated four paradigms: abstraction, encapsulation, inheritance, polymorphism. The C++ language is strongly typed, whereas Objective-C is a loosely typed or has dynamic data type system. Like Smalltalk, Objective-C objects sent messages.

This is an exceptional opportunity to dynamic languages because the object type is checked at runtime instead of compile time. Objective-C language description is not one lengthy Tomic. Therefore, to obtain objective knowledge, it is convenient to undergo “Mobile Developer. An entire section is dedicated to the language course.

Development of applications for iOS
As a sample, we will develop a very simple application. We will not retreat from the Holy tradition, we will greet the world. However, given that we have a graphical application, we have a little variety: Add button clicking which will show or hide the text “Hello, World”.

Run the Xcode in the window that appears, select Create new project or in the main menu File-New-> > Project. In the next window, you will be prompted to select a target platform and application type.

In this case, we are interested in iOS. The selection presented seven types of applications. Six of them — components of typical iOS applications, by default, contain a different set of components. Seventh-type, game.

Types of Applications
Billet Single View Application is designed for a simple application with a single screen. Workpiece includes a View Controller that allows you to customize the appearance of an application using Interface Builder form designer.

Master Detail Application creates an application where tabular view displays a collection of objects. After selecting, one of them shows the detailed information about this object. The first type is the master, the second detailing.

Using Page-Based Application creates an application with a few screens, like pages in a book. Therefore, from this, billet is created, for example, reader. Tabbed application allows you to create applications where on every screen you can switch at any time, i.e. each screen has a button to activate it, which displays the title. Examples are iTunes.

The game is used to create the workpiece games. Choose from four of the framework for the creation of games: SpriteKit, SceneKit, OpenGL ES, Metal. Briefly consider them.

SpriteKit is a system for two-dimensional visualization and animation of textured rectangles-sprites. When displaying the frames used, standard cycle frame displays after processing will be held in the entire contents of the scene.

SceneKit — a high-level framework for rendering 3D graphics without the help of OpenGL. It supports loading, manipulating 3D objects. It includes: physics engine, generator and an easy way to scripting.

OpenGL ES is a standard in the field of computer graphics. It Allows visualization of 2D and 3D scenes. Allows to describe the pipeline for video cards: tops pass transformation to congregate in entities that are in two-dimensional image and displayed on the screen. In the pipeline, you can enable programmable shaders.

Metal is a low-level API that will allow you to squeeze all the power of your video card. Debugged API together with precompiled shaders and multi-threading allows your game to climb to a new level of performance and quality.

Sticker Pack Application is a new kind of applications, introduced in iOS Xcode 8 and 10. It represents a set of simple or animated images used in the new iMessage. For its creation requires no coding.

Application-the new IMessage applications introduced in iOS Xcode 8 and 10. Allows you to create add-ons for iMessage, for example to purchase and download your package of stickers. You can also use the iMessage API, create your analogue of this application, including the playback of audio, video, using stickers and more.

Creating your first project
As billets for our application, we will choose a Single View Application. Because we will not develop a great program, we have enough of this harvesting tools. Click Next. On the next page of the wizard, type the project name, for example Chaktty.

In the Language drop-down list, leave the default language as Objective-c. Next, from the drop-down list Devices, leave Universal choice. Here you can define, for any device (iPhone or iPad) application is created. Click Universal means for both.

Deactivate the check box Include Unit Tests and UI Tests. Next, Choose a folder to save the project. Now click the Create button. This will open a window with a list of all settings that you applied to the project. In this window, you can change the settings in the wizard that have been previously installed: orientation, target device, etc.

First we need to create the application interface. To do this, click Choose file main.c storyboard in the list on the left (if the file is not visible, open the contents of the folder ShowLab). To the right of the list box will take Interface Builder. In the center of the layout appears on the device. In the lower right corner, there is a panel components.

Drag a Label and Button components layout. Above is a list of component properties. If you have not, click the Show the Attributes Inspector under the title bar on the right side of the interface. Select the component in the layout of the Label and the mood of its Text property: leave in the drop-down listselection of Plain, in the box below enter the desired.

Inscription, in this case “Hello, World”. If your text won’t fit within the boundaries of the caption, change them by dragging the markers on the edges of the component. To centralize it horizontally, go to the page Size Inspector by clicking the Show the Room Inspector (right from the Show Attributes Inspector).

On this page, from the drop-down list, select the Arrange Center Horizontally option in the Container. Now choose a Button, change its Text property to the desired label — Switch. You can center the same way as described above.

Create a link between the graphic elements and code In Visual Studio (or Delphi),  object in your code is automatically created at the moment when you put visual component to the form. In Xcode, it doesn’t, but it does not create problems.

Discover the contents of the header file to the ViewController in a separate window by double-clicking on it. This file is a class extension declaration UIViewController, marks the key word @interface. This capability was added in the second version of Objective-c.

Now do this trick: move the mouse cursor over the component — the text label, press Ctrl and left mouse button. Move the cursor to the window with the code (file ViewController. h) the cursor reaches the blue line. Let go of the mouse and press inside the ViewController interface description. Outlet’a window appears.

This is a property of an object that references another object (in this case, the Visual component). You have to enter the name of the object, the Outlet you will be treated to a visual component, let it be lab. Next, select the type of the object, it is correct: UILabel.

Even lower in the list, select the type of Storage object references: weak or strong. If you select strong, the object referenced by the property will exist until property specifies, in this case, it would not automatically off when no longer used. On the other hand, when the weak reference is valid (weak), the object may self-destruct. So, choose the type of weak links and click the Connect button.

As a result, this line is added to your code: @property (weak, nonatomic) IBOutlet UILabel * lab; but. Make sure that the Outlet is a property. Now, let’s create an Outlet for the button. The algorithm remains the same. Only the Name property, type a different name, for example.

The code will be added: @property (weak, nonatomic) IBOutlet UIButton * but;
As a result, we have two pointers to Visual components: lab and but-respectively, the label and the button. Now, using pointers, we can manipulate components in code,  Then create a handler for its Click event.

To do this in a separate window, open the ViewController implementation file. In exactly the same way as you put line in the header file to create an outlet from the button, drag the line to the implementation file and release before the closing bracket shell @end.

A window will pop up to create events, like window creation outlet. See the difference: in the header file, you create a reference to an object in the implementation file, Fill in the Name field, its value is the name of the property- method.

Let it be onClick. The field value Type as default is ID. In the Objective-C language, this type is an ancestor of everyone else. In the drop-down list, Event is the default event Touch Up Inside, which occurs when you release the pointer (mouse finger …) over the button and it’s the final stage of a button. This is what we need.

In the Arguments list, leave the default value, Sender is the object that sent the signal in our case, it will always be a button. Click the Connect button. As a result, the following code is added: -(IBAction) onClick:(id) sender {} Negative at the beginning means a private method (private).

Keyword IBAction marked events (methods) Visual components of Interface Builder.
Between team brackets will write the code to run when the button is clicked: _lab. hidden =! _lab. hidden; In this line of code we invert the hidden property. It is of type BOOL, which has two values: YES — truth and NO-lie (several unusual Windows-programmer, where true and false).

The underscore that precedes the name of an object is not the inscription (_lab). Without it, the compilation will fail. The underscore is automatically added for the objects that are contained in other objects; that is, in this case, the object is contained in the lab, the ViewController.

Before, it was a conditional rule that is used to distinguish objects declared as class members and local objects. And now, it’s a strict rule, implemented in the language compiler. Now you can compile your application and run it on the Simulator. We chose the iPhone Simulator included in Xcode, 7 8. Compile and run button is a black rectangle and is located on the top of the interface.

After you compile the application, run the Simulator and download our application Simulator, interface inscription appears as: “Hello, World” and the Switch button. If you click it, the inscription will disappear, when you press, it reappears. We’ve made a very simple application for understanding the development of iOS.

For more information about creating applications for iOS on the Objective-C language, you can learn from the course online from the mobile developer (for example, GeekBrains).In the course of two months given to the study of that language. During the first month — introductory theme, and the second is the actual coding professional applications.

Swift Language
In the year 2014, Apple introduced Swift as a new programming language. It quickly became the most talked-about and most dynamically developing spoken language in the world. It is robust, secure, intuitive language for developing applications under macOS operating system, iOS, tvOS and watchOS for the entire fleet of devices from Apple.

Swift — efficient programming language. It’s easier to learn than his predecessor, Objective-C. At the same time, Swift borrows the best ideas from it. However, the developers have done languages compatible, i.e. in one program, it can be code for Swift and Objective-c.

In the world, there are billions of lines of code and hundreds of thousands of legacy programs written in Objective-C. So definitely, if it’s not supporting it, it will be abandoned. When designing a Swift goal to create the most convenient language for system programming, ensure, you make fast, secure and expressive.

Swift language algorithm works in 2.6 times faster than the same algorithm in Objective-C, and 8.4 times faster than Python. Using Swift makes programming more flexible and convenient. Due to its exponential development, In December 2015, Swift language was transferred to the open source community.

While Apple strictly monitors its development, organizing Committee for its development. Now Swift is available not only in Apple systems but also in Linux. All additional tools to work with the language, including the standard library, debugger, Package Manager too, free and open.

This language of the future. More details can be learned from the course from GeekBrains mobile developer; it’s a whole month devoted to the study of the programming language.

The App Store
Simply put, the App Store is a store of content for a whole range of Apple devices. Here you can buy games and applications from both large companies and independent developers. Every developer, no matter what country he lived, can sell or distribute their programs for free on this site of digital distribution.

To start doing it, you have to register as a developer and buy a license to sell their applications. This fee is for service and development of the App Store. We have developed a simple app for iOS mobile operating system by using the system programming language together with Xcode, Objective-C, Tested on iPhone Simulator
application ready 7.

We learned how to build user interface using Interface Builder, how to associate graphical elements with application code, how to create event handlers. It’s similar to the basics of Objective-C. In addition, we focus on the promising Swift language used to develop powerful and secure applications for “Apple” ecosystem.

However, the studied material is only the beginning. To get acquainted in the direction of the coding and design and selling applications, we recommend that you take a course “Mobile Developer” on GeekBrains website or any other you desire.

It’s a decent course: passing it, you just do not waste time in vain. It begins with two detailed courses on Java, then you should study the Basic programming, Android mobile operating system. Next course in general databases and the SQL language in particular.

Then advanced to develop professional applications for Android. After this vector study
moves in the direction of Apple systems: two detailed course on Objective-C language and useful course on Swift.

The Program of the Course
You have professional teachers with extensive experience in software development and If something is not clear to you, you should ask a question. Generally, GeekBrains is a living process, you can chat, ask questions, help with answers. To test acquired knowledge, teachers give out homework which is then checked.

After training you’ll get guaranteed internship in IT companies and then everything depends on you if you show yourself as a qualified specialist, you will be invited to work.