Skip to main content
Engineering LibreTexts

1.16: Swift Examples

  • Page ID
  • File:Swift logo with text.svgOverview

    Swift is a general-purpose, multi-paradigm, compiled programming language developed by Apple Inc. for iOS, macOS, watchOS, tvOS, and Linux. Apple intended Swift to support many core concepts associated with Objective-C, but in a “safer” way, making it easier to catch software bugs. Swift was introduced in 2014.[1]

    Swift is a popular programming language for the Apple platforms it supports, but it lacks support for Microsoft Windows environments.[2].


    Hello World

    // This program displays "Hello world!"
    // References:
    print("Hello world!")


    Hello world!


    Each code element represents:[3]

    • // begins a comment
    • print() calls the print function
    • "Hello world!" is the literal string to be displayed

    Swift IDEs

    There are several free cloud-based and local IDEs available to begin coding in Swift. Check with your instructor or do your own research for recommendations.

    Cloud-Based IDEs

    Local IDEs

    • AppCode
    • Atom
    • Xcode


    • Wikiversity: Computer Programming

    1. Swift (programming language)
    2. TIOBE: Index
    3. Wikibooks: Programming Fundamentals/Hello World
    • Was this article helpful?