Swift
Apple's modern language for iOS and macOS — safe by design, expressive to write, and the foundation SwiftUI builds on.
22 pelajaran
Swift
Mulai KursusGetting Started
- What is Swift?What Swift is, where it's used, and why Apple built it to replace Objective-C.
- Setting Up SwiftInstalling Swift, running your first file, and where Xcode and Swift Playgrounds fit in.
- Variables and ConstantsDeclaring values with var and let, and how Swift infers types without you writing them out.
Types & Strings
Optionals
- Understanding OptionalsWhy Swift wraps "maybe no value" into the type system itself, and what Optional actually is.
- Optional BindingSafely unwrapping optionals with if let and guard let instead of force-unwrapping.
- Nil-Coalescing and Optional ChainingProviding fallback values with ?? and safely reaching into nested optionals with ?.
Control Flow
- Operators in SwiftArithmetic, comparison, and logical operators, plus the range operators Swift uses everywhere.
- Conditionals and Switchif/else as expected, plus Swift's switch statement — far more powerful than a simple multi-way branch.
- Loops in Swiftfor-in and while loops, and the control statements that shape how they run.
Collections & Functions
- ArraysOrdered, type-safe collections — creating, mutating, and iterating over an Array.
- Dictionaries and SetsKey-value storage with Dictionary, and unique unordered collections with Set.
- Functions in SwiftDeclaring functions, parameter labels, default values, and returning multiple values with tuples.
- ClosuresSelf-contained blocks of functionality that can be passed around like any other value.
Structs, Classes & Enums
- Structs vs. ClassesValue types versus reference types — the distinction that shapes how data moves through a Swift program.
- Properties and MethodsStored and computed properties, mutating methods, and how initializers set up an instance.
- Enums and Associated ValuesSwift's enum goes far beyond a list of named constants, letting each case carry its own data.
Protocols, Errors & Beyond
- Protocols and Protocol-Oriented ProgrammingDefining shared requirements with protocol, and why Swift encourages composing behavior over inheriting it.
- Error HandlingModeling failure explicitly with throwing functions and do/try/catch.
- Extensions and GenericsAdding functionality to existing types with extension, and writing code that works with any type using generics.
- Introduction to SwiftUIA first look at Apple's declarative UI framework, and where to go next after learning the Swift language.