Trivit is a tally counter app built with SwiftUI and SwiftData. The app has been fully modernized from Objective-C/UIKit to Swift/SwiftUI.
trivit-ios/
├── trivit/ # Main iOS app
│ ├── TrivitApp.swift # App entry point (@main)
│ ├── Models/
│ │ └── Trivit.swift # SwiftData model
│ ├── Views/
│ │ ├── TrivitListView.swift # Main list screen
│ │ ├── TrivitRowView.swift # Individual counter row
│ │ └── SettingsView.swift # Settings screen
│ ├── Services/
│ │ └── HapticsService.swift # Haptic feedback
│ ├── Repositories/
│ │ └── TrivitRepository.swift # Data access layer
│ ├── Theme/
│ │ └── TrivitColors.swift # Color palette
│ └── Utilities/
│ └── EasterEggs.swift # Fun messages
│
├── trivit Watch App/ # watchOS companion app
│ ├── TrivitWatchApp.swift
│ ├── Views/
│ │ ├── ContentView.swift
│ │ ├── TrivitRowView.swift
│ │ └── TrivitDetailView.swift
│ └── Services/
│ └── SyncService.swift
│
└── DataKit/ # Shared framework (legacy, to be removed)
| Component | Technology |
|---|---|
| UI Framework | SwiftUI |
| Data Persistence | SwiftData |
| Minimum iOS | 17.0 |
| Minimum watchOS | 10.0 |
| Language | Swift 5.0 |
@Model
final class Trivit {
var id: UUID
var title: String
var count: Int
var colorIndex: Int
var isCollapsed: Bool
var createdAt: Date
}- Uses
@mainattribute onTrivitApp - No AppDelegate or UIApplicationDelegate
- Scene-based with
WindowGroup
- Model container configured in App
@Queryfor fetching data in views@Bindablefor two-way binding
- Views are mostly self-contained
@Queryreplaces traditional ViewModels for data- Services handle cross-cutting concerns
- Singleton
HapticsServicefor consistent haptics - Light impact on increment/decrement
- Warning notification on reset/delete
10 vibrant flat colors defined in TrivitColors:
- Turquoise (#1ABC9C)
- Emerald (#2ECC71)
- Peter River (#3498DB)
- Amethyst (#9B59B6)
- Alizarin (#E74C3C)
- Orange (#F39C12)
- Pink (#E91E63)
- Cyan (#00BCD4)
- Light Green (#8BC34A)
- Deep Orange (#FF5722)
For iOS ↔ watchOS data sync:
-
App Groups: Both apps need shared container
- Group identifier:
group.com.wouterdevriendt.trivit - Model container should use shared URL
- Group identifier:
-
WatchConnectivity: Real-time sync
WCSessionfor immediate updates- Background context transfer
- iOS:
com.wouterdevriendt.trivit - watchOS:
com.wouterdevriendt.trivit.watchkitapp
- Team: N324UX8D9M
- Development: Automatic signing
- Distribution: Manual with certificates
None - Pure Apple frameworks only:
- SwiftUI
- SwiftData
- WatchConnectivity
- Unit Tests: Model logic, repository operations
- UI Tests: Main user flows (add, increment, delete)
- Integration Tests: SwiftData persistence
- CloudKit sync for multi-device
- Widget support (WidgetKit)
- Siri Shortcuts integration
- iPad layout optimization
- Apple Watch complications