How this Swift track works
- swiftc in the playground — write a single
main.swiftwith top-levelprint()or an@mainentry; the dev runner compiles withswiftcon macOS and runs the binary. - Language-first, Apple platforms as context — lessons teach Swift syntax, value types, optionals, and protocols. SwiftUI and UIKit appear as teasers—full iOS/macOS apps run locally in Xcode with the Apple SDK.
- Prerequisites — finish general programming basics (variables, functions, types). Compare with Kotlin, JavaScript, Java, and C# when choosing stacks.
Swift powers iOS, iPadOS, macOS, watchOS, and tvOS apps. Xcode projects, Swift Package Manager, and SwiftUI run locally on Apple toolchains—sandbox lessons keep one file without UIKit/SwiftUI imports.
Install on your device (macOS, Linux, Windows)
Swift toolchain is native on macOS; Linux/Windows use swift.org builds for CLI practice (no iOS Simulator in this track).
macOS
- Install Xcode from the App Store (includes swiftc).
- CLI only:
xcode-select --installthenswift --version.
Linux
- Install per swift.org/install/linux (Ubuntu 22.04+ packages).
Windows
- Swift for Windows is experimental—see swift.org/install/windows. For iOS development use a Mac.
Verify: swift --version on macOS or Linux.
Run code on this site (Backend & language playgrounds)
- Clone or open this project locally; copy
.env.exampleto.env. - Ensure
LEARNING_RUNNER_ENABLED=trueandLEARNING_RUNNER_URL=http://127.0.0.1:9999/v1/execute. - Terminal 1:
php artisan serve(orcomposer run devfor Laravel + Vite + runner together). - Terminal 2:
npm run runner— keep it running while you click Run on server.
Note: iOS/SwiftUI apps require Xcode on macOS; playground lessons use command-line Swift only.
Swift is Apple’s modern, statically typed language for iOS, macOS, watchOS, and tvOS—and increasingly for server-side and cross-platform tooling. It combines value-type ergonomics, protocol-oriented design, and optional safety with a readable syntax that feels familiar if you know Kotlin, Java, or C#.
How this track differs from JavaScript and Kotlin
Unlike browser-first JavaScript, Swift targets compiled Apple platforms and CLI tools with swiftc in the playground. Compared to Kotlin on the JVM, Swift emphasizes structs, ARC memory management, and Apple SDK integration rather than JVM bytecode and coroutines on Android.
This track teaches Swift language fundamentals first—UIKit and SwiftUI appear as context; full app UI runs locally in Xcode with the Apple SDK.
What you will learn
- Syntax: variables, types, strings, control flow, functions, and optionals
- Collections: arrays, dictionaries, sets, tuples, enums, and pattern matching
- OOP: structs, classes, properties, protocols, extensions, and generics
- Modern Swift: errors, closures, property wrappers, concurrency, and ARC
- Tooling: modules, SPM, file I/O, testing, Codable/JSON
- Interview essentials, production habits, and SwiftUI context
Playground setup
This topic uses server_compiled: your code compiles with swiftc as a single main.swift file. Use top-level print() for output—avoid UIKit/SwiftUI imports in runnable snippets. Foundation is fine when needed.
Important interview questions and answers
- Q: What is Swift best known for?
A: Safe optionals, value types (structs), protocol-oriented APIs, ARC memory management, and first-class Apple platform development. - Q: Does Swift replace Objective-C?
A: Swift is the preferred language for new Apple code; Objective-C remains for legacy frameworks and mixed codebases.
Self-check
- In one sentence, why do iOS teams prefer Swift?
- What filename does the playground expect?
Tip: Compare with Kotlin and JavaScript—Swift targets Apple platforms with value types and ARC.
Interview prep
- What is Swift in one sentence?
A modern statically typed Apple language with optionals, value types, protocols, and ARC—default for iOS and macOS apps.
- Why compare with Kotlin and JavaScript?
Kotlin targets Android/JVM; JavaScript targets browsers; Swift targets native Apple platforms with compiled performance.