Tag Model
Definition
struct Tag: Identifiable, Codable, Sendable {
let id: UUID
var name: String
var color: String // Hex color "#RRGGBB"
var isArchived: Bool // Hidden from selection when true
let createdAt: Date
} Properties
| Property | Type | Description |
|---|---|---|
id | UUID | Unique identifier |
name | String | Display name (must not be empty) |
color | String | Hex color code “#RRGGBB” |
isArchived | Bool | When true, tag is hidden from selection UI |
createdAt | Date | Creation timestamp |
Archiving
Archived tags:
- Hidden from tag selection dropdowns (new timer, edit record)
- Shown greyed out in History tag filter
- Can be unarchived via swipe action in Settings
- Existing records with archived tags still display the tag
JSON Format
{
"id": "uuid-string",
"name": "Work",
"color": "#FF5733",
"isArchived": false,
"createdAt": "2024-01-01T00:00:00Z"
} Note: isArchived defaults to false if not present (backward compatibility).
Storage
Tags stored in tags.json as array wrapper:
{
"tags": [...]
} Validation
- Name must not be empty or whitespace-only
- Throws
TagError.emptyNameon validation failure
func validateName() throws {
guard !name.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty else {
throw TagError.emptyName
}
} Related
Data
- 202-time-record - Records reference tags via tagId
- 204-color-palette - Color generation from tag names
Services
- 301-file-storage - CRUD operations
- 303-time-tracking - Tag lifecycle (create, archive, delete)
UI
- 409-tag-filter - Tag filter buttons with context menu
- 406-record-editor - Tag selection in editor
- 405-settings-sheet - Tag management list
Reports
- 306-report - Tag aggregation for charts
- 308-stacked-chart - Tag-colored segments