create contentview view model

add background to content view
make contentview list split by year / month
test data will add 120 days instead of 25

closed #35
closed #36
This commit is contained in:
Trey t
2022-01-20 16:12:49 -06:00
parent d0842d14d7
commit 55bcb460ba
7 changed files with 350 additions and 100 deletions

View File

@@ -10,6 +10,8 @@ import SwiftUI
struct SettingsView: View {
@Environment(\.dismiss) var dismiss
let editedDataClosure: (() -> Void)
@AppStorage("notificationDate") private var notificationDate = Date() {
didSet {
if self.showReminder {
@@ -94,6 +96,7 @@ struct SettingsView: View {
Color(UIColor.systemBackground)
Button(action: {
PersistenceController.shared.populateTestData()
editedDataClosure()
}, label: {
Text("Add test data")
})
@@ -108,6 +111,7 @@ struct SettingsView: View {
Color(UIColor.systemBackground)
Button(action: {
PersistenceController.shared.clearDB()
editedDataClosure()
}, label: {
Text("Clear DB")
})
@@ -195,9 +199,13 @@ struct SettingsView: View {
struct SettingsView_Previews: PreviewProvider {
static var previews: some View {
SettingsView()
SettingsView(editedDataClosure: {
})
SettingsView()
SettingsView(editedDataClosure: {
})
.preferredColorScheme(.dark)
}
}