Swift
In short: Apple’s modern programming language for iOS, macOS and watchOS apps — the successor to Objective-C since 2014.
In more detail: Like Kotlin, Swift is deliberately safety-oriented (e.g. optionals against null bugs) and considerably more compact than Objective-C. Runs natively on Apple’s platforms and is developed and distributed through the App Store ecosystem (Xcode).
In Depth
func greeting(name: String?) -> String {
return "Hello, \(name ?? "Unknown")"
}Swift’s “optionals” (String? in the example — a value that either contains real content or explicitly “nothing”) solve a similar problem to Kotlin’s null safety: the compiler forces you to explicitly handle the possibility of a missing value before accessing it, instead of being surprised by a crash only at runtime. This was one of the main criticisms of the predecessor, Objective-C, where missing references frequently led to runtime errors.
Swift is closely intertwined with Apple’s Xcode development environment and designed exclusively for Apple’s own ecosystem (iOS, iPadOS, macOS, watchOS, tvOS) — unlike Kotlin, which, while primarily used for Android, can also be used more platform-independently as a general-purpose JVM language. SwiftUI, Apple’s declarative UI framework, has increasingly replaced the older, imperative UIKit approach in recent years.
Origin and motivation
Swift was developed by Chris Lattner (also the creator of the LLVM compiler framework Swift builds on) at Apple and unveiled as a surprise at the WWDC developer conference in 2014 — until then, Objective-C had been the only practical language for Apple platforms for decades. Objective-C (an extension of C with object-oriented concepts modelled on Smalltalk) was seen as increasingly old-fashioned: cumbersome syntax with square brackets for method calls, manual memory management in older versions, and a steep learning curve for newcomers without a C background. Swift was meant to offer a modern, safer, and more accessible alternative for beginners, with high performance close to compiled C code at the same time.
Automatic Reference Counting instead of a garbage collector
Unlike Java or Kotlin, Swift doesn’t use a classic garbage collector, but Automatic Reference Counting (ARC) — the compiler already inserts code at compile time that counts how many references point to an object, and frees the memory as soon as the count reaches zero. This avoids the unpredictable brief pauses a classic garbage collector can occasionally cause (relevant for smooth UI animations), but requires attention with circular references (two objects reference each other, the count never reaches zero) — for that, Swift offers explicit weak/unowned references, to deliberately break such cycles.
SwiftUI and declarative UI
SwiftUI (since 2019) describes user interfaces declaratively — you describe HOW the UI should look in a given state, instead of imperatively creating and updating UI elements step by step (the older UIKit approach). This paradigm conceptually resembles React in the web space (declarative components that automatically re-render on state changes) and has made getting into native Apple development easier for developers with a web background.