Skip to content
Learn Netverks

Lesson

Step 2/36 6% through track

what-is-swift

What is Swift?

Last reviewed May 28, 2026 Content v20260528
Track mode
server_compiled
Means
Compiled runner
Reading
~2 min
Level
beginner

This lesson

This lesson teaches What is Swift?: the syntax, patterns, and safety habits you need before advancing in Swift.

Teams still ship What is Swift? in Swift codebases—skipping it leaves gaps in debugging and code reviews.

You will apply What is Swift? in contexts like: iPhone/iPad/Mac apps, server-side Swift (niche), and Apple toolchain projects.

Write Swift in main.swift with print(), click Run on server—the dev runner swiftc compiles and runs the binary (requires Swift toolchain, typically macOS; LEARNING_RUNNER_ENABLED=true).

After JavaScript or Kotlin/Java OOP basics—Swift is approachable but optionals and value types need deliberate practice.

Swift is a general-purpose compiled language open-sourced by Apple in 2014. It targets Apple operating systems, Linux servers (niche), and cross-platform packages via Swift Package Manager.

Core characteristics

  • Static typing with inferencelet count = 10 infers Int; types checked at compile time
  • OptionalsString? models missing values explicitly instead of null pointer crashes
  • Value types — structs and enums are copied by default; classes use reference semantics with ARC
  • Protocol-oriented design — behavior shared via protocols and extensions, not deep inheritance

Typical build-run flow (local)

  1. Write main.swift with top-level code or @main
  2. swiftc main.swift -o app && ./app or open an Xcode project
  3. Ship via App Store, TestFlight, or CLI distribution on macOS

Important interview questions and answers

  1. Q: Is Swift garbage collected?
    A: No—Swift uses Automatic Reference Counting (ARC) for heap objects; value types live on the stack or inline without reference counting.
  2. Q: Who uses Swift in production?
    A: iOS/macOS app teams, Apple first-party software, and some server-side Swift on Linux.

Self-check

  1. What file extension do Swift sources use?
  2. Name one major platform where Swift is the default language.

Tip: Swift source uses .swift files compiled with swiftc—think iOS, macOS, and SPM packages.

Interview prep

Is Swift garbage collected?

No—Swift uses ARC for class instances; structs and enums are value types without reference counting.

Who uses Swift?

iOS/macOS app teams, Apple first-party software, and niche server-side Swift on Linux.

Interview tip Lesson completion confidence

Can you explain this lesson in 30 seconds without reading notes?

Not saved yet.

Playground

Runs on the configured server runner (dev: npm run runner with LEARNING_RUNNER_ENABLED=true). Output appears below the editor.

Check yourself

Multiple choice — immediate feedback.

Discussion

Past discussion is visible to everyone. Only logged-in users can post comments and replies.

Starter discussion topics

  • Open source Swift?
  • vs Objective-C?

Sign up or log in to post comments and sync lesson progress across devices.

No discussion yet. Be the first to ask a question.

Jump