SyntaxStudy
Sign Up
Swift Beginner 1 min read

What Is Swift

Swift is a modern, compiled programming language created by Apple for iOS, macOS, watchOS, and tvOS development. Released in 2014, it combines the performance of C with a clean, expressive syntax inspired by Python and Ruby. Swift is type-safe and memory-safe by design. The compiler catches many classes of bugs at compile time, and the language eliminates entire categories of unsafe code common in C and Objective-C. Swift is open source and also runs on Linux, making it useful for server-side development. Packages are managed with the Swift Package Manager (SPM).
Example
// Hello, Swift
import Foundation

let name = "Swift"
print("Hello, \(name)!")

// Constants and variables
let pi = 3.14159       // constant - cannot change
var counter = 0        // variable - can change
counter += 1

// Type annotations
let greeting: String = "Hello"
var score: Int = 100
var temperature: Double = 98.6
var isActive: Bool = true

// String interpolation
let message = "Score: \(score), Active: \(isActive)"
print(message)

// Multi-line strings
let poem = """
    Roses are red,
    Violets are blue,
    Swift is great,
    And so are you.
    """
print(poem)