Monday, April 17, 2017

Hello World App Explanation (Xcode 8.2.1 Swift 3.1)




showMessage method

  @IBAction func showMessage() {
        let alertController = UIAlertController(title: "Welcome to My First App",
                                                message: "Hello World", preferredStyle: UIAlertControllerStyle.alert)
        alertController.addAction(UIAlertAction(title: "OK", style:
            UIAlertActionStyle.default, handler: nil))
        present(alertController, animated: true, completion: nil)
    }



1. Func – keyword to declare a method
2. showMessage() – method name and parameters
3. @IBAction – keyword to expose the method to interface builder
4. import – keyword to access external frameworks ( ex. UIkit)
5. let – to define a constant
6. alertController – constant name

7. UIAlertController(title: "Welcome to My First App", message: "Hello World", preferredStyle: UIAlertControllerStyle.alert) – an object in which we specify the title, message and the style of the alert

8. alertController.addAction – it is a method to add action to the alert so that is displays “OK” button


9. present – present alertController object with animation

Friday, April 14, 2017

How to Make Hello World App Xcode (8 Swift 3.0)



function for Hello World Button

@IBAction func showMessage() {
        let alertController = UIAlertController(title: "Welcome to My First App",
                                                message: "Hello World", preferredStyle: UIAlertControllerStyle.alert)
        alertController.addAction(UIAlertAction(title: "OK", style:
            UIAlertActionStyle.default, handler: nil))
        present(alertController, animated: true, completion: nil)
    }

Thursday, December 22, 2016

Swift Playgrounds

There is no better way to explore coding than actually writing code. Starting from Xcode 6, Apple introduced a new feature called Playgrounds. It's an interactive development environment for developers to experiment Swift programming and allows you to see the result of your code in real-time. Xcode 8 makes it even better for beginners to explore Swift. Surprisingly, you can now run Playgrounds on iPad too.

Lets launch Xcode














On the next page project name will be needed












When it is done the page looks like as below.












On the left pane of the screen, it is the editor area where you type your code. As you write your code, Playground immediately interprets your code and displays the result on the right pane. By default, Playground includes two lines of code. As you can see, the result of the str variable appears immediately on the right pane.

Wednesday, December 21, 2016

Getting Started with XCode 8

Getting Started with XCode 8
  1. Get a Mac
  2.  Create Apple ID to download Xcode
  3. You can download XCode from App Store or for older versions you have to visit download.apple.com -> Account -> Downloads  and scroll down See More Downloads (here you can find older versions of XCode)
  4. Or simply search Xcode and click the get button to download it
c