- Qaptain is a SwiftUI iOS app for managing classroom quizzes.
- Teachers can create classrooms, build multiple-choice quizzes, and monitor student progress in real-time.
- Students join classrooms using secure passwords, take interactive quizzes, and track their performance instantly.
- Platform: iOS (SwiftUI)
- Language: Swift
- Architecture: ObservableObject state management with singleton controllers/providers
- Backend: Firebase Firestore
- Dependencies: Firebase (Core, Auth, Firestore)
-
Qaptain-Demo.mp4
-
Splash screen appears on launch, followed by login and onboarding
auth-demo.mp4
-
- Email/password sign up and sign in via Firebase Auth
- Forgot password flow with email reset
- Reactive UI bound to authentication state
-
- Two roles: Teacher (creator) and Student (member)
- Teachers can create classrooms (with auto-generated passwords)
- Validate classroom name uniqueness per teacher (a teacher cannot create two classrooms with the same name)
- Students join classrooms using a password
- Search classrooms by name, creator, and creation month/year
- Sort classrooms by newest/oldest
- Pull-to-refresh and pagination support
-
- Create quizzes with a name, deadline, and multiple questions
- Validate quiz name uniqueness per classroom (each classroom cannot have duplicate quiz names)
- View quizzes for a classroom, sorted by creation date or deadline
- Take quizzes; attempts are stored in stats
- Teachers can view aggregated quiz stats for all students
-
- View all classroom members
- Teachers can remove members (with automatic cleanup of their quiz stats)
- Regenerate classroom passwords
-
- First-launch detection to show an Instructions screen
- Instructions accessible from the Classrooms toolbar
-
- Splash screen overlay
- Loading, Retry, and Error states are clearly displayed for all CRUD and data-fetching operations
- Validates input as you type and updates submit buttons accordingly
- Searchable and refreshable (pull-to-refresh) lists with a sorting menu on the toolbar
-
- Uses accessibility labels and combines card content for coherent VoiceOver reading
- Descriptive labels for toolbar and buttons
-
- Automatically switches between light and dark mode for a consistent look
- Responsive on all iPhone and iPad screens, in both portrait and landscape
| File | Description |
|---|---|
QaptainApp.swift |
App entry point; configures Firebase and wires up the auth environment object |
ContentView.swift |
Root view that switches between AuthenticatedView, AuthView, or a loading state based on AuthController |
AuthController.swift |
ObservableObject singleton managing Firebase Auth, UI states, and auth workflows |
DataManager.swift |
Firestore data layer singleton for users, classrooms, quizzes, and stats |
ClassroomProvider.swift |
Singleton ObservableObject that fetches, caches, and manages classroom data with pagination, filtering, and UI state updates |
ClassroomsView.swift |
Main navigation for classrooms with segmented control, search, sorting, refresh, and modals |
NetworkMonitor.swift |
Singleton ObservableObject that monitors real-time network connectivity and updates UI via published properties |
NetworkAlertModifier.swift / View+Extension.swift |
Custom ViewModifier and extension providing automatic network connectivity alerts across the app |
InstructionsView.swift |
Onboarding and help view detailing app features for teachers and students |
Additional views/providers/models exist for classroom details, quiz creation, enrollment, and stats
-
-
DataManager Responsibilities (
DataManager.swift)-
The
DataManager.swiftis a central Singleton class that strictly handles all direct communication with Firebase Firestore. -
This architectural choice separates data persistence logic from the UI/view model layer (
ClassroomProvider.swift) and ensures consistent data validation and cleaning across the application. -
It primarily relies on Swift's modern
async/awaitconcurrency and uses completion handlers for asynchronous results.Area Functionality & Key Implementation Details Architectural Core Singleton Pattern: Enforced with a private init()andstatic let shared.App Launch Management Onboarding State: Manages the app's first-launch state by checking and setting flags in UserDefaults(hasLaunchedBefore) to control the display of onboarding instructions.User Management Propagating Name Updates: The critical updateUserNameEverywherefunction ensures that when a user changes their name, it is consistently updated across: their mainusersdocument, everymemberssubcollection document, thecreatedByNamefield in their classrooms, and theirnamein all relevantstatsdocuments.Classroom Creation Uniqueness & Setup: Validates the classroom name for uniqueness per creator. Creates the main Classroom document, automatically generates a unique password ( UUID), and adds the creator as the initialmember(isCreator: true).Classroom Enrollment Secure Joining: Searches for classrooms using the join password, verifies the user isn't already enrolled, fetches user profile data, and adds the student to the memberssubcollection.Quiz Management & Stats Atomic Creation: Creates new quizzes after validating name uniqueness per classroom. Uses a Firestore Batchto write all quiz questions simultaneously, ensuring atomicity.
Attempt Tracking: ThesubmitStatsForQuizmethod manages student progress, either creating a newQuizStatrecord or appending a newAttemptobject to an existing list, and updates thelastAttemptDate.Cleanup & Deletion Deep Deletion: The destructive functions ( deleteClassroom,deleteQuiz,removeMember) automatically perform cascading cleanup. For example, removing amembertriggers the deletion of all theirQuizStatrecords. Deleting aclassroomrecursively deletes all itsquizzes,quizQuestions,QuizStats, andmembers.Input Validation Data Cleaning: Uses cleanName(withName:)to normalize user input (names, titles) by trimming whitespace, ensuring data integrity before persistence.
-
QaptainApp.swiftconfigures Firebase and listens for auth changes viaAuthController.swift.ContentView.swiftdisplays aSplashScreen.swiftoverlay, then routes toAuthView.swiftorAuthenticatedView.swiftbased onAuthState.- The app monitors network connectivity via
NetworkMonitor.swiftand displays alerts using the.networkAlert()modifier when internet connection is lost, ensuring users are informed before Firebase operations. - Classrooms are loaded and observed via
ClassroomProvider.swiftto provide real-time updates, pagination, and role-based filtering. ClassroomsView.swiftis the primary entry for authenticated users, with segmented control for Enrolled vs Teaching classes, search, sort, and actions to create/enroll.InstructionsView.swiftis shown on first launch and available from the toolbar.
- Xcode 15 or later (modern SwiftUI APIs)
- No CocoaPods or Swift Package Manager setup required (Firebase SDKs are already integrated)
- Internet connection for Firebase Auth & Firestore
-
The repository already includes a fully configured
GoogleService-Info.plist, so when you clone the repo, the app is immediately linked to Firebase -
You can simply Build & Run in Xcode to use the existing Firebase Auth and Firestore setup. (no extra configuration needed)
-
If you’d like to connect your own Firebase project instead:
- Create a new project in the Firebase Console
- Add an iOS app and download your own
GoogleService-Info.plistfile - Replace the existing file in the Xcode project
- Enable Email/Password Authentication and Cloud Firestore (Native mode)
Note: The included Firebase configuration is provided for demo and testing purposes only. Do NOT use it for production
- Open the project in Xcode
- Choose an iOS Simulator or connected device
- Click Run (⌘ + R) - the app will launch and automatically connect to Firebase
- SwiftUI-first architecture with
@State,@StateObject, and@EnvironmentObject - Singletons for cross-cutting controllers (
AuthController.swift,DataManager.swift) - Clear logging for major actions and errors
- Input cleaning and validation for user data
Qaptain was developed as the final project for the course MPCS 51032 Advanced iOS Application Development (Spring 2025) at the University of Chicago.
Developed by: Abhyas Mall
Project: Qaptain
Contact: mallabhyas@gmail.com
Qaptain is under the MIT License
