Swift Tutorial · Swift Basics · Lesson 1 of 30

Swift Introduction

What Swift is, where it's used (iOS, macOS, servers, Linux), and what a Swift program looks like.

Create a free account to save this page, take notes and track your progress. Sign in

What is Swift?

Swift is a fast, safe, modern language created by Apple. It's the main language for apps on iPhone, iPad, Mac, Apple Watch, Apple TV and Vision Pro, and it's open source, so it also runs on Linux, Windows, Android and servers. Swift catches many mistakes at compile time: values can't be nil unless their type says so, and the Swift 6 language mode rejects data races.

Hello, World!

Hello, World!
print("Hello, World!")
let language = "Swift"
print("Welcome to \(language)")

Output

Hello, World!
Welcome to Swift

Run this on your computer — see “Get Started” for setup.

In a main.swift file (or a playground) code runs from top to bottom; there's no main function to write and no semicolons. The examples on this site show the program and its output; each was compiled with the Swift 6.4 compiler and run.

Test yourself

Which company created Swift?

  1. Google
  2. JetBrains
  3. Apple
  4. Microsoft
Show answer

Answer: Apple

Was this page helpful?