In this post, we are going to take a look at Xcode User-Interface and we will also create our first application. Of-course a blank application. We will also take a look at simulator which allows us to run applications on virtual test devices. I hope, you guys have checked the first post. If not, then just click here to check it out.
What is a Simulator?
The simulator allows you to rapidly prototype and test applications during the development process. Installed as part of the Xcode tools, Simulator runs on your Mac and behaves like a standard Mac app while simulating an iPhone, iPad, Apple watch, or Apple TV environment.
You can learn more about simulator by clicking here – https://goo.gl/p5hp2q
Running XCode for the first time :
Step 1: Search for Xcode in the spotlight and open the application.
Step 2: Agree Terms and condition: Now Xcode will ask you to agree on Xcode and iOS SDK License Agreement which you have to accept by pressing the Agree button. You might also be asked for system’s username and password.
XCode User Interface :
So now let’s start learning about the new Xcode 9 User-Interface. Not new actually, its same as the old version but there are some new features that are added.
This is the first screen that you will notice once you open up Xcode.
And on the right-hand side, you will see and edit all your recent projects that you have created/worked on. So, first of all, we must start a new project.
How to create a New Project in Xcode :
Now let’s create a new project in Xcode 9. We can do so, by clicking on File – > New -> Project as shown in the image below.
Template’s For Your Project
Now its time to select/choose a template for your new project. We can do so by choosing the platform for your application i.e. iOS / watch OS / etc and then selecting from a wide range of templates provided there. In our case , we will be going for the Single View App template for iOS projects.
Single View Application: Single View Application comes with three new files in MainStoryboard.storyboard and a header and implementation file for the view controller class, inheriting from UIViewController. Let’s keep everything aside and just select Single View App for now and click on next.
Choosing Options For Project
Now its time to choose options for the project as shown below.
Product Name: Is the name of the project or the application which is Hello World in our case.
Team: Team is used to create team’s and add developers. We will do so later on!
Organization Name: As the name suggests, this is the name of the organization.
Organization Identifier: This is the reverse domain name for eg. priyankgada.com turns into com.priyankgada
Bundle Identifier: This should be unique if you want to upload the application to Appstore. This is like the package name or android package name in android.
Langauge: You can work between Swit and Objective C. But in our case, we will be working with Swift. Swift 4 in particular.
Now let’s take a look at the simulator.
Selecting Devices for Simulator
You can switch between devices and create virtual devices using the button on the left-hand side as shown in the image below.
To test the application, you can simply press the play button. In this series, we are going to use iPhone X which is the latest variant of iPhone running on latest version of iOS firmware i.e. iOS 11.
Hardware Buttons on Simulator
Developers may have to test certain feature which requires them to use the touch ID or other hardware on their iPhone, etc. In case of the simulator, it provides a different section for hardware impressions.
You can go into Hardware option and select the required button. Just make sure, simulator is selected.