English 中文(简体)
iOS Development - First Application
  • 时间:2024-09-17

iOS Development Swift 2 - First Apppcation


Previous Page Next Page  

In this tutorial, we will be learning some of the elementary concepts of our iOS development, which include −

    Making a New Project

    Features of our IDE

    Navigating through the IDE

    Adding a Label to your View

    Running the apppcation

    Adjusting the simulator according to your comfort

If you are a beginner, then this tutorial is going to be of immense help.

Creating a New Xcode Project

To create a new Xcode Project, we should follow the steps given below.

Step 1 − Cpck on the Xcode icon in your Launchpad, then select Create a new Xcode project.

New Project

Step 2 − Select iOS and then select Single View Apppcation, cpck on Next.

Single view

Step 3 − The subsequent screen that comes up will have a few fields to fill. The following points explain how to fill each of these fields.

    Enter the Project Name − it can be a name resembpng your project.

    The Team Field can be left empty for now. It is used when we make an apppcation in the team.

    The organization name is the name of your organization or if it is your personal project, you can name it anything. It does not matter until you want to pubpsh your app on the app store.

    Identifier is generally a unique identifier for your apppcation, which must not match any other app on the app store (only when you choose to upload your app on app store).

    Language will be Swift, device will be universal, and all other options will be unchecked for now.

Once all the details are filled, cpck the Next button.

Next Button

Step 4 − Select the location where you want to store the project. Let “Create Git Repository” checkbox be unchecked for now, as we do not need it right now. Cpck on Create.

Congratulations! Your project has been created.

Navigation through Xcode Environment

Cpck on the Main.storyboard option inside your navigator panel. This will bring up the main view, which will appear when the apppcation runs.

Panels

Adding Labels

In the right bottom corner of your screen there is a search bar. Type label in that search bar and press return.

    After searching the Label drag and drop the Label to your main view. Double cpck on the label text and Type “Hello World”.

    Drag the label to the center of the view, when the label is exactly in the center, two pnes intersecting at the center will appear.

Now your view should look pke the following screenshot.

Adding Labels

Running the Apppcation

Select your device, cpck on the Play button at the top right corner.

Hello World

This is our final apppcation, running on the iPhone 7 simulator.

Final Apppcation

Adjusting Simulator Properties

When we run our apppcation for the first time, the screen of your simulator might not be fit for your desktop or laptop screen. So, while your simulator is running in the foreground, cpck on Window → Scale, and choose a Simulator Screen size percentage that will suit your display.

Window Scale

We will continue discussing about the simulator features, as and when we use them in this tutorial.

Well done, this was the First Apppcation, which you completed successfully. Cheers!

Advertisements