-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- date and time picker - priority picker - display due date in list row, if present This closes #71, closes #72 Signed-off-by: Peter Friese <[email protected]>
- Loading branch information
1 parent
ccc55d4
commit 9c4eff7
Showing
7 changed files
with
320 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
.../frontend/MakeItSo/Shared/Features/ReminderList/ViewModels/ReminderListRowViewModel.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// | ||
// ReminderListRowViewModel.swift | ||
// MakeItSo | ||
// | ||
// Created by Peter Friese on 30.11.21. | ||
// Copyright © 2021 Google LLC. All rights reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http:https://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
import SwiftUI | ||
|
||
class ReminderListRowViewModel: ObservableObject { | ||
@Binding var reminder: Reminder | ||
|
||
init(reminder: Binding<Reminder>) { | ||
self._reminder = reminder | ||
} | ||
|
||
var priorityAdornment: String { | ||
String(repeating: "!", count: (reminder.priority.index ?? 0)) | ||
} | ||
|
||
var hasDueDate: Bool { | ||
reminder.dueDate != nil | ||
} | ||
|
||
var hasDueTime: Bool { | ||
reminder.hasDueTime | ||
} | ||
|
||
var dueDate: Date { | ||
reminder.dueDate ?? Date() | ||
} | ||
|
||
var formattedDueDate: String { | ||
guard let dueDate = reminder.dueDate else { return "" } | ||
return dueDate.formattedRelativeToday() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.