Pebellslearn by building
0%
RoadmapsMatrixCoursesSandboxSign in
Choosing a Language  ›  Lesson

History and Why Swift?

History and Why Swift? 12 minSwift was introduced in 2014 to keep Apple's existing frameworks while replacing Objective-C's silent failures with compile-time safety.

History and Why Swift?

TrailLog's team is starting fresh in 2026. Nobody debates the language for long: new iOS code is written in Swift. Knowing why helps you understand the design choices you will bump into every day, like optionals and value types.

The rule

Swift keeps Apple's frameworks but makes mistakes fail early and loudly.

A short history:

  • 1980s–2000s: Objective-C powers NeXTSTEP, then Mac OS X, then the first iPhone SDK in 2008. The NS prefix on types is a leftover from NeXTSTEP.
  • 2010: work on a new language starts inside Apple.
  • 2014: Swift is announced at Apple's developer conference (WWDC).
  • 2015: Swift becomes open source, and later runs on Linux and Windows too.
  • 2019: Swift 5 brings ABI stability, so the Swift runtime ships inside iOS and apps no longer bundle their own copy.

Swift was not a new platform. It talks to the same frameworks — Foundation, UIKit, Core Data — that Objective-C used. What changed is the language's attitude to errors. Compare storing a hike's name:

let name: String = "Ridge Loop"   // can never be nil
var note: String? = nil           // might be missing, and says so

The benefits over Objective-C follow from that attitude:

  • Safety. Missing values are marked with optionals and checked by the compiler, instead of silently messaging nil.
  • Strong types with inference. let km = 8.5 is known to be a Double without you writing it.
  • Value types. Structs and enums are copied, not shared, which removes a whole class of "who changed my data?" bugs.
  • Less ceremony. One .swift file per type, no header, no pointer stars, no square brackets.
  • Modern features. Closures, generics, enums with associated values, and built-in async/await.

The shortcut

When you meet a Swift rule that feels strict, ask: "Which Objective-C bug does this stop?" The answer almost always explains the rule.

Explaining a strict ruleStep 1 of 4
  1. The rule

    Swift refuses to compile let total = hikes.count + 0.5 because Int and Double do not mix.

The trap is thinking Swift is "Objective-C with nicer syntax". The syntax is nicer, but the real change is that the compiler now catches mistakes before your users do.

Drills

Answer fast — trust the rule.

quick drill

When was Swift first announced?

quick drill

What did ABI stability in Swift 5 make possible?

quick drill

Which Swift feature most directly prevents the silent nil-messaging bugs of Objective-C?

quick drill

Which statement about Swift and Apple's frameworks is true?

Remember

  • Swift (announced 2014) keeps Apple's frameworks but makes mistakes fail early and loudly.
  • Shortcut: for any strict rule, ask which Objective-C bug it stops.
  • Trap: the big win is safety — optionals, value types, strong typing — not just prettier syntax.

Practice — level up

0/1 solved

Write your answer, then compare it with a rubric and a model answer.

ExplainMake the case for Swift

A teammate asks why TrailLog should be written in Swift rather than Objective-C, since both can call UIKit. Give them three concrete reasons, each tied to a bug or cost it removes.