A comprehensive iOS application designed for law exam preparation, specifically tailored for judicial officer and lawyer examinations in Taiwan.
MasterLaw is a native iOS app built with SwiftUI and SwiftData, providing an intelligent study platform with practice questions, spaced repetition flashcards, learning analytics, and AI-powered assistance.
- Complete collection of past examination questions
- Multiple-choice question practice
- Instant feedback and explanations
- Category-based question filtering
- Bookmark difficult questions for review
- SM-2 algorithm for spaced repetition learning
- Create and manage custom flashcards
- Subject categorization (e.g., Constitutional Law, Criminal Law, Civil Law)
- Review scheduling based on performance
- Flip cards to reveal answers
- Activity heatmap tracking daily study sessions
- Performance charts and statistics
- Progress visualization
- Identify weak areas for focused study
- Track study streaks and active days
- Home screen widgets displaying flashcards for quick review
- Multiple widget sizes (small, medium, large)
- Shuffle functionality to see different cards
- Deep linking to open specific flashcards in the app
- Activity summary widget showing weekly progress
- AI-powered question and answer support
- Get explanations for difficult concepts
- Interactive problem-solving assistance
- Context-aware legal topic discussions
- Cached questions and flashcards for offline access
- Sync data when connection is restored
- Offline banner indicating cached content
- Pending review tracking for later synchronization
- Secure authentication system
- User profiles with study statistics
- Subscription tiers (Free and Premium)
- Badge and achievement system
- iOS (SwiftUI)
- Minimum iOS version: iOS 17+
- SwiftUI for declarative UI
- SwiftData for local data persistence
- MVVM (Model-View-ViewModel) architecture
- App Groups for widget data sharing
- SwiftData: Core data persistence layer for all models
- Charts: Native chart framework for analytics visualization
- WidgetKit: Home screen widget implementation
- App Intents: Widget interactivity and deep linking
- ActivityKit: Support for Live Activities
- Observation Framework: State management with @Observable
- Question & QuestionOption
- Flashcard with SM-2 spaced repetition
- User & UserBadge
- ActivityDay for heatmap tracking
- Attempt for practice session history
- ChatMessage for AI conversations
- Cached models for offline support
MasterLaw/
├── Models/ # SwiftData models
├── Views/ # SwiftUI views
│ ├── Auth/ # Login and authentication
│ ├── Practice/ # Question practice interface
│ ├── Flashcard/ # Flashcard study interface
│ ├── Analytics/ # Charts and statistics
│ ├── Profile/ # User profile and settings
│ └── Components/ # Reusable UI components
├── ViewModels/ # Business logic and state management
├── Services/ # API calls and data services
├── Utilities/ # Helper functions and extensions
├── Config.swift # App configuration and constants
└── MasterLawApp.swift # App entry point
MasterLawWidget/ # Widget extension target
├── MasterLawWidget.swift # Widget definitions
├── AppIntent.swift # Widget interactions
└── WidgetDataManager.swift # Data sharing with main app
- Xcode 15.0 or later
- iOS 17.0 SDK or later
- Apple Developer account (for device testing and App Groups)
-
Clone the repository
-
Open
MasterLaw.xcodeprojin Xcode -
Configure App Groups:
- Select the MasterLaw target
- Go to Signing & Capabilities
- Add App Groups capability
- Enable
group.com.masterlaw.shared - Repeat for MasterLawWidget target
-
Update API endpoint in
Config.swift:static let baseURL = "YOUR_API_BASE_URL"
-
Build and run on simulator or device
The app uses the SM-2 algorithm to schedule flashcard reviews:
- Cards are shown at increasing intervals based on recall difficulty
- Quality ratings from 0-5 determine next review date
- Optimizes long-term retention with minimal review time
The app supports custom URL schemes for widget and notification actions:
masterlaw://practice- Open practice modemasterlaw://flashcard- Open flashcard listmasterlaw://flashcard/[id]- Open specific flashcardmasterlaw://analytics- Open analytics viewmasterlaw://random- Start random question
- Automatic session tracking when app becomes active/inactive
- Heatmap visualization similar to GitHub contributions
- Tracks study time and question attempts
- Weekly and monthly activity summaries
All data is stored locally using SwiftData with automatic iCloud sync support through CloudKit. The app maintains cached copies of essential data for offline access.
Widget and main app share data through App Groups (group.com.masterlaw.shared), allowing the widget to display up-to-date information without launching the main app.
The app uses token-based authentication:
- Login with username and password
- JWT token stored securely in Keychain
- Automatic token refresh
- Logout clears all cached credentials
Potential areas for expansion:
- iPad multi-window support
- Apple Pencil annotation support
- Study group collaboration features
- Advanced AI tutoring with GPT-4
- Audio explanations for questions
- Dark mode customization
This project is proprietary software for law examination preparation.
For issues or questions, please open an issue in this repository.