Refactored image in TrashEvent

This commit is contained in:
2024-01-13 00:07:14 +01:00
parent f153b26d2d
commit 01381f9f25
8 changed files with 154 additions and 77 deletions

View File

@@ -11,7 +11,7 @@ import SwiftUI
struct Trash {
var type: String
var color: Color
var image: Image
var image: String
}
struct TrashEvent: Identifiable {
@@ -21,15 +21,15 @@ struct TrashEvent: Identifiable {
}
struct TrashModel {
var trashTypes: [Trash]
var trashEvents: [TrashEvent]
private (set) var trashTypes: [Trash]
private var trashEvents: [TrashEvent]
init() {
self.trashTypes = [
Trash(type: "plastic", color: Color.orange, image: Image(systemName: "waterbottle")),
Trash(type: "paper", color: Color.orange, image: Image(systemName: "newspaper")),
Trash(type: "bio", color: Color.orange, image: Image(systemName: "tree")),
Trash(type: "residual", color: Color.orange, image: Image(systemName: "trash"))
Trash(type: "plastic", color: Color.orange, image: "waterbottle"),
Trash(type: "paper", color: Color.orange, image: "newspaper"),
Trash(type: "bio", color: Color.orange, image: "tree"),
Trash(type: "residual", color: Color.orange, image: "trash")
]
self.trashEvents = []
@@ -69,7 +69,7 @@ struct TrashModel {
TrashEvent(
id: i + 6 + 7,
trash: self.trashTypes[3],
date: Calendar.current.date(byAdding: .day, value: 6 + 7 + 7*i, to: Date())!
date: Calendar.current.date(byAdding: .day, value: 6 + 7 + 7*i, to: Date())!
)
)
}