Online visitors

People learning around the world

Online

—

Visitors exploring W3Schools

Online visitors by country Circles show approximate country locations. The country list provides the visitor counts.

Circles represent countries, not exact visitor locations.

Country

Online

Loading country activity…

    Swift Environment Setup

    Swift Tutorials


    It is essential for programmers to know the basics of Swift programming along with its environment setup and the procedure to install and way of writing codes. Swift provides a suitable platform for putting the Swift code and executes it. Now you will set up the same for learning purpose. In his chapter, you will learn about how to set up your programming environment as well as the basics of Swift language.

    Setup the Local Environment

    You need Xcode software to start your Swift coding. As you will get familiar with the swift coding concept of Swift, you can use the IDE (Xcode) for IOS and OS x application development. To start with this, you already need to have an account at Apple developer Website. The next steps are:

    1. Log in to Apple's Developer's Website.
    2. Once you are logged in, visit the link: https://developer.apple.com/download/
    3. It will show you a list of software available.
    4. Now, programmers need to install Xcode on their machine. After accepting the terms and conditions, open Xcode from the application folder.
    5. Now, you will get the get started with playground option.
    6. Enter the playground name along with the platform name (select IOS).
    7. Finally, you will get the Playground window.

    Online Option for Programming

    Programmers can also use the online facilities for online compilers to write, compile, and execute code for Swift. It will give confidence along with the flexibility to write code without installing compilers in the local computers. Some of them are:

    • Swiftstub.com
    • Runswiftlang.com
    • iswift.org

    Some other websites also offer the facility of online swift compilation and execution.

    First Swift Program

    Example:

    import Cocoa
    
    var str = "Hello World!"
    
    println(str)

    Output:

    Hello  World!

    In the above code, import Cocoa statement makes all Cocoa libraries and APIs along with runtimes that outline the development layer for all of OS x, available in Swift. The above library is implemented in Objective-C (superset for C language).



    Found This Page Useful? Share It!
    Get the Latest Tutorials and Updates
    Join us on Telegram

    Notifications

    Updates are enabled for this browser.

    Receive new tutorials, articles and learning resources. You can turn updates off anytime.