diff --git a/taewoo_swift_HaneulBori/taewoo_swift_HaneulBori.xcodeproj/project.pbxproj b/taewoo_swift_HaneulBori/taewoo_swift_HaneulBori.xcodeproj/project.pbxproj index 0844a446..38d5dea1 100644 --- a/taewoo_swift_HaneulBori/taewoo_swift_HaneulBori.xcodeproj/project.pbxproj +++ b/taewoo_swift_HaneulBori/taewoo_swift_HaneulBori.xcodeproj/project.pbxproj @@ -23,6 +23,7 @@ 39FDAD3426B7BBF800E99370 /* Admin_ManageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39FDAD3326B7BBF800E99370 /* Admin_ManageView.swift */; }; 39FDAD3826B7DDAF00E99370 /* Launch Screen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 39FDAD3726B7DDAF00E99370 /* Launch Screen.storyboard */; }; 39FDAD3E26B8B5AE00E99370 /* User.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39FDAD3D26B8B5AE00E99370 /* User.swift */; }; + 39FDAD4126B8C93F00E99370 /* WashingMachine.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39FDAD4026B8C93F00E99370 /* WashingMachine.swift */; }; DAF52866E5BDB3CF2081A7BF /* Pods_taewoo_swift_HaneulBoriTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8E6F1C586583AE3297D1815B /* Pods_taewoo_swift_HaneulBoriTests.framework */; }; /* End PBXBuildFile section */ @@ -67,6 +68,7 @@ 39FDAD3326B7BBF800E99370 /* Admin_ManageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Admin_ManageView.swift; sourceTree = ""; }; 39FDAD3726B7DDAF00E99370 /* Launch Screen.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = "Launch Screen.storyboard"; sourceTree = ""; }; 39FDAD3D26B8B5AE00E99370 /* User.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = User.swift; sourceTree = ""; }; + 39FDAD4026B8C93F00E99370 /* WashingMachine.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WashingMachine.swift; sourceTree = ""; }; 4815C7C2D88B576D4863F8CB /* Pods_taewoo_swift_HaneulBori.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_taewoo_swift_HaneulBori.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 5FEA0A7823AE32301FCDA742 /* Pods-taewoo_swift_HaneulBori-taewoo_swift_HaneulBoriUITests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-taewoo_swift_HaneulBori-taewoo_swift_HaneulBoriUITests.release.xcconfig"; path = "Target Support Files/Pods-taewoo_swift_HaneulBori-taewoo_swift_HaneulBoriUITests/Pods-taewoo_swift_HaneulBori-taewoo_swift_HaneulBoriUITests.release.xcconfig"; sourceTree = ""; }; 63D75C7A39C404DD6400F705 /* Pods-taewoo_swift_HaneulBori.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-taewoo_swift_HaneulBori.release.xcconfig"; path = "Target Support Files/Pods-taewoo_swift_HaneulBori/Pods-taewoo_swift_HaneulBori.release.xcconfig"; sourceTree = ""; }; @@ -170,6 +172,7 @@ isa = PBXGroup; children = ( 39FDAD3D26B8B5AE00E99370 /* User.swift */, + 39FDAD4026B8C93F00E99370 /* WashingMachine.swift */, ); path = Model; sourceTree = ""; @@ -467,6 +470,7 @@ 39E769D026A5289600A836A8 /* ContentView.swift in Sources */, 39E769CE26A5289600A836A8 /* taewoo_swift_HaneulBoriApp.swift in Sources */, 39C8C73426A8053000782217 /* UserView.swift in Sources */, + 39FDAD4126B8C93F00E99370 /* WashingMachine.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/taewoo_swift_HaneulBori/taewoo_swift_HaneulBori.xcworkspace/xcuserdata/kwontaewoo.xcuserdatad/UserInterfaceState.xcuserstate b/taewoo_swift_HaneulBori/taewoo_swift_HaneulBori.xcworkspace/xcuserdata/kwontaewoo.xcuserdatad/UserInterfaceState.xcuserstate index 6bbf412b..119917a0 100644 Binary files a/taewoo_swift_HaneulBori/taewoo_swift_HaneulBori.xcworkspace/xcuserdata/kwontaewoo.xcuserdatad/UserInterfaceState.xcuserstate and b/taewoo_swift_HaneulBori/taewoo_swift_HaneulBori.xcworkspace/xcuserdata/kwontaewoo.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/taewoo_swift_HaneulBori/taewoo_swift_HaneulBori/Model/WashingMachine.swift b/taewoo_swift_HaneulBori/taewoo_swift_HaneulBori/Model/WashingMachine.swift new file mode 100644 index 00000000..dc294e70 --- /dev/null +++ b/taewoo_swift_HaneulBori/taewoo_swift_HaneulBori/Model/WashingMachine.swift @@ -0,0 +1,9 @@ +// +// WashingMachine.swift +// taewoo_swift_HaneulBori +// +// Created by 권태우 on 2021/08/03. +// + +import Foundation + diff --git a/taewoo_swift_HaneulBori/taewoo_swift_HaneulBori/Views/AdminView.swift b/taewoo_swift_HaneulBori/taewoo_swift_HaneulBori/Views/AdminView.swift index 856f5a56..f563bad7 100644 --- a/taewoo_swift_HaneulBori/taewoo_swift_HaneulBori/Views/AdminView.swift +++ b/taewoo_swift_HaneulBori/taewoo_swift_HaneulBori/Views/AdminView.swift @@ -18,7 +18,7 @@ struct AdminView: View { VStack { VStack { // Washer No.1 Text("1번 세탁기") - Text("(세탁기 상태)") + Text("\(viewModel.state1)") } .foregroundColor(.green) .multilineTextAlignment(.center) @@ -26,7 +26,7 @@ struct AdminView: View { .border(Color.black) VStack { // Washer No.2 Text("2번 세탁기") - Text("(세탁기 상태)") + Text("\(viewModel.state2)") } .foregroundColor(.blue) .multilineTextAlignment(.center) diff --git a/taewoo_swift_HaneulBori/taewoo_swift_HaneulBori/Views/Admin_ManageView.swift b/taewoo_swift_HaneulBori/taewoo_swift_HaneulBori/Views/Admin_ManageView.swift index 0ee477c6..ab02e7c5 100644 --- a/taewoo_swift_HaneulBori/taewoo_swift_HaneulBori/Views/Admin_ManageView.swift +++ b/taewoo_swift_HaneulBori/taewoo_swift_HaneulBori/Views/Admin_ManageView.swift @@ -8,15 +8,17 @@ import SwiftUI struct Admin_ManageView: View { - @State var isFixed = false - @State var state1 = false + @State var isFixed1 = false + @State var isFixed2 = false + @EnvironmentObject var viewModel: AppViewModel + var body: some View { VStack { VStack { VStack { // Washer No.1 Text("1번 세탁기") - Text("(세탁기 상태)") + Text("\(viewModel.state1)") } .foregroundColor(.green) .multilineTextAlignment(.center) @@ -24,7 +26,7 @@ struct Admin_ManageView: View { .border(Color.black) VStack { // Washer No.2 Text("2번 세탁기") - Text("(세탁기 상태)") + Text("\(viewModel.state2)") } .foregroundColor(.blue) .multilineTextAlignment(.center) @@ -32,23 +34,50 @@ struct Admin_ManageView: View { .border(Color.black) }.padding() Spacer() - Button(action: {isFixed.toggle()}) { - if isFixed{ - Text("이상 없음") - .padding() - .frame(width: 300) - .border(Color.black) + Button(action: { + isFixed1.toggle() + viewModel.state1 = "미사용" + }) { + HStack{ + if isFixed1 { + Text("1번 세탁기 이상 없음") + .padding() + .frame(width: 300) + .border(Color.black) + } + else { + Text("1번 세탁기 수리 필요") + .foregroundColor(Color.black) + .padding() + .frame(width: 300) + .border(Color.black) + .background(Color.red) + } } - else{ - Text("수리 필요") - .foregroundColor(Color.black) - .padding() - .frame(width: 300) - .border(Color.black) - .background(Color.red) + } + .disabled(isFixed1) + Button(action: { + isFixed2.toggle() + viewModel.state2 = "미사용" + }) { + HStack{ + if isFixed2 { + Text("2번 세탁기 이상 없음") + .padding() + .frame(width: 300) + .border(Color.black) + } + else { + Text("2번 세탁기 수리 필요") + .foregroundColor(Color.black) + .padding() + .frame(width: 300) + .border(Color.black) + .background(Color.red) + } } } - .disabled(isFixed) + .disabled(isFixed2) Spacer() } }