Learn Swift and SwiftUI from scratch: an iOS guide
What you need to build iPhone apps, the order to learn Swift and SwiftUI and 3 portfolio projects to land your first iOS job.
iPhone apps are built with Swift, Apple's language, and SwiftUI, its modern way of building screens. If iOS appeals to you, this guide tells you what to learn first and what to build.
1. What you need before you start
- A Mac. Xcode, the official free editor, only runs on macOS. It includes the iPhone simulator.
- An iPhone is optional. You can install your apps on your own phone with a free account (Personal Team), without paying for the developer membership.
- About 10 hours a week and Git from day one.
2. Swift: the language
Swift is modern, safe and quite readable. What matters most at first:
let(constant) andvar(variable), types and type inference.- Optionals: a value that may not exist. Learn
if let,guard letand??, and avoid!. struct,classandenum. In SwiftUI almost everything is astruct.- Collections and functions like
map,filterandsorted.
let name: String? = nil
print("Hi, \(name ?? "guest")")
3. SwiftUI: the screens
In SwiftUI you describe what the screen looks like for a given state, and SwiftUI updates it. Learn in this order:
- Views and layout:
Text,Image,Button,VStack,HStack,List. - State:
@Stateand@Binding; then@Observablefor your ViewModels. - Navigation:
NavigationStack,.sheetandTabView. - Networking:
URLSessionwithasync/awaitandCodableto read JSON. - Architecture and data: MVVM,
UserDefaultsfor preferences and SwiftData to store data on the phone. - Quality: tests with Swift Testing or XCTest and the Xcode debugger.
4. Portfolio projects
- My Playlist: song lists with a detail screen and favorites. You practice
List, state and navigation. - Allowance tracker: an expense tracker with forms, MVVM and SwiftData.
- Pokédex: uses PokéAPI with
async/await, handles loading and errors and keeps a cache.
Put simulator screenshots in each repo's README: in iOS, screenshots sell.
5. Common mistakes
- Using
!to force-unwrap optionals. It's the most common cause of beginner crashes. - Storing passwords in
UserDefaults. It isn't secure: that's what the Keychain is for. - Ignoring older code. In real teams you'll see
ObservableObjectand@Published; learn to read them. - Not showing error states. A screen must know what to do when there's no internet or the list is empty.
If you've never coded, start with how to start programming from scratch. And if you prefer Android, see how to start Android development.
Next step
Codea's free iOS Developer Jr route takes you in 6 weeks from Swift and Git to a real-work simulation, with challenges, quizzes and teacher review. Route content is in Spanish.
Videos, hands-on challenges, quizzes and teacher reviews (route content is in Spanish).