A modern, feature-rich ToDo List application built with SwiftUI that connects to a RESTful API backend. Manage your tasks efficiently with a clean and intuitive interface.
Master the concepts behind this project! We've prepared 50+ comprehensive questions covering SwiftUI, MVVM, async/await, networking, Combine, and more. Each question includes detailed answers with real examples from this codebase. Perfect for iOS development interview preparation! π
- β Create, read, update, and delete todos
- π Toggle todo completion status
- π Add optional descriptions to todos
- π¨ Clean and modern SwiftUI interface
- π RESTful API integration
- β‘ Async/await for network operations
- π Error handling with user-friendly alerts
- π± Native iOS experience
- SwiftUI - Modern declarative UI framework
- Combine - Reactive programming framework
- URLSession - Networking with async/await
- MVVM Architecture - Clean separation of concerns
- Codable - JSON encoding/decoding
- @MainActor - Thread-safe UI updates
The app follows the MVVM (Model-View-ViewModel) pattern:
- Model (
Todo): Data structure representing a todo item - View (
ContentView,AddTodoView,EditTodoView,TodoRowView): SwiftUI views - ViewModel (
TodoViewModel): Business logic and state management - Service (
TodoService): API communication layer
- iOS 15.0+
- Xcode 13.0+
- Swift 5.5+
- Make sure you have Xcode installed
- Clone the backend repository and set it up:
git clone https://github.com/DebugWithAryan/ToDoList-Backend-
-
Clone this repository:
git clone <your-repo-url> cd To-Do-List
-
Open the project in Xcode:
open To-Do\ List.xcodeproj -
Update the API endpoint in
ContentView.swiftif needed:private let baseUrl = "https://todoapp-en1q.onrender.com/api/todos"
-
Build and run the project (β+R)
The backend for this app is built with Node.js and Express. You can find it here:
- Tap the + button in the navigation bar
- Enter a title (required)
- Optionally add a description
- Tap Add to create the todo
- Tap the pencil icon next to any todo
- Update the title or description
- Tap Save to apply changes
- Tap the circle icon to mark a todo as complete
- The todo will show a checkmark and strikethrough text
- Tap the trash icon to delete a todo
- The todo will be immediately removed
- Tap the refresh icon in the navigation bar to reload all todos
The app integrates with a RESTful API with the following endpoints:
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/todos |
Fetch all todos |
| POST | /api/todos |
Create a new todo |
| PUT | /api/todos/:id |
Update a todo |
| DELETE | /api/todos/:id |
Delete a todo |
To-Do List/
βββ ContentView.swift # Main views and UI components
βββ TodoViewModel.swift # ViewModel and business logic
βββ Assets/ # App assets and resources
struct Todo: Codable, Identifiable {
let id: Int?
let title: String
let description: String?
let completed: Bool
let createdAt: String?
let updatedAt: String?
}Handles all API communication with async/await:
fetchTodo()- Get all todoscreateTodo()- Create new todoupdateTodo()- Update existing tododeleteTodo()- Delete todo
Manages app state using @Published properties:
todos- Array of todo itemsisLoading- Loading stateshowError- Error alert stateerrorMessage- Error message content
- ContentView: Main list view with todos
- AddTodoView: Sheet for creating new todos
- EditTodoView: Sheet for editing existing todos
- TodoRowView: Reusable row component for displaying todos
The app includes comprehensive error handling:
- Network request failures
- JSON parsing errors
- API errors
- User-friendly error messages via alerts
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the project
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is open source and available under the MIT License.
Aryan Jaiswal
- GitHub: @DebugWithAryan
- SwiftUI Documentation
- Apple Developer Resources
- The iOS Development Community
If you have any questions or need help, please open an issue in the repository.
βοΈ If you found this project helpful, please give it a star!


