Refactored image in TrashEvent
This commit is contained in:
@@ -8,17 +8,28 @@
|
|||||||
|
|
||||||
/* Begin PBXBuildFile section */
|
/* Begin PBXBuildFile section */
|
||||||
6C264F9D2B51A22F002CBE12 /* TrashTrackApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6C264F9C2B51A22F002CBE12 /* TrashTrackApp.swift */; };
|
6C264F9D2B51A22F002CBE12 /* TrashTrackApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6C264F9C2B51A22F002CBE12 /* TrashTrackApp.swift */; };
|
||||||
6C264F9F2B51A22F002CBE12 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6C264F9E2B51A22F002CBE12 /* ContentView.swift */; };
|
6C264F9F2B51A22F002CBE12 /* MainView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6C264F9E2B51A22F002CBE12 /* MainView.swift */; };
|
||||||
6C264FA12B51A230002CBE12 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6C264FA02B51A230002CBE12 /* Assets.xcassets */; };
|
6C264FA12B51A230002CBE12 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6C264FA02B51A230002CBE12 /* Assets.xcassets */; };
|
||||||
6C264FA42B51A230002CBE12 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6C264FA32B51A230002CBE12 /* Preview Assets.xcassets */; };
|
6C264FA42B51A230002CBE12 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6C264FA32B51A230002CBE12 /* Preview Assets.xcassets */; };
|
||||||
|
6C264FAB2B51A255002CBE12 /* TrashModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6C264FAA2B51A255002CBE12 /* TrashModel.swift */; };
|
||||||
|
6C264FAD2B51A26F002CBE12 /* TrashModelView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6C264FAC2B51A26F002CBE12 /* TrashModelView.swift */; };
|
||||||
|
6C264FB02B51D58C002CBE12 /* ElegantCalendar in Frameworks */ = {isa = PBXBuildFile; productRef = 6C264FAF2B51D58C002CBE12 /* ElegantCalendar */; };
|
||||||
|
6C264FB22B51D59B002CBE12 /* CalendarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6C264FB12B51D59B002CBE12 /* CalendarView.swift */; };
|
||||||
|
6C264FB42B51DA90002CBE12 /* ElegantCalendar.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6C264FB32B51DA90002CBE12 /* ElegantCalendar.xcassets */; };
|
||||||
|
6C264FB62B51EFDB002CBE12 /* DayView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6C264FB52B51EFDB002CBE12 /* DayView.swift */; };
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
/* Begin PBXFileReference section */
|
/* Begin PBXFileReference section */
|
||||||
6C264F992B51A22F002CBE12 /* TrashTrack.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TrashTrack.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
6C264F992B51A22F002CBE12 /* TrashTrack.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TrashTrack.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
6C264F9C2B51A22F002CBE12 /* TrashTrackApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TrashTrackApp.swift; sourceTree = "<group>"; };
|
6C264F9C2B51A22F002CBE12 /* TrashTrackApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TrashTrackApp.swift; sourceTree = "<group>"; };
|
||||||
6C264F9E2B51A22F002CBE12 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
|
6C264F9E2B51A22F002CBE12 /* MainView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainView.swift; sourceTree = "<group>"; };
|
||||||
6C264FA02B51A230002CBE12 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
6C264FA02B51A230002CBE12 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||||
6C264FA32B51A230002CBE12 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
|
6C264FA32B51A230002CBE12 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
|
||||||
|
6C264FAA2B51A255002CBE12 /* TrashModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TrashModel.swift; sourceTree = "<group>"; };
|
||||||
|
6C264FAC2B51A26F002CBE12 /* TrashModelView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TrashModelView.swift; sourceTree = "<group>"; };
|
||||||
|
6C264FB12B51D59B002CBE12 /* CalendarView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CalendarView.swift; sourceTree = "<group>"; };
|
||||||
|
6C264FB32B51DA90002CBE12 /* ElegantCalendar.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = ElegantCalendar.xcassets; path = "../../../SourcePackages/checkouts/ElegantCalendar?tab=readme-ov-file#basic-usage/ElegantCalendar.xcassets"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
|
6C264FB52B51EFDB002CBE12 /* DayView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DayView.swift; sourceTree = "<group>"; };
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
/* Begin PBXFrameworksBuildPhase section */
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
@@ -26,6 +37,7 @@
|
|||||||
isa = PBXFrameworksBuildPhase;
|
isa = PBXFrameworksBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
|
6C264FB02B51D58C002CBE12 /* ElegantCalendar in Frameworks */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
@@ -52,7 +64,12 @@
|
|||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
6C264F9C2B51A22F002CBE12 /* TrashTrackApp.swift */,
|
6C264F9C2B51A22F002CBE12 /* TrashTrackApp.swift */,
|
||||||
6C264F9E2B51A22F002CBE12 /* ContentView.swift */,
|
6C264FB52B51EFDB002CBE12 /* DayView.swift */,
|
||||||
|
6C264F9E2B51A22F002CBE12 /* MainView.swift */,
|
||||||
|
6C264FB12B51D59B002CBE12 /* CalendarView.swift */,
|
||||||
|
6C264FAA2B51A255002CBE12 /* TrashModel.swift */,
|
||||||
|
6C264FB32B51DA90002CBE12 /* ElegantCalendar.xcassets */,
|
||||||
|
6C264FAC2B51A26F002CBE12 /* TrashModelView.swift */,
|
||||||
6C264FA02B51A230002CBE12 /* Assets.xcassets */,
|
6C264FA02B51A230002CBE12 /* Assets.xcassets */,
|
||||||
6C264FA22B51A230002CBE12 /* Preview Content */,
|
6C264FA22B51A230002CBE12 /* Preview Content */,
|
||||||
);
|
);
|
||||||
@@ -83,6 +100,9 @@
|
|||||||
dependencies = (
|
dependencies = (
|
||||||
);
|
);
|
||||||
name = TrashTrack;
|
name = TrashTrack;
|
||||||
|
packageProductDependencies = (
|
||||||
|
6C264FAF2B51D58C002CBE12 /* ElegantCalendar */,
|
||||||
|
);
|
||||||
productName = TrashTrack;
|
productName = TrashTrack;
|
||||||
productReference = 6C264F992B51A22F002CBE12 /* TrashTrack.app */;
|
productReference = 6C264F992B51A22F002CBE12 /* TrashTrack.app */;
|
||||||
productType = "com.apple.product-type.application";
|
productType = "com.apple.product-type.application";
|
||||||
@@ -111,6 +131,9 @@
|
|||||||
Base,
|
Base,
|
||||||
);
|
);
|
||||||
mainGroup = 6C264F902B51A22F002CBE12;
|
mainGroup = 6C264F902B51A22F002CBE12;
|
||||||
|
packageReferences = (
|
||||||
|
6C264FAE2B51D58C002CBE12 /* XCRemoteSwiftPackageReference "ElegantCalendar" */,
|
||||||
|
);
|
||||||
productRefGroup = 6C264F9A2B51A22F002CBE12 /* Products */;
|
productRefGroup = 6C264F9A2B51A22F002CBE12 /* Products */;
|
||||||
projectDirPath = "";
|
projectDirPath = "";
|
||||||
projectRoot = "";
|
projectRoot = "";
|
||||||
@@ -125,6 +148,7 @@
|
|||||||
isa = PBXResourcesBuildPhase;
|
isa = PBXResourcesBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
|
6C264FB42B51DA90002CBE12 /* ElegantCalendar.xcassets in Resources */,
|
||||||
6C264FA42B51A230002CBE12 /* Preview Assets.xcassets in Resources */,
|
6C264FA42B51A230002CBE12 /* Preview Assets.xcassets in Resources */,
|
||||||
6C264FA12B51A230002CBE12 /* Assets.xcassets in Resources */,
|
6C264FA12B51A230002CBE12 /* Assets.xcassets in Resources */,
|
||||||
);
|
);
|
||||||
@@ -137,7 +161,11 @@
|
|||||||
isa = PBXSourcesBuildPhase;
|
isa = PBXSourcesBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
6C264F9F2B51A22F002CBE12 /* ContentView.swift in Sources */,
|
6C264FB22B51D59B002CBE12 /* CalendarView.swift in Sources */,
|
||||||
|
6C264FB62B51EFDB002CBE12 /* DayView.swift in Sources */,
|
||||||
|
6C264F9F2B51A22F002CBE12 /* MainView.swift in Sources */,
|
||||||
|
6C264FAD2B51A26F002CBE12 /* TrashModelView.swift in Sources */,
|
||||||
|
6C264FAB2B51A255002CBE12 /* TrashModel.swift in Sources */,
|
||||||
6C264F9D2B51A22F002CBE12 /* TrashTrackApp.swift in Sources */,
|
6C264F9D2B51A22F002CBE12 /* TrashTrackApp.swift in Sources */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
@@ -344,6 +372,25 @@
|
|||||||
defaultConfigurationName = Release;
|
defaultConfigurationName = Release;
|
||||||
};
|
};
|
||||||
/* End XCConfigurationList section */
|
/* End XCConfigurationList section */
|
||||||
|
|
||||||
|
/* Begin XCRemoteSwiftPackageReference section */
|
||||||
|
6C264FAE2B51D58C002CBE12 /* XCRemoteSwiftPackageReference "ElegantCalendar" */ = {
|
||||||
|
isa = XCRemoteSwiftPackageReference;
|
||||||
|
repositoryURL = "https://github.com/ThasianX/ElegantCalendar?tab=readme-ov-file#basic-usage";
|
||||||
|
requirement = {
|
||||||
|
kind = upToNextMajorVersion;
|
||||||
|
minimumVersion = 4.3.2;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
/* End XCRemoteSwiftPackageReference section */
|
||||||
|
|
||||||
|
/* Begin XCSwiftPackageProductDependency section */
|
||||||
|
6C264FAF2B51D58C002CBE12 /* ElegantCalendar */ = {
|
||||||
|
isa = XCSwiftPackageProductDependency;
|
||||||
|
package = 6C264FAE2B51D58C002CBE12 /* XCRemoteSwiftPackageReference "ElegantCalendar" */;
|
||||||
|
productName = ElegantCalendar;
|
||||||
|
};
|
||||||
|
/* End XCSwiftPackageProductDependency section */
|
||||||
};
|
};
|
||||||
rootObject = 6C264F912B51A22F002CBE12 /* Project object */;
|
rootObject = 6C264F912B51A22F002CBE12 /* Project object */;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"pins" : [
|
||||||
|
{
|
||||||
|
"identity" : "elegantcalendar?tab=readme-ov-file#basic-usage",
|
||||||
|
"kind" : "remoteSourceControl",
|
||||||
|
"location" : "https://github.com/ThasianX/ElegantCalendar?tab=readme-ov-file#basic-usage",
|
||||||
|
"state" : {
|
||||||
|
"revision" : "d446234f27e60f5bef15f91c35d384f388ff2c7d",
|
||||||
|
"version" : "4.3.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"identity" : "elegantpages",
|
||||||
|
"kind" : "remoteSourceControl",
|
||||||
|
"location" : "https://github.com/ThasianX/ElegantPages",
|
||||||
|
"state" : {
|
||||||
|
"revision" : "d598ce4824c40296decc84eae5b3c042d3dff842",
|
||||||
|
"version" : "1.4.2"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"version" : 2
|
||||||
|
}
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
//
|
|
||||||
// ContentView.swift
|
|
||||||
// TrashTrack
|
|
||||||
//
|
|
||||||
// Created by Oliver Hnát on 12.01.2024.
|
|
||||||
//
|
|
||||||
|
|
||||||
import SwiftUI
|
|
||||||
|
|
||||||
struct ContentView: View {
|
|
||||||
var body: some View {
|
|
||||||
VStack {
|
|
||||||
Image(systemName: "globe")
|
|
||||||
.imageScale(.large)
|
|
||||||
.foregroundStyle(.tint)
|
|
||||||
Text("Hello, world!")
|
|
||||||
}
|
|
||||||
.padding()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#Preview {
|
|
||||||
ContentView()
|
|
||||||
}
|
|
||||||
@@ -8,26 +8,25 @@
|
|||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
struct DayWidgetInfo {
|
struct DayWidgetInfo {
|
||||||
var image: Image
|
|
||||||
var dayOfTheWeek: String
|
|
||||||
var date: Int
|
|
||||||
var color: Color
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct DayView: View {
|
struct DayView: View {
|
||||||
var day: DayWidgetInfo
|
var image: String
|
||||||
|
var dayOfTheWeek: String
|
||||||
|
var date: Int
|
||||||
|
var color: Color
|
||||||
var body: some View {
|
var body: some View {
|
||||||
ZStack {
|
ZStack {
|
||||||
Color.init(day.color)
|
Color.init(color)
|
||||||
.cornerRadius(10)
|
.cornerRadius(10)
|
||||||
.scaledToFit()
|
.scaledToFit()
|
||||||
.frame(maxWidth: .infinity)
|
.frame(maxWidth: .infinity)
|
||||||
VStack {
|
VStack {
|
||||||
Text("\(day.dayOfTheWeek)")
|
Text("\(dayOfTheWeek)")
|
||||||
.frame(maxWidth: .infinity, alignment: .leading)
|
.frame(maxWidth: .infinity, alignment: .leading)
|
||||||
Text("\(day.date).")
|
Text("\(date).")
|
||||||
.font(.headline)
|
.font(.headline)
|
||||||
day.image
|
Image(systemName: image)
|
||||||
.font(.caption)
|
.font(.caption)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -37,44 +36,44 @@ struct DayView: View {
|
|||||||
#Preview {
|
#Preview {
|
||||||
VStack {
|
VStack {
|
||||||
HStack {
|
HStack {
|
||||||
DayView(day: DayWidgetInfo(image: Image(systemName: "tree"), dayOfTheWeek: "Mon", date: 31, color: .green))
|
DayView(image: "tree", dayOfTheWeek: "Mon", date: 31, color: .green)
|
||||||
DayView(day: DayWidgetInfo(image: Image(systemName: "newspaper"), dayOfTheWeek: "Tue", date: 31, color: .blue))
|
DayView(image: "newspaper", dayOfTheWeek: "Tue", date: 31, color: .blue)
|
||||||
DayView(day: DayWidgetInfo(image: Image(systemName: "waterbottle"), dayOfTheWeek: "Wed", date: 31, color: .orange))
|
DayView(image: "waterbottle", dayOfTheWeek: "Wed", date: 31, color: .orange)
|
||||||
DayView(day: DayWidgetInfo(image: Image(systemName: "trash"), dayOfTheWeek: "Thu", date: 31, color: .gray))
|
DayView(image: "trash", dayOfTheWeek: "Thu", date: 31, color: .gray)
|
||||||
DayView(day: DayWidgetInfo(image: Image(systemName: "tree"), dayOfTheWeek: "Mo", date: 31, color: .green))
|
DayView(image: "tree", dayOfTheWeek: "Mo", date: 31, color: .green)
|
||||||
DayView(day: DayWidgetInfo(image: Image(systemName: "tree"), dayOfTheWeek: "Mo", date: 31, color: .green))
|
DayView(image: "tree", dayOfTheWeek: "Mo", date: 31, color: .green)
|
||||||
}
|
}
|
||||||
HStack {
|
HStack {
|
||||||
DayView(day: DayWidgetInfo(image: Image(systemName: "tree"), dayOfTheWeek: "Mo", date: 31, color: .green))
|
DayView(image: "tree", dayOfTheWeek: "Mo", date: 31, color: .green)
|
||||||
DayView(day: DayWidgetInfo(image: Image(systemName: "tree"), dayOfTheWeek: "Mo", date: 31, color: .green))
|
DayView(image: "tree", dayOfTheWeek: "Mo", date: 31, color: .green)
|
||||||
DayView(day: DayWidgetInfo(image: Image(systemName: "tree"), dayOfTheWeek: "Mo", date: 31, color: .green))
|
DayView(image: "tree", dayOfTheWeek: "Mo", date: 31, color: .green)
|
||||||
DayView(day: DayWidgetInfo(image: Image(systemName: "tree"), dayOfTheWeek: "Mo", date: 31, color: .green))
|
DayView(image: "tree", dayOfTheWeek: "Mo", date: 31, color: .green)
|
||||||
DayView(day: DayWidgetInfo(image: Image(systemName: "tree"), dayOfTheWeek: "Mo", date: 31, color: .green))
|
DayView(image: "tree", dayOfTheWeek: "Mo", date: 31, color: .green)
|
||||||
DayView(day: DayWidgetInfo(image: Image(systemName: "tree"), dayOfTheWeek: "Mo", date: 31, color: .green))
|
DayView(image: "tree", dayOfTheWeek: "Mo", date: 31, color: .green)
|
||||||
}
|
}
|
||||||
HStack {
|
HStack {
|
||||||
DayView(day: DayWidgetInfo(image: Image(systemName: "tree"), dayOfTheWeek: "Mo", date: 31, color: .green))
|
DayView(image: "tree", dayOfTheWeek: "Mo", date: 31, color: .green)
|
||||||
DayView(day: DayWidgetInfo(image: Image(systemName: "tree"), dayOfTheWeek: "Mo", date: 31, color: .green))
|
DayView(image: "tree", dayOfTheWeek: "Mo", date: 31, color: .green)
|
||||||
DayView(day: DayWidgetInfo(image: Image(systemName: "tree"), dayOfTheWeek: "Mo", date: 31, color: .green))
|
DayView(image: "tree", dayOfTheWeek: "Mo", date: 31, color: .green)
|
||||||
DayView(day: DayWidgetInfo(image: Image(systemName: "tree"), dayOfTheWeek: "Mo", date: 31, color: .green))
|
DayView(image: "tree", dayOfTheWeek: "Mo", date: 31, color: .green)
|
||||||
DayView(day: DayWidgetInfo(image: Image(systemName: "tree"), dayOfTheWeek: "Mo", date: 31, color: .green))
|
DayView(image: "tree", dayOfTheWeek: "Mo", date: 31, color: .green)
|
||||||
DayView(day: DayWidgetInfo(image: Image(systemName: "tree"), dayOfTheWeek: "Mo", date: 31, color: .green))
|
DayView(image: "tree", dayOfTheWeek: "Mo", date: 31, color: .green)
|
||||||
}
|
}
|
||||||
HStack {
|
HStack {
|
||||||
DayView(day: DayWidgetInfo(image: Image(systemName: "tree"), dayOfTheWeek: "Mo", date: 31, color: .green))
|
DayView(image: "tree", dayOfTheWeek: "Mo", date: 31, color: .green)
|
||||||
DayView(day: DayWidgetInfo(image: Image(systemName: "tree"), dayOfTheWeek: "Mo", date: 31, color: .green))
|
DayView(image: "tree", dayOfTheWeek: "Mo", date: 31, color: .green)
|
||||||
DayView(day: DayWidgetInfo(image: Image(systemName: "tree"), dayOfTheWeek: "Mo", date: 31, color: .green))
|
DayView(image: "tree", dayOfTheWeek: "Mo", date: 31, color: .green)
|
||||||
DayView(day: DayWidgetInfo(image: Image(systemName: "tree"), dayOfTheWeek: "Mo", date: 31, color: .green))
|
DayView(image: "tree", dayOfTheWeek: "Mo", date: 31, color: .green)
|
||||||
DayView(day: DayWidgetInfo(image: Image(systemName: "tree"), dayOfTheWeek: "Mo", date: 31, color: .green))
|
DayView(image: "tree", dayOfTheWeek: "Mo", date: 31, color: .green)
|
||||||
DayView(day: DayWidgetInfo(image: Image(systemName: "tree"), dayOfTheWeek: "Mo", date: 31, color: .green))
|
DayView(image: "tree", dayOfTheWeek: "Mo", date: 31, color: .green)
|
||||||
}
|
}
|
||||||
HStack {
|
HStack {
|
||||||
DayView(day: DayWidgetInfo(image: Image(systemName: "tree"), dayOfTheWeek: "Mo", date: 31, color: .green))
|
DayView(image: "tree", dayOfTheWeek: "Mo", date: 31, color: .green)
|
||||||
DayView(day: DayWidgetInfo(image: Image(systemName: "tree"), dayOfTheWeek: "Mo", date: 31, color: .green))
|
DayView(image: "tree", dayOfTheWeek: "Mo", date: 31, color: .green)
|
||||||
DayView(day: DayWidgetInfo(image: Image(systemName: "tree"), dayOfTheWeek: "Mo", date: 31, color: .green))
|
DayView(image: "tree", dayOfTheWeek: "Mo", date: 31, color: .green)
|
||||||
DayView(day: DayWidgetInfo(image: Image(systemName: "tree"), dayOfTheWeek: "Mo", date: 31, color: .green))
|
DayView(image: "tree", dayOfTheWeek: "Mo", date: 31, color: .green)
|
||||||
DayView(day: DayWidgetInfo(image: Image(systemName: "tree"), dayOfTheWeek: "Mo", date: 31, color: .green))
|
DayView(image: "tree", dayOfTheWeek: "Mo", date: 31, color: .green)
|
||||||
DayView(day: DayWidgetInfo(image: Image(systemName: "tree"), dayOfTheWeek: "Mo", date: 31, color: .green))
|
DayView(image: "tree", dayOfTheWeek: "Mo", date: 31, color: .green)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
32
TrashTrack/MainView.swift
Normal file
32
TrashTrack/MainView.swift
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
//
|
||||||
|
// ContentView.swift
|
||||||
|
// TrashTrack
|
||||||
|
//
|
||||||
|
// Created by Oliver Hnát on 12.01.2024.
|
||||||
|
//
|
||||||
|
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
|
struct MainView: View {
|
||||||
|
var model = TrashModelView()
|
||||||
|
var body: some View {
|
||||||
|
VStack {
|
||||||
|
ForEach(model.getTrashEvents()) { trashEvent in
|
||||||
|
HStack {
|
||||||
|
Image(systemName: trashEvent.trash.image)
|
||||||
|
.imageScale(.large)
|
||||||
|
.foregroundStyle(.tint)
|
||||||
|
VStack {
|
||||||
|
Text(trashEvent.trash.type)
|
||||||
|
Text(trashEvent.date.ISO8601Format())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.padding()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#Preview {
|
||||||
|
MainView()
|
||||||
|
}
|
||||||
@@ -11,7 +11,7 @@ import SwiftUI
|
|||||||
struct Trash {
|
struct Trash {
|
||||||
var type: String
|
var type: String
|
||||||
var color: Color
|
var color: Color
|
||||||
var image: Image
|
var image: String
|
||||||
}
|
}
|
||||||
|
|
||||||
struct TrashEvent: Identifiable {
|
struct TrashEvent: Identifiable {
|
||||||
@@ -21,15 +21,15 @@ struct TrashEvent: Identifiable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct TrashModel {
|
struct TrashModel {
|
||||||
var trashTypes: [Trash]
|
private (set) var trashTypes: [Trash]
|
||||||
var trashEvents: [TrashEvent]
|
private var trashEvents: [TrashEvent]
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
self.trashTypes = [
|
self.trashTypes = [
|
||||||
Trash(type: "plastic", color: Color.orange, image: Image(systemName: "waterbottle")),
|
Trash(type: "plastic", color: Color.orange, image: "waterbottle"),
|
||||||
Trash(type: "paper", color: Color.orange, image: Image(systemName: "newspaper")),
|
Trash(type: "paper", color: Color.orange, image: "newspaper"),
|
||||||
Trash(type: "bio", color: Color.orange, image: Image(systemName: "tree")),
|
Trash(type: "bio", color: Color.orange, image: "tree"),
|
||||||
Trash(type: "residual", color: Color.orange, image: Image(systemName: "trash"))
|
Trash(type: "residual", color: Color.orange, image: "trash")
|
||||||
]
|
]
|
||||||
|
|
||||||
self.trashEvents = []
|
self.trashEvents = []
|
||||||
@@ -69,7 +69,7 @@ struct TrashModel {
|
|||||||
TrashEvent(
|
TrashEvent(
|
||||||
id: i + 6 + 7,
|
id: i + 6 + 7,
|
||||||
trash: self.trashTypes[3],
|
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())!
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ class TrashModelView {
|
|||||||
let model = TrashModel()
|
let model = TrashModel()
|
||||||
|
|
||||||
func getTrashEvents() -> [TrashEvent] {
|
func getTrashEvents() -> [TrashEvent] {
|
||||||
return model.trashEvents
|
return model.getTrashEvents()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import SwiftUI
|
|||||||
struct TrashTrackApp: App {
|
struct TrashTrackApp: App {
|
||||||
var body: some Scene {
|
var body: some Scene {
|
||||||
WindowGroup {
|
WindowGroup {
|
||||||
ContentView()
|
MainView()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user