
Build a budget app with Supabase for iOS, setting up environment and client, applying the mvt pattern, and managing expenses, authentication, receipts storage, real-time chat, presence, tags, and edge functions.
Prepare by confirming prerequisites: familiarize yourself with Swift language and the UI framework, and install the latest non-beta Xcode. Learn to integrate Supabase with SwiftUI step by step.
Download the exercise files from the resources button for each lecture to access working code and follow along, so you can run the code if you miss something.
Explore Supabase, an open source Firebase alternative for iOS developers, offering Postgres database, authentication, instant APIs, edge functions, real-time subscriptions, and storage, with a lightweight Swift client/server API.
Sign in to Supabase and create a project to set up your database in the dashboard. Create a budgets table with id, created_at, name, and limit, then add sample rows.
Integrate the Supabase Swift package into a SwiftUI budget app, initialize the client with the project URL and API key, and prepare to move the client to an environment value.
inject a Supabase client into SwiftUI environment values using a custom environment key and extensions, enabling development configurations in the content view.
Fetch budgets from the Supabase database and display them in a SwiftUI list. Show each budget's name and a currency-formatted limit, using a budget model and the task modifier.
Learn to add budgets to a SwiftUI list using the Supabase client, building an add budget screen with name and limit, and saving via async insert into the budgets table.
Learn to save a new budget using closure or binding to update the budgets array in the list screen and trigger a rerender without extra server fetches.
Delete budgets by swiping from right to left to reveal a delete button, using for each list and on delete to remove the budget from Supabase and the local array.
Update a budget item in an iOS app by editing name and limit on a budget detail screen, then apply the changes to supabase via a codable updated budget instance.
Move toward a global expense tracker store with an observable pattern to load budgets from Supabase and display them in the budget list screen.
Learn how to add a new budget in a supabase-backed iOS app by injecting the expense tracker store, using the add budget function, and saving budgets with async throws.
Implement the delete budget operation in the budget list screen by fetching the budget id, invoking the delete budget function in the store, and confirming removal from the database.
Update budgets in the expense tracker using the supabase client, moving the update logic to the expense tracker store, syncing the updated budget with the local array and user interface.
Learn to create an expenses table in supabase with id, created_at, name, amount, and a not nullable budget_id foreign key referencing budgets, using snake_case and cascade delete, enabling crud operations.
Create an expense model in Swift conforming to Codable and Identifiable, with id, name, amount, and budget_id, and define a belongs to budget relationship.
Add an expense to a budget from budget detail screen using an add expense sheet, a name and amount form, and updating the budget’s expenses via the expense tracker store.
Learn to fetch expenses for budgets in Supabase by loading budgets with their expenses using select, including id, name, limit, and budget expenses such as entertainment.
Fetch expenses by a selected budget using a dedicated load expenses by function. Then assign them to the budget’s expenses via the budget details screen’s task modifier.
Create an expense list view and expense cell view in SwiftUI to display expenses, format totals with locale currency code, and prepare for delete and update functionality.
Implement a delete expense function in the expense tracker store, using the expense ID, deleting from Supabase, refreshing budgets, and handling invalid expense IDs.
Update an expense in a SwiftUI iOS app using Supabase, via the budget detail and expense list views, a sheet with a medium detent, and an async update expense workflow.
Explore how to set up and use Supabase authentication in a budgets app, including email verification, disabling confirm email, multiple sign-in methods, and linking budgets to user IDs.
Update budgets table to include a user_id reference to the authentication schema's users.id using uuid, with a foreign key and cascade delete, then update budgets model and handle expenses.
Learn how to add user id to the budget model, map user id with coding keys, handle previews, and prepare for user registration and sign-in in the next lecture.
Create a registration screen using Supabase auth to sign up with email and password, with form validation, error handling, and optional email verification.
Sign in a new user with email and password using a Supabase auth client, handle login errors, present a registration modal, and navigate to the budget list after successful authentication.
Learn how to navigate to the budgets list after sign-in by listening to authentication events and using a simple router to switch between login and budgets screens.
Add a settings button on the budget list toolbar to present the sign out screen. Trigger async sign out via the authentication client and reset routes to show login screen.
Create a receipts bucket in Supabase storage, configure access, and upload receipts; link the returned URL to the expenses as a receipt path, updating the expense model and env setup.
Implement a storage client by creating a storage client key and environment value extension for Supabase, injected into the view hierarchy alongside the authentication client.
Explore selecting and displaying images from the photo library or camera using a photo picker and a custom image picker, with camera permission on real devices.
Learn how to attach receipts to expenses by uploading resized images to Supabase storage, saving the receipt path with the expense, and showing a receipt indicator in the list.
Learn to display receipts by loading a receipt from Supabase storage into the expense details screen. Use a storage client to download image data and render it.
Learn how real-time works in Supabase by subscribing to a chat channel and listening to changes on a chats table, enabling live chat updates in the budget app.
Define a Codable, identifiable ChatMessage struct with id, text, userId, email, and createdAt, map snake_case with coding keys, and subscribe to the chats table in the general room.
Configure a Supabase channel in a SwiftUI chat screen to subscribe to the chats table, listen for Postgres changes via an async change stream, and handle inserts.
Save chat messages using a container presentation pattern with a Supabase client, authenticating the user, inserting into the chats table, and verifying real-time change streams through a channel subscription.
Save chat messages to the Supabase database, the source of truth for the SwiftUI app, and sync the local chat messages when inserts occur, with loading on page load.
Implement a chat message list view and a chat message view to display and differentiate current user's messages from others, using dependency injection and left-right alignment.
Add a custom chat input and auto-scroll to the latest message in a Supabase real-time iOS chat app. Implement text input overlay and scroll to last message ID.
Configure the supabase presence stream in the chat screen, subscribe to presence change events, refactor into dedicated handlers, and model user status to track who joins or leaves.
Handle presence streams by tracking joins and leaves with a single presence change function and presence values, then maintain and display online user statuses in the chat UI.
Display user statuses with a dedicated user status list view, showing online and offline states via the presence API, integrated into the chat screen with a customizable interface.
Display user status by toggling between green (online) and red (offline), using a unique user id (uuid) in presence updates to reflect online status without removing users.
Explore many to many relationships by using a pivot table to link expenses and tags, with expense_id and tag_id foreign keys and cascade rules in a Postgres based Supabase workflow.
Add a tag model and establish a one-to-many relationship from expenses to tags, update expense to include tags, and fetch tags when loading expenses for display.
Implement an add tags view and tag display in swiftui, featuring a tag list and tag view, selected tags as a set, and adding new tags via a text field.
Learn how to save tags to the database with Supabase, including adding and creating tags, loading them in the add expense screen, and persisting relationships in the expense_tags join table.
Refactor the receipt upload into a dedicated async function that returns the receipt path, integrating with a storage client and error handling.
Save expense tags by inserting tag IDs into the expenses_tags join table and syncing with the expense, then display those tags in the expense list view for clear tagging.
Learn to update expenses and tags in a many-to-many setup with Supabase for iOS. Load and display tags, select or add tags, and refresh expense-tag relationships on update.
Enable row level security on the expenses and tags tables, create policies for authenticated users for all operations, and enforce authentication to access data in your Supabase iOS app.
Explore edge functions in Supabase, built with TypeScript and run on Deno, to deploy serverless APIs, trigger via webhooks, and integrate with authentication, Postgres database, and storage.
Configure your machine to develop edge functions with Supabase by installing the CLI, initializing the project, and creating a hello world function in TypeScript and Deno using Docker.
Explore deploying edge functions written in TypeScript on Deno, running them locally with Docker via Supabase function serve, deploying to production, and invoking from a SwiftUI app.
Learn how to use Postgres webhooks to invoke edge functions in Supabase, automatically moving expenses over 500 dollars into a premium_expenses table via an insert webhook.
Welcome to the Supabase for iOS Developers Course!
Are you ready to elevate your iOS development skills by integrating powerful backend capabilities into your apps? In this comprehensive course, you'll learn how to harness the full potential of Supabase, an open-source Firebase alternative, specifically tailored for iOS developers.
Whether you're a beginner just starting your journey or an experienced developer looking to expand your toolkit, this course is designed for all skill levels. Step by step, we'll guide you through the entire process of integrating Supabase into your iOS applications, covering a wide range of essential topics to ensure you can leverage the platform effectively.
What You'll Learn:
- Integrating Supabase Database: Set up and connect your iOS app with a robust backend powered by Supabase.
- Understanding Architectural Choices: Learn the best practices and architectural decisions for a seamless integration.
- Adding and Managing Relationships: Master the art of creating and managing relationships between your data tables.
- Authenticating Users: Implement secure user authentication using Supabase’s powerful authentication system.
- Integrating with the Storage API: Store and manage files in your app with Supabase’s storage API.
- Edge Functions: Explore how to write and deploy server-side functions to handle complex logic.
- Real-Time API: Add real-time capabilities to your app, keeping your data in sync across all clients.
- Presence API: Learn how to manage user presence in real-time applications.
- Many-to-Many Relationships: Efficiently handle complex relationships in your data models.
- Edge Functions: Deep dive into advanced server-side logic with edge functions.
Check out the following reviews:
"Incredible Course!"
I was a bit hesitant at first, but this course blew me away. The instructor breaks down complex topics into simple, easy-to-follow steps. I now feel confident integrating Supabase into my iOS apps. Highly recommend it to anyone looking to up their backend game!
— Emily R.
"Practical and Insightful!"
The course content is super practical and immediately applicable. The instructor does an amazing job explaining the architectural choices behind using Supabase with iOS. It really helped me understand the best practices and how to avoid common pitfalls. A must for any iOS developer!
— Sophia L.
"Learned So Much!"
I’ve taken a few courses on backend services, but this one really stood out. The instructor’s teaching style is clear and concise, and the hands-on examples helped me grasp the concepts quickly. The section on edge functions was a game-changer for my projects.
— Liam K.
Thanks,
Azam