Our 1st program is : How to make your first “Hello World!” program in Swift.
Like any other language we are going to start our first program by printing or showing “Hello World!”
All you need to make iOS app is knowledge of Objective C or Swift and a Mac with Xcode installed. You can download Xcode from app store. And it will be found later in your application folder or you can search it in spotlight.
- Open Xcode it will look like this. Then select “Create new Xcode project”.
2. Then select “Single View Application”. We will use rest types later.
3. Give your project a name like “HelloWorld” and then save it in any folder you like.
4. Select “View Controller” from your left and then write some code. Here i wrote a code to display “Hello World” with a message using alert view. Write below code in viedDidLoad() method.
var alert = UIAlertView(title: "Hello World!", message: "My First iOS App", delegate: self, cancelButtonTitle: "Ok")
5. Now user Cmd+R or press the Play button on left top corner. A simulator of iPhone6 will pop up and display an alert view containing title and message written all by yourself.
6. Congrats on your first iOS App. Cheers.
Next Time we will see “How to Create simple tableView using UITableView in Swift“.