Installation
Swift is available on multiple platforms, with the best experience on Apple devices.
macOS (Recommended)
The standard way to develop Swift apps on a Mac is by using Xcode.
- Open the App Store on your Mac.
- Search for Xcode and click Install.
- Once installed, open Xcode and follow the prompts to install additional components.
Alternatively, you can install just the Swift command-line tools using Terminal:
xcode-select --install
iPad
For learning Swift on the go, Apple provides Swift Playgrounds.
- Open the App Store on your iPad.
- Search for Swift Playgrounds and download it.
- You can start with "Swift Explorations" or create a new "App" or "Playground" file.
Windows & Linux
Swift is also supported on Windows and various Linux distributions (Ubuntu, Amazon Linux, etc.).
- Visit the Swift.org Download Page.
- Follow the specific instructions for your operating system.
- For Windows, you'll typically need to install Visual Studio 2022 with the "Desktop development with C++" workload first.
VS Code Integration
If you are not using Xcode, Visual Studio Code is the recommended editor.
- Install the official Swift extension by the Swift team for syntax highlighting and build support.
Verifying Installation
Open your terminal (or Command Prompt) and type:
swift --version
If correctly installed, you should see the version information (e.g., swift-driver version: 1.x.x Apple Swift version 6.x).
Introduction
Swift is a powerful and intuitive programming language created by Apple for building apps for iOS, Mac, Apple TV and Apple Watch. It is designed to be fast, modern and safe by design.
Variables & Data Types
A variable is a named storage location that holds a value. In Swift, you must declare how a value is stored using either let or var.
