Easy Task

Technical Documentation & User Guide

User Guide

Overview

Easy Task is your personal assistant for managing deadlines, meetings, and invoices. It helps you stay organized with visual countdowns and professional tools.

Key Features

  • Deadline Management: Visual countdowns, progress gauges, and overlap protection to avoid double-booking.
  • Invoicing: Create professional invoices, manage items with different prices, and share them via Email or PDF.
  • Focus Mode: A dedicated timer view to help you concentrate on the task at hand.
  • Google Integration: Sync reminders with your Google Calendar.

Technical Documentation

Architecture (MVVM)

The app follows the Model-View-ViewModel pattern using SwiftUI.

  • Models: Define data structures (Deadline, Invoice).
  • Views: Display the UI and observe Managers (HomeView, InvoiceDetailView).
  • Managers (ViewModels): Handle business logic and data persistence (DeadlineManager, InvoiceManager).

Data Persistence

Local (UserDefaults) Used for Invoices and Deadlines. Simple JSON encoding.

Cloud (Firebase) Used for User Profiles and Premium Subscription status.

Example: Invoice Persistence (Local)

private func saveInvoices() {
    invoices.sort { $0.createdAt > $1.createdAt }
    if let encoded = try? JSONEncoder().encode(invoices) {
        UserDefaults.standard.set(encoded, forKey: userDefaultsKey)
    }
}

Example: User Persistence (Firestore)

func saveUserToFirestore(_ user: User) async throws {
    let userDict = user.toDictionary()
    try await db.collection("users").document(user.id).setData(userDict, merge: true)
}

Key Logic Examples

Overlap Prevention (DeadlineManager)

Prevents users from scheduling two tasks at the same time.

func checkForOverlap(startDate: Date, duration: TimeInterval) -> Bool {
    let newEnd = startDate.addingTimeInterval(duration)
    for deadline in deadlines {
        // Checking intersection: (StartA < EndB) && (EndA > StartB)
        let taskEnd = deadline.date.addingTimeInterval(deadline.duration)
        if startDate < taskEnd && newEnd > deadline.date {
            return true
        }
    }
    return false
}

PDF Generation (InvoiceManager)

Uses `UIGraphicsPDFRenderer` to draw invoices programmatically.

let renderer = UIGraphicsPDFRenderer(bounds: pageRect, format: format)
let data = renderer.pdfData { (context) in
    context.beginPage()
    // Drawing Title
    "FACTURE".draw(at: CGPoint(x: 40, y: 40), withAttributes: titleAttributes)
    // Drawing Items...
}

Need Help or Have an Idea?

Do you want support getting started with the assistant?

Do you have an app idea and want to discuss it?

Do you want to learn how to build iOS mobile apps?

Contact me via this contact form:
https://yann-dipita.com/#contact

Vlog: Building of Easy Task

Discover the behind-the-scenes of creating Easy Task. A challenge: 1 Month to set up your assistant.