-
1. Create SwiftData models
- Task model:
text: String,isComplete: Bool,focusArea: FocusArea,sortOrder: Int,createdAt: Date,week: Week- Note:
createdAttracks when task was originally created (useful for carry-over tracking and debugging) - Note:
weekis non-optional - tasks must belong to a week - Note: Task text is stored exactly as provided by user (including empty strings and whitespace)
- Note:
- Week model:
startDate: Date,tasks: [Task] - FocusArea enum:
.life,.work
- Task model:
-
2. Create unit tests for data models
- Test adding/removing tasks updates
week.tasks - Test week creation with Monday start date
- Test task sorting by
sortOrderdescending
- Test adding/removing tasks updates
-
3. Add app launch logic
- Check if Week exists for current week (Monday-based)
- Create Week if needed
IMPORTANT: For ALL Phase 2 tasks, consult the mockups in mocks/ directory to ensure UI implementation matches the designs as closely as possible. Key mockups:
-
main-screen.png - LIFE focus area selected
-
work-selected-main-screen.png - WORK focus area selected
-
add-new-task.png - Add task sheet
-
4. Build WeekHeaderView
- Display "Week of [date]" with date formatting (format: "MMM d" without year)
- Takes Date parameter (expects Monday start date)
- Left-aligned text
- Note: Always pass Monday date using
Week.getCurrentWeekStart(), not current date
-
5. Add WeekHeaderView to main screen for testing
- Replace ContentView with basic layout
- Add WeekHeaderView with Monday date (
Week.getCurrentWeekStart()) - Verify rendering and left alignment
-
6. Build CreateTaskButton
- Gray pill button with "+ Create task" text
- Takes action closure for tap handling
-
7. Add CreateTaskButton to main screen for testing
- Add below WeekHeaderView
- Hook up tap action (prints to console)
- Verify button appearance and tap
-
8. Build TaskRowView
- Checkbox (empty square) + task text
- Tap checkbox to toggle
isCompleteon binding - Takes Task binding
-
9. Add TaskRowView to main screen with mock data
- Create struct for mock Task data (not SwiftData yet)
- Display 2-3 TaskRows with sample text
- Add @State for mock completion toggling
- Verify checkbox interaction
-
10. Build FocusAreaToggle
- "LIFE / WORK" side-by-side buttons
- Blue text for active, black for inactive
- Takes binding to FocusArea selection
-
11. Add FocusAreaToggle to main screen for testing
- Add below WeekHeaderView, above tasks
- Wire to @State variable
- Verify toggle switches and colors update
- Added filtering logic: tasks filtered by selectedFocusArea
-
12. Build TaskListView
- Scrollable List of TaskRows
- Accepts array of tasks + focusArea filter
- Sorted by
sortOrderdescending (highest first) .onMovemodifier for drag-to-reorder- CreateTaskButton at bottom (or as empty state)
- Note: TaskViewModel made Identifiable with stable UUID for smooth drag-to-reorder
- Note: Added
.environment(\.editMode, .constant(.active))to enable drag handles
-
13. Add TaskListView to main screen with mock data
- Replace current VStack with TaskListView component
- Add
.onMovemodifier for drag-to-reorder - Verify drag-to-reorder updates visual order
- Verify empty state shows button
- Note: handleMove() recalculates sortOrder values after reordering
-
13.5. Move UUID to Task model for stable identity
- Added
id: UUIDproperty to Task model - Made Task conform to Identifiable protocol
- Initialize UUID in Task initializer with
self.id = UUID() - Removed TaskViewModel struct - use Task model directly everywhere
- Updated TaskRowView, TaskListView, and ContentView to use Task instead of TaskViewModel
- Benefits: Eliminates redundancy, ensures UUID persistence with SwiftData, simpler architecture
- Added
-
14. Build AddTaskSheet
- Bottom sheet modal with rounded container
- TextField with auto-focus (
.focusedmodifier) - Blue circular "+" button (right-aligned)
- On submit: clear text field, dismiss sheet
- Swipe down or tap outside to dismiss
- Note: Sheet accepts optional Task parameter (nil for new task, Task for editing)
- Note: Integrated into ContentView with
.sheet()modifier and white background
-
15. Wire AddTaskSheet to CreateTaskButton for testing
- CreateTaskButton sets @State to show sheet
- Sheet presents with TextField focused
- Enter text and press "+" dismisses sheet
- Verify swipe-to-dismiss works
- Verify keyboard appears/dismisses correctly
- Note: Completed together with task 14 - sheet fully functional and tested
-
16. Set up data query and context in main view
- Add
@Queryfor current week's tasks - Add
@Environment(\.modelContext)for mutations - Replace WeekHeaderView hardcoded date with current week date
- Verify app launches with current week created
- Add
-
17. Wire TaskListView to SwiftData queries
- Replace mock tasks with filtered
@Queryresults - Filter by week at database level using FetchDescriptor + #Predicate (reduces memory footprint)
- Filter by
selectedFocusAreain-memory (smaller dataset, maintains dynamic behavior) - Sort by
sortOrderdescending via database query - Verify empty state when no tasks exist
- Note: Removed redundant filtering from TaskListView - now receives pre-filtered tasks from ContentView
- Note: Optimized for production - only loads current week's tasks from database
- Replace mock tasks with filtered
-
18. Implement task creation flow
- On AddTaskSheet submit:
- Calculate new sortOrder (find max sortOrder + 1, or 0 if no tasks)
- Create Task with text, current focusArea, new sortOrder, isComplete=false
- Insert into modelContext first, then set week relationship (to avoid SwiftData crash)
- Clear text field and dismiss sheet
- Add ScrollViewReader to TaskListView
- Scroll to top after task creation
- Test creating tasks in LIFE, then WORK, verify correct focus area
- Note: Fixed SwiftData crash by making Task.week optional and setting relationship after insert
- Note: Updated all Task initializations across tests and previews to use new pattern
- On AddTaskSheet submit:
-
19. Implement task completion toggle
- Wire TaskRowView checkbox to update Task.isComplete in SwiftData
- Verify changes persist
- Test toggling multiple tasks
- Note: Added modelContext environment to TaskRowView for explicit save on toggle
- Note: Uses assertionFailure for error handling to allow app to continue gracefully
-
20. Implement drag-to-reorder with sortOrder updates
- On
.onMove:- Reorder tasks array
- Recalculate sortOrder values (highest to lowest)
- Update each task's sortOrder in modelContext
- Test reordering within LIFE and WORK separately
- Verify order persists after app restart
- Note: Implemented version-specific sheet padding for iOS 17/18 vs iOS 26 compatibility
- On
-
21. End-to-end manual testing
- Create multiple tasks in LIFE focus area
- Switch to WORK, create multiple tasks there
- Toggle between LIFE/WORK, verify correct tasks shown
- Reorder tasks in each focus area independently
- Complete/uncomplete tasks, verify persistence
- Test empty state (delete all tasks in one area)
- Test sheet behaviors: swipe dismiss, tap outside, submit
- Test focus area switching while sheet is open
- Restart app, verify all data persists
-
22. UI polish to match mockups
- Verify colors: blue for active toggle, gray button, blue circular +
- Check spacing between components
- Ensure checkbox styling matches mockup
- Test smooth animations (sheet, keyboard, scroll)
- Test on multiple iPhone simulator sizes (SE, 14, Pro Max)
- Test in both light and dark mode (verify system colors adapt properly)
-
23. iPad compatibility testing
- Build and run on iPad simulator (iPad Pro 13-inch or iPad Air)
- End-to-end manual testing (from Task #21):
- Create multiple tasks in LIFE focus area
- Switch to WORK, create multiple tasks there
- Toggle between LIFE/WORK, verify correct tasks shown
- Reorder tasks in each focus area independently
- Complete/uncomplete tasks, verify persistence
- Test empty state (delete all tasks in one area)
- Test sheet behaviors: swipe dismiss, tap outside, submit
- Test focus area switching while sheet is open
- Restart app, verify all data persists
- UI polish verification (from Task #22):
- Verify colors: blue for active toggle, gray button, blue circular +
- Check spacing between components
- Ensure checkbox styling matches mockup
- Test smooth animations (sheet, keyboard, scroll)
- Test in both light and dark mode (verify system colors adapt properly)
- iPad-specific testing:
- Verify layout scales appropriately on larger screen
- Check that UI doesn't look stretched or awkward
- Test both portrait and landscape orientations
- Test split screen mode (1/2, 1/3, 2/3 split)
- Test slide over mode with another app
- Verify keyboard behavior and sheet presentation on iPad
- Take screenshots for documentation
- New tasks: Find
max(sortOrder)of existing tasks in that focus area, add 1 (or use 0 if no tasks) - Display order: Sort by
sortOrderDESC (highest first) - Drag-to-reorder: After reorder, recalculate sortOrder as: N-1, N-2, N-3... (where N is count)
- Pros: Simple, predictable, no floating point issues
- Cons: Requires updating all tasks on reorder (acceptable for prototype)
@Query(filter: #Predicate<Task> { task in
task.focusArea == selectedFocusArea
}, sort: \Task.sortOrder, order: .reverse)
var tasks: [Task]let calendar = Calendar.current
let monday = calendar.dateComponents([.yearForWeekOfYear, .weekOfYear], from: Date())
let weekStart = calendar.date(from: monday)!ScrollViewReader { proxy in
List {
// tasks
}
.onChange(of: taskCount) {
proxy.scrollTo(topTaskId, anchor: .top)
}
}- Issue: SwiftUI's List +
.onMovecan be temperamental with custom data models - Mitigation: Test frequently during step 13, adjust approach if needed
- Fallback: If too buggy, defer reordering to future iteration
- Issue: Keyboard covering content, scroll position jumping, sheet dismiss timing
- Mitigation: Test step 15 thoroughly, use
.ignoresSafeArea(.keyboard)if needed - Edge cases to watch:
- Keyboard dismisses but sheet stays open
- Scroll position jumps when keyboard appears
- Sheet doesn't dismiss on swipe with keyboard open
- Issue: User toggles LIFE/WORK while AddTaskSheet is visible
- Expected behavior: Sheet stays open, new task goes to newly selected area
- Mitigation: Test explicitly in step 21, verify focusArea binding reads latest value
- Issue: CreateTaskButton positioning might look odd when no tasks exist
- Mitigation: Test in step 13 with empty mock array, adjust layout if needed
- Issue: What if multiple tasks have same sortOrder? What if sortOrder overflows Int.max?
- Mitigation: For prototype, assume normal usage (<1000 tasks). Document for future
- Edge case to test: Create task, reorder, create another task - verify correct ordering
- Issue: App launch might be slow if week creation happens on main thread
- Mitigation: Test in step 16, verify smooth launch. Move to background if needed
- Implement data migration strategy: Currently no versioning or migration scheme in place. Before adding task state transitions, carry-over features, or other model changes, implement SwiftData lightweight migrations to prevent breaking existing user data. Address before production release.