Interactive roadmap
Swift and SwiftUI roadmap
Designed for complete beginners who want to build native apps for iPhone and iPad using modern Apple tools.
- 1
Swift Basics
0 of 4 done
Learn the fundamental building blocks of the Swift programming language.
Take your time with the fundamentals, as everything you build later relies on understanding these basic building blocks. - 2
Swift Intermediate Concepts
0 of 3 done
Explore safer data handling and object-oriented programming in Swift.
Intermediate Swift helps you structure larger apps cleanly so they are easier to maintain and scale over time. - 3
SwiftUI Views and Layouts
0 of 3 done
Build user interfaces visually using SwiftUI building blocks.
Start simple with your layouts by building small views first before combining them into complex screens. - 4
State and Data Flow
0 of 3 done
Make your user interface react to changes in data.
Keep your data flow straightforward so your views always update instantly when the underlying information changes. - 5
Navigation and Networking
0 of 3 done
Move between screens and load data from the internet.
Always fetch data asynchronously so your app remains responsive and pleasant for users to navigate.
Learn it all, with a tutor that never sleeps
Every topic links to LevelUp lessons, practice exercises and the 24/7 AI Tutor. Your progress updates as you master lessons.
Every topic explained
Step 1: Swift Basics
- Store data in your app using variables that can change and constants that stay the same.Swift.org Documentation
Read more
Variables and constants are the fundamental storage boxes in Swift used to hold information inside your app. You use a variable when the data needs to change over time, such as a user's current score in a game, and a constant when the value should never change, like your app's maximum allowed login attempts.
In daily life, think of a variable like a whiteboard where you write today's weather, and a constant like your date of birth carved in stone. Mastering this distinction ensures your app data remains secure and predictable as users interact with your interface.
- Use var to declare a variable that can change.
- Use let to declare a constant that stays fixed.
- Constants make your code safer by preventing accidental changes.
- Understand text, whole numbers, decimals, and true or false values in Swift.
Read more
Basic data types define the specific kind of information your variables can hold, helping Swift catch errors before your app even runs. The most common types include Strings for text, Int for whole numbers, Double for decimals, and Bool for true or false conditions.
Imagine a filing cabinet where each drawer is labelled for a specific format, such as receipts, names, or tick boxes. Using the correct data type ensures your app performs calculations properly and displays words correctly on the screen.
- String stores text inside quotation marks.
- Int handles whole numbers without fractions.
- Double handles numbers with decimal points.
- Bool stores either true or false.
- Make decisions in your code using if statements and repeat tasks using loops.
Read more
Control flow allows your code to make decisions and repeat tasks instead of running straight through from top to bottom. Using if statements, your app can check conditions like whether a password is correct, while loops let you repeat actions automatically.
Think of an automated thermostat that checks if the room is too cold, and if so, turns on the heating until the target temperature is reached. This logic brings your static screens to life with dynamic behaviour.
- If statements run code only when a condition is true.
- Else provides an alternative action if the condition fails.
- Loops repeat blocks of code multiple times efficiently.
- (optional)
- Bundle reusable blocks of code together into neat functions.
Read more
Functions are self-contained chunks of code designed to perform a specific task whenever you need them in your app. Instead of repeating the same lines of code over and over, you bundle them into a function and simply call it by name.
Consider a coffee machine that brews your favourite drink whenever you press a single button, handling all the complex steps behind the scenes. Functions keep your code clean, readable, and easy to update.
- Functions group reusable code together under a single name.
- They can accept inputs called parameters to customise their work.
- They can return a final result back to your code.
Step 2: Swift Intermediate Concepts
- Handle the potential absence of values safely using optional types.
Read more
Optionals are a powerful Swift feature used to handle situations where a value might be completely missing. In Swift, regular variables must always have a value, but an optional explicitly allows for the absence of data using a special question mark syntax.
Think of a gift box that might contain a present or might be completely empty; you must check inside safely before trying to play with what is inside. This prevents your app from crashing unexpectedly when data is absent.
Handling optionals correctly keeps your user experience smooth and robust across different network conditions.
- Optionals represent either a valid value or nil.
- Use if let to safely unwrap an optional value.
- Optional chaining lets you safely query properties that might be nil.
- Group related data and behavior together using custom types.
Read more
Structures and classes let you create custom data types that group related properties and behaviours together into a single logical unit. For example, you can define a User type that holds a name, email address, and profile photo URL.
Think of a blueprint for a house that defines all the rooms and features before the actual building takes place. Structs are copied when passed around, while classes share a single reference in memory.
Choosing the right type helps you manage memory efficiently and keeps your app architecture organised.
- Structs are value types and are copied when assigned.
- Classes are reference types that share a single instance.
- Both can contain stored properties and custom functions.
- Define blueprints for your types and add new features to existing code.
Read more
Protocols act as a blueprint of rules and requirements that a type must follow if it wants to adopt that protocol. Extensions let you add new functionality to existing types without needing to rewrite their original source code.
Think of a universal charging standard that phone manufacturers agree to follow so any compatible cable will work. Protocols ensure different parts of your app can communicate smoothly through a shared set of rules.
They are essential for writing flexible, reusable code in modern Swift applications.
- Protocols define required properties and methods without implementing them.
- Types conform to protocols by providing the required functionality.
- Extensions add new methods to existing types cleanly.
Step 3: SwiftUI Views and Layouts
- Display words, numbers, and pictures on the phone screen.Apple Developer Documentation
Read more
Basic views are the foundational visual elements like text labels and pictures that make up your app user interface. SwiftUI provides simple, descriptive building blocks that render natively on iPhone and iPad screens.
Think of them like building bricks that you place on a table to form words and pictures. Learning how to style and format these basic views is your first step towards building polished mobile apps.
Every great app interface begins with a clear title and a well-placed image.
- Text displays strings of characters with custom fonts.
- Image displays graphics loaded from your asset catalogue.
- Modifiers change the appearance and padding of views.
- Arrange your views horizontally, vertically, or layered on top of each other.
Read more
Stacks are layout containers that organise your basic views horizontally, vertically, or layered on top of each other in three dimensions. VStack arranges items in a column, HStack places them in a row, and ZStack layers views over one another.
Think of stacking books in a tall tower or lining them up side by side on a shelf. Stacks give you precise control over how your user interface adapts to different screen sizes.
Mastering stacks is crucial for designing clean, balanced mobile layouts.
- VStack stacks views vertically from top to bottom.
- HStack aligns views horizontally from left to right.
- ZStack places views on top of each other in layers.
- (optional)
- Display scrolling collections of items neatly on the screen.
Read more
Lists and ScrollViews let you present collections of items that exceed the physical height of the phone screen. Lists automatically style content into native iOS rows, while ScrollViews allow free scrolling for any custom layout.
Think of browsing through a long restaurant menu where you can flick up and down to see every available dish. These components ensure your app can handle large amounts of data without cluttering the screen.
They provide the familiar native feel that Apple users expect.
- List creates a native scrolling table of items.
- ScrollView enables free scrolling for custom content arrangements.
- ForEach helps generate multiple rows from an array of data.
Step 4: State and Data Flow
- Store changeable data directly inside a view to update the screen instantly.
Read more
The State property wrapper tells SwiftUI to watch a piece of data closely and redraw the screen whenever that value changes. By marking a variable as state, your interface becomes dynamic and responsive to user actions.
Think of a digital counter on a gym door that increments by one every time someone presses a clicker button, updating the display instantly. Without state, your app interface would remain frozen and ignore user interactions.
It is the primary way to manage local data within a single view.
- Use @State for temporary data owned by a single view.
- Modifying state triggers an automatic view redraw.
- State properties should generally be marked private.
- Connect child views to parent state so data can flow both ways.
Read more
A binding creates a two-way connection between a parent view state and a child view control, allowing the child to read and modify that data. When a user types in a text field or moves a slider, the underlying variable updates automatically.
Think of a steering wheel connected directly to the front wheels of a car; turning the wheel instantly turns the car. Bindings let you share changeable state across different components cleanly.
This makes interactive form inputs simple to build.
- Use @Binding to accept a reference to parent state.
- Prefix bindings with a dollar sign when passing them into controls.
- Enables child views to mutate parent data safely.
- (optional)
- Manage more complex app data outside of your views.
Read more
Observable objects let you manage complex app data and business logic outside of your view structure. By conforming a class to ObservableObject and publishing specific properties, multiple views can stay synchronized with the same data source.
Think of a shared calendar on the kitchen wall that all family members can read and update when plans change. This separates your data management from your user interface design.
It helps keep your codebase modular and easy to test as your app grows.
- Conform classes to ObservableObject to share state.
- Mark published properties with @Published to alert views.
- Use @ObservedObject or @StateObject inside your views.
Step 5: Navigation and Networking
- Let users tap items to push new screens onto the view hierarchy.
Read more
NavigationStack manages a stack of screens, allowing users to tap an item to push a new detailed view onto the display. It provides a native back button automatically so users can retrace their steps easily.
Think of clicking through folders on your computer desktop to open nested subfolders and returning with the back arrow. NavigationStack is the backbone of multi-screen app architecture in modern SwiftUI.
It keeps app navigation intuitive and familiar for mobile users.
- NavigationStack wraps views to enable screen transitions.
- NavigationLink defines the button that pushes a new view.
- Manages the navigation history stack automatically.
- Convert data received from web servers into Swift objects.
Read more
JSON parsing is the process of converting raw text data received from web servers into structured Swift objects your app can understand. Swift provides built-in tools like JSONDecoder to map server responses directly to your custom data types.
Think of receiving a delivery box filled with items and sorting them neatly onto the correct shelves in your pantry. This skill allows your app to display live information from the internet.
It bridges the gap between remote databases and your local user interface.
- Adopt the Decodable protocol on your models to parse JSON.
- Use JSONDecoder to convert raw data into Swift objects.
- Handle decoding errors safely with do-catch blocks.
- (optional)
- Fetch data from the internet without freezing the user interface.
Read more
Async and await are modern Swift keywords used to perform time-consuming tasks, like downloading images or fetching data, without freezing your user interface. Marking a function as async allows it to pause its work while waiting for a network response and resume once the data arrives.
Think of ordering food at a counter, getting a buzzer, and sitting down to chat while your meal is prepared instead of blocking the queue. This keeps your app smooth and responsive.
It is essential for building fast, connected applications today.
- Mark asynchronous functions with the async keyword.
- Use await when calling tasks that take time to complete.
- Wrap asynchronous calls in Task blocks inside SwiftUI views.