From ad6b363028b2a2654812b5133eb7f3a1b2f6bf22 Mon Sep 17 00:00:00 2001 From: Arafamamadouellaphi Date: Fri, 23 Jun 2023 08:21:30 +0200 Subject: [PATCH] Mvvmswift --- .../SwiftMvvm/SwiftMvvm.xcodeproj/project.pbxproj | 4 ---- Sources/SwiftMvvm/SwiftMvvm/NoteColor.swift | 13 ------------- Sources/SwiftMvvm/SwiftMvvm/Vue/Block.swift | 4 ++-- Sources/SwiftMvvm/SwiftMvvm/Vue/EditSheet.swift | 7 ++----- Sources/SwiftMvvm/SwiftMvvm/Vue/Home.swift | 10 ++-------- .../SwiftMvvm/SwiftMvvm/Vue/MatiereCapsule.swift | 2 +- Sources/SwiftMvvm/SwiftMvvm/Vue/UeCapsule.swift | 6 ------ Sources/SwiftMvvm/SwiftMvvm/Vue/UeView.swift | 7 +------ Sources/SwiftMvvm/SwiftMvvm/Vue/Uee.swift | 2 -- 9 files changed, 8 insertions(+), 47 deletions(-) delete mode 100644 Sources/SwiftMvvm/SwiftMvvm/NoteColor.swift diff --git a/Sources/SwiftMvvm/SwiftMvvm.xcodeproj/project.pbxproj b/Sources/SwiftMvvm/SwiftMvvm.xcodeproj/project.pbxproj index 34a4737..d5adad5 100644 --- a/Sources/SwiftMvvm/SwiftMvvm.xcodeproj/project.pbxproj +++ b/Sources/SwiftMvvm/SwiftMvvm.xcodeproj/project.pbxproj @@ -35,7 +35,6 @@ EC7693022A4568D700F9F644 /* MatiereEditView.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC7693012A4568D700F9F644 /* MatiereEditView.swift */; }; EC7693042A4568F300F9F644 /* BlockItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC7693032A4568F300F9F644 /* BlockItem.swift */; }; EC7693062A45691900F9F644 /* AddSheet.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC7693052A45691900F9F644 /* AddSheet.swift */; }; - EC7693082A456A2400F9F644 /* NoteColor.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC7693072A456A2400F9F644 /* NoteColor.swift */; }; EC76930A2A456B6B00F9F644 /* Block.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC7693092A456B6B00F9F644 /* Block.swift */; }; EC7725452A1F814A0075CBBF /* UeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC7725442A1F814A0075CBBF /* UeView.swift */; }; EC7725542A1F90CF0075CBBF /* BlocModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC7725532A1F90CF0075CBBF /* BlocModel.swift */; }; @@ -99,7 +98,6 @@ EC7693012A4568D700F9F644 /* MatiereEditView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MatiereEditView.swift; sourceTree = ""; }; EC7693032A4568F300F9F644 /* BlockItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BlockItem.swift; sourceTree = ""; }; EC7693052A45691900F9F644 /* AddSheet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddSheet.swift; sourceTree = ""; }; - EC7693072A456A2400F9F644 /* NoteColor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NoteColor.swift; sourceTree = ""; }; EC7693092A456B6B00F9F644 /* Block.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Block.swift; sourceTree = ""; }; EC7725442A1F814A0075CBBF /* UeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UeView.swift; sourceTree = ""; }; EC7725532A1F90CF0075CBBF /* BlocModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BlocModel.swift; sourceTree = ""; }; @@ -171,7 +169,6 @@ EC1A52612A1CE12900F8CC93 /* SwiftMvvmApp.swift */, EC1A52632A1CE12900F8CC93 /* ContentView.swift */, EC1A52652A1CE12A00F8CC93 /* Assets.xcassets */, - EC7693072A456A2400F9F644 /* NoteColor.swift */, EC1A52672A1CE12A00F8CC93 /* Preview Content */, ); path = SwiftMvvm; @@ -413,7 +410,6 @@ ECF5E2722A23102800A2E9CA /* BlocVm.swift in Sources */, EC7692E82A4565ED00F9F644 /* UeCollection.swift in Sources */, EC7693002A4568BD00F9F644 /* EditSheet.swift in Sources */, - EC7693082A456A2400F9F644 /* NoteColor.swift in Sources */, EC7692F82A45685200F9F644 /* MatiereUnq.swift in Sources */, EC7692EA2A45660500F9F644 /* MatiereCollection.swift in Sources */, EC47F9D62A34C50C00CA3A3F /* DataManager.swift in Sources */, diff --git a/Sources/SwiftMvvm/SwiftMvvm/NoteColor.swift b/Sources/SwiftMvvm/SwiftMvvm/NoteColor.swift deleted file mode 100644 index e5fb714..0000000 --- a/Sources/SwiftMvvm/SwiftMvvm/NoteColor.swift +++ /dev/null @@ -1,13 +0,0 @@ -// -// NoteColor.swift -// SwiftMvvm -// -// Created by etudiant on 23/06/2023. -// - -import Foundation -import Foundation -import SwiftUI -public struct NoteColor{ - public let ue_back = Color("background_UE") -} diff --git a/Sources/SwiftMvvm/SwiftMvvm/Vue/Block.swift b/Sources/SwiftMvvm/SwiftMvvm/Vue/Block.swift index 39c1792..935312f 100644 --- a/Sources/SwiftMvvm/SwiftMvvm/Vue/Block.swift +++ b/Sources/SwiftMvvm/SwiftMvvm/Vue/Block.swift @@ -18,7 +18,7 @@ struct Block: View { VStack(alignment: .leading) { HStack { - Image(systemName: "menucard.fill") + Image(systemName: "doc.on.doc.fill") Text("Blocs").bold().font(.title) } @@ -32,7 +32,7 @@ struct Block: View { } } - }.padding().background(NoteColor().ue_back).cornerRadius(10) + }.padding().cornerRadius(10) } } struct Block_Previews: PreviewProvider { diff --git a/Sources/SwiftMvvm/SwiftMvvm/Vue/EditSheet.swift b/Sources/SwiftMvvm/SwiftMvvm/Vue/EditSheet.swift index 9fd94af..2b5e0b6 100644 --- a/Sources/SwiftMvvm/SwiftMvvm/Vue/EditSheet.swift +++ b/Sources/SwiftMvvm/SwiftMvvm/Vue/EditSheet.swift @@ -21,10 +21,7 @@ struct EditSheet : View{ VStack{ TextField("Description", text: $ue.nom) TextField("Coefficient", value: $ue.coef, format: .number) - } - - - + } } Divider() Section(header: Text("Matieres").font(.title)) { @@ -46,7 +43,7 @@ struct EditSheet : View{ Text("Ajouter une matiere") } } - }.padding().background(NoteColor().ue_back) + }.padding() } .navigationBarItems(trailing: diff --git a/Sources/SwiftMvvm/SwiftMvvm/Vue/Home.swift b/Sources/SwiftMvvm/SwiftMvvm/Vue/Home.swift index 21a7fd1..3fc58bc 100644 --- a/Sources/SwiftMvvm/SwiftMvvm/Vue/Home.swift +++ b/Sources/SwiftMvvm/SwiftMvvm/Vue/Home.swift @@ -23,7 +23,7 @@ struct Home: View { Block(manager: manager ) VStack(alignment : .leading){ HStack(alignment:.bottom){ - Image(systemName: "menucard.fill") + Image(systemName: "doc.on.doc.fill") Text("UEs").bold().font(.title) }.padding() @@ -34,18 +34,12 @@ struct Home: View { UeView(bloc: item, ue: ue) } - - } } - }.padding().background(NoteColor().ue_back).cornerRadius(10) - - + }.padding() }.padding() - - } } diff --git a/Sources/SwiftMvvm/SwiftMvvm/Vue/MatiereCapsule.swift b/Sources/SwiftMvvm/SwiftMvvm/Vue/MatiereCapsule.swift index 434ed24..add4968 100644 --- a/Sources/SwiftMvvm/SwiftMvvm/Vue/MatiereCapsule.swift +++ b/Sources/SwiftMvvm/SwiftMvvm/Vue/MatiereCapsule.swift @@ -93,6 +93,6 @@ struct CapsuleMatiere_Previews: PreviewProvider { static var previews: some View { ExpandingCapsuleViewMatiere(matiere: MatiereVM(withMat: Matiere(name: "Projet", moy: 12, coef: 9)),ue: UeVM(withUe: DataStub().loadUeStage_Proj()[0]), - bloc: BlocVM(withBloc: Bloc(nom: "", ues: DataStub().loadUeStage_Proj(), isUq: true)) ) + bloc: BlocVM(withBloc: Bloc(nom: "", ues: DataStub().loadUeStage_Proj(), isUq: true)) ) } } diff --git a/Sources/SwiftMvvm/SwiftMvvm/Vue/UeCapsule.swift b/Sources/SwiftMvvm/SwiftMvvm/Vue/UeCapsule.swift index 5f19e3c..91d9e8a 100644 --- a/Sources/SwiftMvvm/SwiftMvvm/Vue/UeCapsule.swift +++ b/Sources/SwiftMvvm/SwiftMvvm/Vue/UeCapsule.swift @@ -70,18 +70,12 @@ import UIKit } } } - - private func updateMoy(){ var da = ue.model.totalMoyenne * capsuleWidth / 100 ue.model.coef = ue.model.coef + 1 print(da) } } - - - - struct CapsuleV_Previews: PreviewProvider { static var previews: some View { diff --git a/Sources/SwiftMvvm/SwiftMvvm/Vue/UeView.swift b/Sources/SwiftMvvm/SwiftMvvm/Vue/UeView.swift index d48a7e7..4b9a452 100644 --- a/Sources/SwiftMvvm/SwiftMvvm/Vue/UeView.swift +++ b/Sources/SwiftMvvm/SwiftMvvm/Vue/UeView.swift @@ -5,8 +5,7 @@ import SwiftUI public struct UeView : View{ @ObservedObject var bloc : BlocVM @ObservedObject var ue : UeVM - public var body: some View { - + public var body: some View { VStack(alignment:.leading){ Divider() @@ -15,8 +14,6 @@ public struct UeView : View{ Spacer() Text(ue.coef.description) } - - HStack(){ Capsule().foregroundColor( ue.totalMoyenne * 5 < 50 ? .red : .green).frame(width: ue.totalMoyenne * 5 ,height: 22) Spacer() @@ -35,10 +32,8 @@ public struct UeView : View{ struct UeView_Previews: PreviewProvider { static var previews: some View { - let ue = DataStub().load()[0] let ueVM = UeVM(withUe: ue) - UeView(bloc: BlocVM(withBloc: Bloc(nom: "Projet/Stage", ues: DataStub().loadUeStage_Proj(),isUq: true)), ue: ueVM) } diff --git a/Sources/SwiftMvvm/SwiftMvvm/Vue/Uee.swift b/Sources/SwiftMvvm/SwiftMvvm/Vue/Uee.swift index 41d1b86..e871c16 100644 --- a/Sources/SwiftMvvm/SwiftMvvm/Vue/Uee.swift +++ b/Sources/SwiftMvvm/SwiftMvvm/Vue/Uee.swift @@ -10,8 +10,6 @@ import SwiftUI struct Uee: View { @ObservedObject var ue: UeVM @ObservedObject var bloc: BlocVM - - var body: some View { NavigationView { VStack {