Share. Learn. Build Together.
Togu is a student-friendly learning platform where users can ask questions, share answers, and earn badges for being active and helpful. Think of it as a focused, community-driven Q&A platform designed for students to connect and learn together.
- π OneLogin Authentication - Secure sign-in with OneLogin OIDC
- π Ask Questions - Post questions with text, tags, code snippets, and images
- π¬ Answer Questions - Help others by providing detailed answers
- β¬οΈ Voting System - Upvote helpful questions and answers
- π Badges & Points - Earn achievements and XP for your contributions
- π€ User Profiles - View your stats, badges, questions, and answers
- π Leaderboard - See top contributors ranked by points
- π Search & Filter - Find questions by text or tags
- π± Modern UI - Beautiful, intuitive SwiftUI interface
- β¨ Pull-to-Refresh - Refresh content with a simple swipe
- π Pagination - Efficient loading of large question lists
- π¨ Code Snippet Support - Syntax-highlighted code blocks
- π·οΈ Tag System - Organize content with predefined tags
- π Activity Feed - Track your recent contributions
- π― Empty States - Helpful messages when no content is available
- β‘ Error Handling - Graceful error messages and retry logic
- π Real-time Updates - Instant UI updates after actions
Togu follows the MVVM (Model-View-ViewModel) architecture pattern for clean separation of concerns:
βββββββββββββββ
β Views β SwiftUI Views (UI Layer)
βββββββββββββββ€
β ViewModels β Business Logic & State Management
βββββββββββββββ€
β Services β API & Data Layer (Airtable)
βββββββββββββββ€
β Models β Data Structures
βββββββββββββββ
- Views: SwiftUI views for UI presentation
- ViewModels:
ObservableObjectclasses managing view state and business logic - Services: Domain-specific services for API interactions
QuestionsService- Question operationsAnswersService- Answer operationsUsersService- User managementVotesService- Voting systemBadgesService- Badge managementLeaderboardService- Leaderboard data
- Models: Data structures representing entities (Question, Answer, User, etc.)
- Language: Swift 5.9+
- Framework: SwiftUI
- iOS Version: 17.0+
- Authentication: OneLogin OIDC
- Backend: Airtable API
- Architecture: MVVM
- Async/Await: Modern Swift concurrency
Before you begin, ensure you have:
- Xcode 15.0+ installed
- iOS 17.0+ deployment target
- Airtable Account with:
- API Key
- Base ID
- Tables:
Users,Questions,Answers,Votes,Badges
- OneLogin Configuration:
- Client ID
- Redirect URI:
com.shfa.Togu.oidc:// - OIDC configuration file (
OL-Oidc.plist)
git clone https://github.com/yourusername/togu.git
cd togu-
Create an Airtable base with the following tables:
- Users (Name, Email, ProfilePicture, Points, Badges)
- Questions (Title, Body, Tags, Author, Upvotes, Image)
- Answers (AnswerText, Author, Question, Upvotes, CreatedDate)
- Votes (User, TargetType, TargetQuestion, TargetAnswer)
- Badges (Badge Name, Description, Icon, EarnedBy, DateEarned)
-
Get your Airtable API Key and Base ID from Airtable Account
- Set up your OneLogin OIDC application
- Add the redirect URI:
com.shfa.Togu.oidc:// - Place your
OL-Oidc.plistconfiguration file inTogu/Resources/
Add the following to your Xcode project's build settings or Info.plist:
<key>AIRTABLE_KEY</key>
<string>your_airtable_api_key</string>
<key>AIRTABLE_BASE_ID</key>
<string>your_airtable_base_id</string>Alternatively, set them as environment variables in your Xcode scheme.
- Open
Togu.xcodeprojin Xcode - Select your target device or simulator
- Press
Cmd + Rto build and run
Watch the demo of Togu in action here:
π‘ Click the image above to watch the demo on YouTube.
For quick testing and access, you can use the following test user account to sign in and create a password:
Email: reignite@hackathon.com
Password: Hackathon1@
This account is intended for demo and hackathon testing purposes.
Once logged in, you can, post questions & answers, reciver badges, and explore all platform features.
Togu/
βββ App/
β βββ ToguApp.swift # App entry point
β βββ RootRouter.swift # Navigation router
β βββ AppDelegate.swift # App lifecycle
β
βββ Model/
β βββ Question.swift # Question data model
β βββ Answer.swift # Answer data model
β βββ AuthState.swift # Authentication state
β βββ LeaderboardEntry.swift # Leaderboard entry
β βββ Activity.swift # User activity
β βββ Skill.swift # User skills
β βββ LevelInfo.swift # Level calculation
β βββ AirtableModels.swift # Airtable field mappings
β
βββ ViewModel/
β βββ AuthViewModel.swift # Authentication logic
β βββ FeedViewModel.swift # Question feed logic
β βββ HomeViewModel.swift # Home screen logic
β βββ QuestionDetailViewModel.swift # Question detail logic
β βββ AnswerFormViewModel.swift # Answer form logic
β βββ AskQuestionViewModel.swift # Ask question logic
β βββ ProfileViewModel.swift # Profile logic
β βββ LeaderboardViewModel.swift # Leaderboard logic
β βββ LoginViewModel.swift # Login screen logic
β
βββ Views/
β βββ MainTabView.swift # Tab navigation
β βββ HomeView.swift # Question feed
β βββ QuestionDetailView.swift # Question details
β βββ AskQuestionView.swift # Post question
β βββ AnswerFormView.swift # Post answer
β βββ ProfileView.swift # User profile
β βββ LeaderboardView.swift # Leaderboard
β βββ LoginView.swift # Login screen
β βββ SplashView.swift # Splash screen
β βββ Components/ # Reusable UI components
β βββ Profile/
β βββ Leaderboard/
β βββ QuestionDetail/
β βββ EmptyStateView.swift
β βββ LoadingView.swift
β βββ ErrorView.swift
β βββ ErrorToast.swift
β
βββ Services/
β βββ AirtableService.swift # Main Airtable facade
β βββ QuestionsService.swift # Question operations
β βββ AnswersService.swift # Answer operations
β βββ UsersService.swift # User operations
β βββ VotesService.swift # Voting operations
β βββ BadgesService.swift # Badge operations
β βββ LeaderboardService.swift # Leaderboard operations
β βββ AirtableConfig.swift # Airtable configuration
β βββ AirtableListResponse.swift # API response models
β
βββ Utilities/
β βββ FormattingHelpers.swift # Date/number formatting
β βββ MarkdownHelpers.swift # Markdown processing
β
βββ Resources/
βββ Assets.xcassets # App assets
βββ Theme.swift # App theme & colors
βββ Info.plist # App configuration
βββ OL-Oidc.plist # OneLogin config
Togu uses a custom design system defined in Theme.swift:
- Primary Color:
toguPrimary- Main brand color - Background:
toguBackground- App background - Text Colors:
toguTextPrimary,toguTextSecondary - Card Colors:
toguCard,toguBorder - Error Colors:
toguError,toguDisabled
All colors are accessible via SwiftUI's Color extension.
- User taps "Sign in with IDServe" on
LoginView AuthViewModelinitiates OneLogin OIDC flow- User authenticates via OneLogin
- App receives OIDC callback with tokens
- User is redirected to
MainTabView(Home) - User data is synced with Airtable
Userstable
HomeView β FeedViewModel β QuestionsService β Airtable API
AskQuestionView β AskQuestionViewModel β QuestionsService β Airtable API
β BadgesService (check milestones)
β UsersService (award points)
QuestionDetailView β QuestionDetailViewModel β VotesService β Airtable API
β UsersService (award points to author)
To test the app:
- Login: Use your OneLogin credentials
- Ask Questions: Post questions with tags and optional images
- Answer Questions: Provide helpful answers
- Vote: Upvote quality content
- Check Profile: View your badges, points, and activity
- Leaderboard: See top contributors
- Mesh gradient background requires iOS 18.0+ (fallback provided for earlier versions)
- Image uploads are limited by Airtable's attachment size limits
- Badge awarding may have a slight delay due to Airtable indexing
- Push notifications for new answers
- Markdown editor for questions/answers
- Image compression before upload
- Offline mode with local caching
- Dark mode support
- Question categories
- Answer acceptance feature
- User mentions and notifications
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Follow Swift naming conventions
- Use SwiftUI best practices
- Maintain MVVM architecture
- Add comments for complex logic
- Keep functions focused and small
This project is licensed under the MIT License - see the LICENSE file for details.
- Airtable for the backend infrastructure
- OneLogin for authentication
- SwiftUI community for inspiration and best practices
If you encounter any issues or have questions:
- Check the Issues page
- Create a new issue with detailed information
- Contact the maintainers
Made with β€οΈ for learner, by learners
