Sunday, December 25, 2016

iOS Development Tutorial - Hello World

Before getting started with iOS programming you've to install some softwares for creating iOS applications. I posted a tutorial for downloading and installing the Xcode. Kindly click this link if you don't have Xcode on your machine.

Okay guys now let's start to create our first Hello World program in iOS :)



Steps:


   1. Just open the Xcode from the launchpad.

   2. Then you'll get a Xcode's welcome screen.

   3. Click the Create a new Xcode project.

   4. Drag and drop the label from the Object library into Storyboard.

   5. Position the label into center and rename with any name.(in our case, it's hello world)

   6. Then run your app.


Below image is the startup or welcome screen of Xcode. Just click the 2nd option to create a new Xcode project.




After clicking the Create a new Xcode project. You'll see a window with a collections of templates to create iOS apps. Select the Single View application.






and click Next. Now you've to provide some project info such as product name, team, organisation name, organisation identifier, Bundle identifier etc.






Product Name: This is the name of your project(app name).

Team: Sign in with your apple id and assign your account as Team.

Organization Name: Enter your organization name here.

Organization Identifier: Enter you're website url in reverse order.

Bundle Identifier: It automatically entered and it's not clickable. Just leave it.

Language: Select the language to write iOS Apps. The languages are Swift and Objective-C.

Devices: Select any device between these Universal, iPhone, iPad to create your application. The app runs only in the selected device. Universal is common to both the iPhone and iPad. So it can run on both devices, iPhone is only specific to iPhone device, it'll run in iPhone and iPad is specific to iPad devices and it runs in the iPad.



Then after entering all the project details, click Next to enter into coding environment.






Now you'll see the nice Xcode interface. Xcode has three pane(left, center, right)


Left Pane - It shows the collections of project files.

Center Pane - It is the center pane of the Xcode, here you'll see the Storyboards, ViewController, Configuration settings and more.

Right Pane - It shows the inspectors such as File inspector, Quick help inspector, Identity inspector, Attribute inspectors, Size inspectors, Connections inspector and also a File Template library, Code snippet library, Object library, Media library.

In the center pane, you can see there's a lot of settings like app name, version, signing certificate, deployment target, app icons and more for the project. It can be changed at any time so we don't want to focus in this part. Let's move on to next step...



Now click the Main.storyboard file in the from the project navigator which is in the left pane of Xcode. See the below image





Now just drag and drop the label into View from the Object library which is in the right pane of Xcode and place it into center of the layout(when dragging inside the layout you can see the vertical and horizontal line to position accurately). Then click the label and change the text of the label. You can also change the properties of the label such as text, color, fonts, alignment, background color, line break, shadow etc. Just play around with all properties.



Now build the project and run it by clicking the run button. Then it automatically starts the simulator. You can change any simulator(In my case, it's iPhone SE)





Oooooo boom!!!! Finally we just created our first iOS Application. It's awesome right ?


Simulator allows you to test your app like in iPhone. It has many features and it act as real device. But for some cases, you want to use the original iPhone(not the simulator).

 It has some button functionality as well. For simulator buttons, click the Hardware menu in the menu bar of the simulator. Then you'll see a lot of options for using the simulator like iPhone.

I hope you enjoyed the tutorial and now you came to know how to create iOS Applications. See you in the next tutorial.

Happy Coding...!



Location:India, Tamil Nadu, Tuticorin Thoothukudi, Tamil Nadu, India