A SwiftUI-based iOS application that helps users manage and clean up their Gmail inbox efficiently. The app focuses on identifying and managing large emails to free up space.
- 📧 Smart email categorization (Social, Promotions, Newsletters, Personal)
- 📊 Storage usage visualization
- 🗑️ Batch email deletion
- 📱 Modern SwiftUI interface
- 🔄 Efficient pagination for email loading
- 📦 Optimized for large inboxes
- iOS 15.0+
- Xcode 13.0+
- Swift 5.5+
- Google Cloud Platform account
- Gmail API enabled
- Valid OAuth 2.0 Client ID
-
Google Cloud Platform Setup
- Create a new project in Google Cloud Console
- Enable Gmail API
- Configure OAuth consent screen
- Create OAuth 2.0 Client ID
- Add required scopes:
https://mail.google.com/https://www.googleapis.com/auth/gmail.modifyhttps://www.googleapis.com/auth/gmail.readonlyhttps://www.googleapis.com/auth/gmail.labelshttps://www.googleapis.com/auth/gmail.metadata
-
Project Configuration
- Clone the repository
- Open
Info.plist - Update
GIDClientIDwith your OAuth Client ID - Update URL schemes with your reversed client ID
-
Dependencies
dependencies: [ .package(url: "https://github.com/google/GoogleSignIn-iOS", from: "7.0.0"), .package(url: "https://github.com/google/google-api-objectivec-client-for-rest", from: "3.0.0") ]
The project follows the MVVM (Model-View-ViewModel) architecture pattern:
Email: Core data model representing email informationEmailCategory: Email classification enum
ContentView: Main app view with authentication and dashboardEmailManagerView: Email list and management interfaceCleanupView: Bulk email cleanup interface
GoogleAuthViewModel: Handles authentication stateEmailManagerViewModel: Manages email data and operations
GoogleAuthService: Manages Google Sign-InEmailService: Handles Gmail API interactions
The core service handling Gmail API interactions with optimized features:
- Paginated email fetching
- Minimal data retrieval for better performance
- Batch processing for API calls
- Efficient memory management
Uses Google Sign-In for iOS with:
- Secure OAuth 2.0 flow
- Token management
- Automatic token refresh
-
Pagination
- Small page size (50 emails per page)
- On-demand loading
- Memory-efficient processing
-
Minimal Data Fetching
- Only essential metadata retrieval
- Batch processing in groups of 10
- Optimized network calls
-
Memory Management
- Capacity reservation for collections
- Efficient batch processing
- Resource cleanup
// Initialize email manager
let emailManager = EmailManagerViewModel()
// Fetch first page of emails
await emailManager.fetchNextPage()
// Delete emails
await emailManager.deleteEmails(from: "sender@example.com")-
Error Handling
- Comprehensive error messages
- User-friendly error displays
- Graceful fallbacks
-
UI/UX
- Loading indicators
- Pull-to-refresh
- Smooth animations
- Clear feedback
-
Security
- Secure token storage
- OAuth best practices
- Data privacy
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Google Gmail API
- GoogleSignIn-iOS
- SwiftUI framework