Tools needed :
XCode (I am going to use Version 10.1 to build the following
app)
Please click on the images to see an enlarged version.
Steps:
Launch XCode.
Before creating our application, we should make sure to add
a personal team with our apple account in XCode. If we skip this, we will get
error while running our app in a simulated device.
To add our account, follow the below steps.
Click XCode from the menu bar and select Preferences
In the Preferences window, click on Accounts tab.
Click the + icon on the bottom left corner to add your apple
ID by selecting "Apple ID" and clicking Continue.
Enter your Apple ID, password and click Next. Apple Account
will be added to XCode as your personal team.
Select Create a new XCode project
Select Single View app, this is where we select project type
based on which a project skeleton will be created by XCode. Our HelloWorld app
just has a single screen, so we are selecting Single View App
Enter the Product Name, select Team as your personal team
which we created in the previous steps.
Fill in other details and select language as “Swift”. We use
swift to develop our app. We can also use objective C, but I prefer using Swift
as it is easy to learn and requires less code.
Select a folder to save your project and click Create. I
have created a folder named “Apps” in my desktop and selected it to save
HelloWorld app.
Drag the label (see highlighted component in the below
snapshot) and drop it in the View. Once the label appears, click on the object
attributes icon, this will show all the attributes associated with a label.
Now we must add constraints to make sure the label is always
visible in the View. To do this, Click the constraints icon(highlighted in red, see
below image), click all four sides and once you have selected all four, it will
look like the below image with all four side lines changed to Redline. Click “Add
4 Constraints” button to add them to the view.
Now we are done with our UI development, let us go ahead and
run our first IOS App.
Click on the Run icon (see the top left corner for the play icon). This
will build our project and run it on a simulator. I am using iPhone 7 to run my
application.
Congratulations, you have successfully created your first Hello World IOS application.
Any doubts or challenges please feel free to comment.
Comments
Post a Comment