From 134cd644f5c9d3021054675598e42fa1238f8e22 Mon Sep 17 00:00:00 2001 From: eunjuchoi Date: Tue, 6 Feb 2024 11:25:49 +0900 Subject: [PATCH 01/31] =?UTF-8?q?config:=20Main=20=EC=8A=A4=ED=86=A0?= =?UTF-8?q?=EB=A6=AC=EB=B3=B4=EB=93=9C=20=EC=82=AD=EC=A0=9C=20=EB=B0=8F=20?= =?UTF-8?q?=EB=A3=A8=ED=8A=B8=20=EB=B7=B0=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../project.pbxproj | 16 ---------- .../Base.lproj/Main.storyboard | 32 ------------------- BankManagerUIApp/BankManagerUIApp/Info.plist | 4 --- .../BankManagerUIApp/SceneDelegate.swift | 10 +++--- .../BankManagerUIApp/ViewController.swift | 1 - 5 files changed, 5 insertions(+), 58 deletions(-) delete mode 100644 BankManagerUIApp/BankManagerUIApp/Base.lproj/Main.storyboard diff --git a/BankManagerUIApp/BankManagerUIApp.xcodeproj/project.pbxproj b/BankManagerUIApp/BankManagerUIApp.xcodeproj/project.pbxproj index 62a20a2d..172dbde1 100644 --- a/BankManagerUIApp/BankManagerUIApp.xcodeproj/project.pbxproj +++ b/BankManagerUIApp/BankManagerUIApp.xcodeproj/project.pbxproj @@ -10,12 +10,10 @@ C7694E3B259C3E9F0053667F /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7694E3A259C3E9F0053667F /* AppDelegate.swift */; }; C7694E3D259C3E9F0053667F /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7694E3C259C3E9F0053667F /* SceneDelegate.swift */; }; C7694E3F259C3E9F0053667F /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7694E3E259C3E9F0053667F /* ViewController.swift */; }; - C7694E42259C3E9F0053667F /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C7694E40259C3E9F0053667F /* Main.storyboard */; }; C7694E44259C3EA20053667F /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C7694E43259C3EA20053667F /* Assets.xcassets */; }; C7694E47259C3EA20053667F /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C7694E45259C3EA20053667F /* LaunchScreen.storyboard */; }; C7694E52259C3EA20053667F /* BankManagerUIAppTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7694E51259C3EA20053667F /* BankManagerUIAppTests.swift */; }; C7694E5D259C3EA20053667F /* BankManagerUIAppUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7694E5C259C3EA20053667F /* BankManagerUIAppUITests.swift */; }; - C7D65D1E259C81BD005510E0 /* BankManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7D65D1D259C81BD005510E0 /* BankManager.swift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -40,7 +38,6 @@ C7694E3A259C3E9F0053667F /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; C7694E3C259C3E9F0053667F /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; C7694E3E259C3E9F0053667F /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; - C7694E41259C3E9F0053667F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; C7694E43259C3EA20053667F /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; C7694E46259C3EA20053667F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; C7694E48259C3EA20053667F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; @@ -50,7 +47,6 @@ C7694E58259C3EA20053667F /* BankManagerUIAppUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = BankManagerUIAppUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; C7694E5C259C3EA20053667F /* BankManagerUIAppUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BankManagerUIAppUITests.swift; sourceTree = ""; }; C7694E5E259C3EA20053667F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - C7D65D1D259C81BD005510E0 /* BankManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = BankManager.swift; path = ../../BankManager.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -101,11 +97,9 @@ C7694E39259C3E9F0053667F /* BankManagerUIApp */ = { isa = PBXGroup; children = ( - C7D65D1D259C81BD005510E0 /* BankManager.swift */, C7694E3A259C3E9F0053667F /* AppDelegate.swift */, C7694E3C259C3E9F0053667F /* SceneDelegate.swift */, C7694E3E259C3E9F0053667F /* ViewController.swift */, - C7694E40259C3E9F0053667F /* Main.storyboard */, C7694E43259C3EA20053667F /* Assets.xcassets */, C7694E45259C3EA20053667F /* LaunchScreen.storyboard */, C7694E48259C3EA20053667F /* Info.plist */, @@ -236,7 +230,6 @@ files = ( C7694E47259C3EA20053667F /* LaunchScreen.storyboard in Resources */, C7694E44259C3EA20053667F /* Assets.xcassets in Resources */, - C7694E42259C3E9F0053667F /* Main.storyboard in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -264,7 +257,6 @@ C7694E3F259C3E9F0053667F /* ViewController.swift in Sources */, C7694E3B259C3E9F0053667F /* AppDelegate.swift in Sources */, C7694E3D259C3E9F0053667F /* SceneDelegate.swift in Sources */, - C7D65D1E259C81BD005510E0 /* BankManager.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -300,14 +292,6 @@ /* End PBXTargetDependency section */ /* Begin PBXVariantGroup section */ - C7694E40259C3E9F0053667F /* Main.storyboard */ = { - isa = PBXVariantGroup; - children = ( - C7694E41259C3E9F0053667F /* Base */, - ); - name = Main.storyboard; - sourceTree = ""; - }; C7694E45259C3EA20053667F /* LaunchScreen.storyboard */ = { isa = PBXVariantGroup; children = ( diff --git a/BankManagerUIApp/BankManagerUIApp/Base.lproj/Main.storyboard b/BankManagerUIApp/BankManagerUIApp/Base.lproj/Main.storyboard deleted file mode 100644 index ce80ec92..00000000 --- a/BankManagerUIApp/BankManagerUIApp/Base.lproj/Main.storyboard +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/BankManagerUIApp/BankManagerUIApp/Info.plist b/BankManagerUIApp/BankManagerUIApp/Info.plist index 5b531f7b..2688b32b 100644 --- a/BankManagerUIApp/BankManagerUIApp/Info.plist +++ b/BankManagerUIApp/BankManagerUIApp/Info.plist @@ -33,8 +33,6 @@ Default Configuration UISceneDelegateClassName $(PRODUCT_MODULE_NAME).SceneDelegate - UISceneStoryboardFile - Main @@ -43,8 +41,6 @@ UILaunchStoryboardName LaunchScreen - UIMainStoryboardFile - Main UIRequiredDeviceCapabilities armv7 diff --git a/BankManagerUIApp/BankManagerUIApp/SceneDelegate.swift b/BankManagerUIApp/BankManagerUIApp/SceneDelegate.swift index 63d2d2a1..630bf0a9 100644 --- a/BankManagerUIApp/BankManagerUIApp/SceneDelegate.swift +++ b/BankManagerUIApp/BankManagerUIApp/SceneDelegate.swift @@ -10,12 +10,12 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { var window: UIWindow? - func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { - // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. - // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. - // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). - guard let _ = (scene as? UIWindowScene) else { return } + guard let windowScene = (scene as? UIWindowScene) else { return } + + window = UIWindow(windowScene: windowScene) + window?.rootViewController = ViewController() + window?.makeKeyAndVisible() } func sceneDidDisconnect(_ scene: UIScene) { diff --git a/BankManagerUIApp/BankManagerUIApp/ViewController.swift b/BankManagerUIApp/BankManagerUIApp/ViewController.swift index a3182156..6826475e 100644 --- a/BankManagerUIApp/BankManagerUIApp/ViewController.swift +++ b/BankManagerUIApp/BankManagerUIApp/ViewController.swift @@ -10,7 +10,6 @@ class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() - // Do any additional setup after loading the view. } From bdbc81ccd9a321eba230d95da0b09205cb3970f4 Mon Sep 17 00:00:00 2001 From: eunjuchoi Date: Wed, 7 Feb 2024 16:34:31 +0900 Subject: [PATCH 02/31] =?UTF-8?q?feat:=20Then=20=ED=94=84=EB=A1=9C?= =?UTF-8?q?=ED=86=A0=EC=BD=9C=20=EC=A0=95=EC=9D=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../project.pbxproj | 4 ++++ BankManagerUIApp/BankManagerUIApp/Then.swift | 21 +++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 BankManagerUIApp/BankManagerUIApp/Then.swift diff --git a/BankManagerUIApp/BankManagerUIApp.xcodeproj/project.pbxproj b/BankManagerUIApp/BankManagerUIApp.xcodeproj/project.pbxproj index 172dbde1..a0e8c8d2 100644 --- a/BankManagerUIApp/BankManagerUIApp.xcodeproj/project.pbxproj +++ b/BankManagerUIApp/BankManagerUIApp.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 77B02E342B730AD700C3D686 /* Then.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77B02E332B730AD700C3D686 /* Then.swift */; }; C7694E3B259C3E9F0053667F /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7694E3A259C3E9F0053667F /* AppDelegate.swift */; }; C7694E3D259C3E9F0053667F /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7694E3C259C3E9F0053667F /* SceneDelegate.swift */; }; C7694E3F259C3E9F0053667F /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7694E3E259C3E9F0053667F /* ViewController.swift */; }; @@ -34,6 +35,7 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ + 77B02E332B730AD700C3D686 /* Then.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Then.swift; sourceTree = ""; }; C7694E37259C3E9F0053667F /* BankManagerUIApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = BankManagerUIApp.app; sourceTree = BUILT_PRODUCTS_DIR; }; C7694E3A259C3E9F0053667F /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; C7694E3C259C3E9F0053667F /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; @@ -100,6 +102,7 @@ C7694E3A259C3E9F0053667F /* AppDelegate.swift */, C7694E3C259C3E9F0053667F /* SceneDelegate.swift */, C7694E3E259C3E9F0053667F /* ViewController.swift */, + 77B02E332B730AD700C3D686 /* Then.swift */, C7694E43259C3EA20053667F /* Assets.xcassets */, C7694E45259C3EA20053667F /* LaunchScreen.storyboard */, C7694E48259C3EA20053667F /* Info.plist */, @@ -256,6 +259,7 @@ files = ( C7694E3F259C3E9F0053667F /* ViewController.swift in Sources */, C7694E3B259C3E9F0053667F /* AppDelegate.swift in Sources */, + 77B02E342B730AD700C3D686 /* Then.swift in Sources */, C7694E3D259C3E9F0053667F /* SceneDelegate.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/BankManagerUIApp/BankManagerUIApp/Then.swift b/BankManagerUIApp/BankManagerUIApp/Then.swift new file mode 100644 index 00000000..eefb39a8 --- /dev/null +++ b/BankManagerUIApp/BankManagerUIApp/Then.swift @@ -0,0 +1,21 @@ +// +// Then.swift +// BankManagerUIApp +// +// Created by EUNJU on 2024/02/07. +// + +import UIKit + +protocol Then {} + +extension Then where Self: AnyObject { + + @inlinable + func then(_ block: (Self) throws -> Void) rethrows -> Self { + try block(self) + return self + } +} + +extension NSObject: Then {} From ce7ba4340463e0f434fd58d0d7906da246b70d43 Mon Sep 17 00:00:00 2001 From: eunjuchoi Date: Wed, 7 Feb 2024 16:36:22 +0900 Subject: [PATCH 03/31] =?UTF-8?q?feat:=20UIStackView=20extension=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BankManagerUIApp.xcodeproj/project.pbxproj | 4 ++++ .../BankManagerUIApp/UIStackView+.swift | 16 ++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 BankManagerUIApp/BankManagerUIApp/UIStackView+.swift diff --git a/BankManagerUIApp/BankManagerUIApp.xcodeproj/project.pbxproj b/BankManagerUIApp/BankManagerUIApp.xcodeproj/project.pbxproj index a0e8c8d2..961d0922 100644 --- a/BankManagerUIApp/BankManagerUIApp.xcodeproj/project.pbxproj +++ b/BankManagerUIApp/BankManagerUIApp.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 77B02E322B7306E900C3D686 /* UIStackView+.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77B02E312B7306E900C3D686 /* UIStackView+.swift */; }; 77B02E342B730AD700C3D686 /* Then.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77B02E332B730AD700C3D686 /* Then.swift */; }; C7694E3B259C3E9F0053667F /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7694E3A259C3E9F0053667F /* AppDelegate.swift */; }; C7694E3D259C3E9F0053667F /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7694E3C259C3E9F0053667F /* SceneDelegate.swift */; }; @@ -35,6 +36,7 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ + 77B02E312B7306E900C3D686 /* UIStackView+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIStackView+.swift"; sourceTree = ""; }; 77B02E332B730AD700C3D686 /* Then.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Then.swift; sourceTree = ""; }; C7694E37259C3E9F0053667F /* BankManagerUIApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = BankManagerUIApp.app; sourceTree = BUILT_PRODUCTS_DIR; }; C7694E3A259C3E9F0053667F /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; @@ -102,6 +104,7 @@ C7694E3A259C3E9F0053667F /* AppDelegate.swift */, C7694E3C259C3E9F0053667F /* SceneDelegate.swift */, C7694E3E259C3E9F0053667F /* ViewController.swift */, + 77B02E312B7306E900C3D686 /* UIStackView+.swift */, 77B02E332B730AD700C3D686 /* Then.swift */, C7694E43259C3EA20053667F /* Assets.xcassets */, C7694E45259C3EA20053667F /* LaunchScreen.storyboard */, @@ -259,6 +262,7 @@ files = ( C7694E3F259C3E9F0053667F /* ViewController.swift in Sources */, C7694E3B259C3E9F0053667F /* AppDelegate.swift in Sources */, + 77B02E322B7306E900C3D686 /* UIStackView+.swift in Sources */, 77B02E342B730AD700C3D686 /* Then.swift in Sources */, C7694E3D259C3E9F0053667F /* SceneDelegate.swift in Sources */, ); diff --git a/BankManagerUIApp/BankManagerUIApp/UIStackView+.swift b/BankManagerUIApp/BankManagerUIApp/UIStackView+.swift new file mode 100644 index 00000000..1307d425 --- /dev/null +++ b/BankManagerUIApp/BankManagerUIApp/UIStackView+.swift @@ -0,0 +1,16 @@ +// +// UIStackView+.swift +// BankManagerUIApp +// +// Created by EUNJU on 2024/02/07. +// + +import UIKit + +extension UIStackView { + + /// 다수의 View를 StackView에 한꺼번에 추가하는 메서드 + func addArrangedSubviews(_ views: [UIView]) { + views.forEach { self.addArrangedSubview($0) } + } +} From d6781fd64a15cd1a87f725ec230969feb53c54a4 Mon Sep 17 00:00:00 2001 From: eunjuchoi Date: Wed, 7 Feb 2024 16:37:31 +0900 Subject: [PATCH 04/31] =?UTF-8?q?feat:=20BankViewController=20=EA=B8=B0?= =?UTF-8?q?=EB=B3=B8=20UI=20=EA=B5=AC=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BankManagerUIApp/ViewController.swift | 112 +++++++++++++++++- 1 file changed, 109 insertions(+), 3 deletions(-) diff --git a/BankManagerUIApp/BankManagerUIApp/ViewController.swift b/BankManagerUIApp/BankManagerUIApp/ViewController.swift index 6826475e..3c933dbf 100644 --- a/BankManagerUIApp/BankManagerUIApp/ViewController.swift +++ b/BankManagerUIApp/BankManagerUIApp/ViewController.swift @@ -1,17 +1,123 @@ // -// BankManagerUIApp - ViewController.swift +// BankManagerUIApp - BankViewController.swift // Created by yagom. // Copyright © yagom academy. All rights reserved. // import UIKit -class ViewController: UIViewController { +final class BankViewController: UIViewController { + private let addCustomerButton = UIButton().then { + $0.setTitle("고객 10명 추가", for: .normal) + $0.setTitleColor(.systemBlue, for: .normal) + } + + private let resetButton = UIButton().then { + $0.setTitle("초기화", for: .normal) + $0.setTitleColor(.systemRed, for: .normal) + } + + private let optionButtonStackView = UIStackView().then { + $0.axis = .horizontal + $0.alignment = .fill + $0.distribution = .fillEqually + $0.translatesAutoresizingMaskIntoConstraints = false + } + + private let timerLabel = UILabel().then { + $0.text = "업무시간 - " + $0.textAlignment = .center + $0.font = .systemFont(ofSize: 22) + } + + private let greenView = UIView().then { + $0.backgroundColor = .systemGreen + } + + private let purpleView = UIView().then { + $0.backgroundColor = .systemPurple + } + + private let waitingQueueTitleLabel = UILabel().then { + $0.text = "대기중" + $0.textAlignment = .center + $0.textColor = .white + $0.font = .systemFont(ofSize: 40) + $0.translatesAutoresizingMaskIntoConstraints = false + } + + private let workingQueueTitleLabel = UILabel().then { + $0.text = "업무중" + $0.textAlignment = .center + $0.textColor = .white + $0.font = .systemFont(ofSize: 40) + $0.translatesAutoresizingMaskIntoConstraints = false + } + + private let titleStackView = UIStackView().then { + $0.axis = .horizontal + $0.alignment = .fill + $0.distribution = .fillEqually + $0.translatesAutoresizingMaskIntoConstraints = false + } + + private let headerStackView = UIStackView().then { + $0.axis = .vertical + $0.alignment = .fill + $0.distribution = .fillEqually + $0.translatesAutoresizingMaskIntoConstraints = false + } + + private let waitingQueueTableView = UITableView() + + private let workingQueueTableView = UITableView() + + private let tableStackView = UIStackView().then { + $0.axis = .horizontal + $0.alignment = .fill + $0.distribution = .fillEqually + $0.translatesAutoresizingMaskIntoConstraints = false + } + + private let entireStackView = UIStackView().then { + $0.axis = .vertical + $0.alignment = .fill + $0.translatesAutoresizingMaskIntoConstraints = false + } + override func viewDidLoad() { super.viewDidLoad() + + configureUI() } + + private func configureUI() { + view.backgroundColor = .white + view.addSubview(entireStackView) + entireStackView.addArrangedSubviews([headerStackView, tableStackView]) + headerStackView.addArrangedSubviews([optionButtonStackView, timerLabel, titleStackView]) + tableStackView.addArrangedSubviews([waitingQueueTableView, workingQueueTableView]) + titleStackView.addArrangedSubviews([greenView, purpleView]) + optionButtonStackView.addArrangedSubviews([addCustomerButton, resetButton]) + greenView.addSubview(waitingQueueTitleLabel) + purpleView.addSubview(workingQueueTitleLabel) - + NSLayoutConstraint.activate([ + entireStackView.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor), + entireStackView.leadingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leadingAnchor), + entireStackView.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor), + entireStackView.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor), + headerStackView.heightAnchor.constraint(equalTo: entireStackView.heightAnchor, multiplier: 0.2), + waitingQueueTitleLabel.topAnchor.constraint(equalTo: greenView.topAnchor), + waitingQueueTitleLabel.leadingAnchor.constraint(equalTo: greenView.leadingAnchor), + waitingQueueTitleLabel.trailingAnchor.constraint(equalTo: greenView.trailingAnchor), + waitingQueueTitleLabel.bottomAnchor.constraint(equalTo: greenView.bottomAnchor), + workingQueueTitleLabel.topAnchor.constraint(equalTo: purpleView.topAnchor), + workingQueueTitleLabel.leadingAnchor.constraint(equalTo: purpleView.leadingAnchor), + workingQueueTitleLabel.trailingAnchor.constraint(equalTo: purpleView.trailingAnchor), + workingQueueTitleLabel.bottomAnchor.constraint(equalTo: purpleView.bottomAnchor) + ]) + } } From 2fdd92bc62e0121135c3a22e80fec46130f5d49b Mon Sep 17 00:00:00 2001 From: eunjuchoi Date: Wed, 7 Feb 2024 16:37:49 +0900 Subject: [PATCH 05/31] =?UTF-8?q?chore:=20=EC=8B=9C=EC=9E=91=20=EB=B7=B0?= =?UTF-8?q?=EC=BB=A8=ED=8A=B8=EB=A1=A4=EB=9F=AC=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BankManagerUIApp/BankManagerUIApp/SceneDelegate.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BankManagerUIApp/BankManagerUIApp/SceneDelegate.swift b/BankManagerUIApp/BankManagerUIApp/SceneDelegate.swift index 630bf0a9..6ae236ea 100644 --- a/BankManagerUIApp/BankManagerUIApp/SceneDelegate.swift +++ b/BankManagerUIApp/BankManagerUIApp/SceneDelegate.swift @@ -14,7 +14,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { guard let windowScene = (scene as? UIWindowScene) else { return } window = UIWindow(windowScene: windowScene) - window?.rootViewController = ViewController() + window?.rootViewController = BankViewController() window?.makeKeyAndVisible() } From b5075184e4778ab891c8512a231c9b302e545cfa Mon Sep 17 00:00:00 2001 From: eunjuchoi Date: Wed, 7 Feb 2024 16:48:28 +0900 Subject: [PATCH 06/31] =?UTF-8?q?chore:=20ViewController=20=ED=8C=8C?= =?UTF-8?q?=EC=9D=BC=20=EC=9D=B4=EB=A6=84=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BankManagerUIApp.xcodeproj/project.pbxproj | 8 ++++---- .../{ViewController.swift => BankViewController.swift} | 0 2 files changed, 4 insertions(+), 4 deletions(-) rename BankManagerUIApp/BankManagerUIApp/{ViewController.swift => BankViewController.swift} (100%) diff --git a/BankManagerUIApp/BankManagerUIApp.xcodeproj/project.pbxproj b/BankManagerUIApp/BankManagerUIApp.xcodeproj/project.pbxproj index 961d0922..60a02f76 100644 --- a/BankManagerUIApp/BankManagerUIApp.xcodeproj/project.pbxproj +++ b/BankManagerUIApp/BankManagerUIApp.xcodeproj/project.pbxproj @@ -11,7 +11,7 @@ 77B02E342B730AD700C3D686 /* Then.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77B02E332B730AD700C3D686 /* Then.swift */; }; C7694E3B259C3E9F0053667F /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7694E3A259C3E9F0053667F /* AppDelegate.swift */; }; C7694E3D259C3E9F0053667F /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7694E3C259C3E9F0053667F /* SceneDelegate.swift */; }; - C7694E3F259C3E9F0053667F /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7694E3E259C3E9F0053667F /* ViewController.swift */; }; + C7694E3F259C3E9F0053667F /* BankViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7694E3E259C3E9F0053667F /* BankViewController.swift */; }; C7694E44259C3EA20053667F /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C7694E43259C3EA20053667F /* Assets.xcassets */; }; C7694E47259C3EA20053667F /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C7694E45259C3EA20053667F /* LaunchScreen.storyboard */; }; C7694E52259C3EA20053667F /* BankManagerUIAppTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7694E51259C3EA20053667F /* BankManagerUIAppTests.swift */; }; @@ -41,7 +41,7 @@ C7694E37259C3E9F0053667F /* BankManagerUIApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = BankManagerUIApp.app; sourceTree = BUILT_PRODUCTS_DIR; }; C7694E3A259C3E9F0053667F /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; C7694E3C259C3E9F0053667F /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; - C7694E3E259C3E9F0053667F /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; + C7694E3E259C3E9F0053667F /* BankViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BankViewController.swift; sourceTree = ""; }; C7694E43259C3EA20053667F /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; C7694E46259C3EA20053667F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; C7694E48259C3EA20053667F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; @@ -103,7 +103,7 @@ children = ( C7694E3A259C3E9F0053667F /* AppDelegate.swift */, C7694E3C259C3E9F0053667F /* SceneDelegate.swift */, - C7694E3E259C3E9F0053667F /* ViewController.swift */, + C7694E3E259C3E9F0053667F /* BankViewController.swift */, 77B02E312B7306E900C3D686 /* UIStackView+.swift */, 77B02E332B730AD700C3D686 /* Then.swift */, C7694E43259C3EA20053667F /* Assets.xcassets */, @@ -260,7 +260,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - C7694E3F259C3E9F0053667F /* ViewController.swift in Sources */, + C7694E3F259C3E9F0053667F /* BankViewController.swift in Sources */, C7694E3B259C3E9F0053667F /* AppDelegate.swift in Sources */, 77B02E322B7306E900C3D686 /* UIStackView+.swift in Sources */, 77B02E342B730AD700C3D686 /* Then.swift in Sources */, diff --git a/BankManagerUIApp/BankManagerUIApp/ViewController.swift b/BankManagerUIApp/BankManagerUIApp/BankViewController.swift similarity index 100% rename from BankManagerUIApp/BankManagerUIApp/ViewController.swift rename to BankManagerUIApp/BankManagerUIApp/BankViewController.swift From b25f624ecbe78c5953f48d93fb4399751175ad77 Mon Sep 17 00:00:00 2001 From: suojae3 Date: Wed, 7 Feb 2024 19:50:41 +0900 Subject: [PATCH 07/31] =?UTF-8?q?feat:=20Client=20=EB=AA=A8=EB=8D=B8=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BankManagerUIApp.xcodeproj/project.pbxproj | 4 ++++ BankManagerUIApp/BankManagerUIApp/Client.swift | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 BankManagerUIApp/BankManagerUIApp/Client.swift diff --git a/BankManagerUIApp/BankManagerUIApp.xcodeproj/project.pbxproj b/BankManagerUIApp/BankManagerUIApp.xcodeproj/project.pbxproj index 60a02f76..72d84aba 100644 --- a/BankManagerUIApp/BankManagerUIApp.xcodeproj/project.pbxproj +++ b/BankManagerUIApp/BankManagerUIApp.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 08FE43F42B73972500D09BB7 /* Client.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08FE43F32B73972500D09BB7 /* Client.swift */; }; 77B02E322B7306E900C3D686 /* UIStackView+.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77B02E312B7306E900C3D686 /* UIStackView+.swift */; }; 77B02E342B730AD700C3D686 /* Then.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77B02E332B730AD700C3D686 /* Then.swift */; }; C7694E3B259C3E9F0053667F /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7694E3A259C3E9F0053667F /* AppDelegate.swift */; }; @@ -36,6 +37,7 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ + 08FE43F32B73972500D09BB7 /* Client.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Client.swift; sourceTree = ""; }; 77B02E312B7306E900C3D686 /* UIStackView+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIStackView+.swift"; sourceTree = ""; }; 77B02E332B730AD700C3D686 /* Then.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Then.swift; sourceTree = ""; }; C7694E37259C3E9F0053667F /* BankManagerUIApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = BankManagerUIApp.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -103,6 +105,7 @@ children = ( C7694E3A259C3E9F0053667F /* AppDelegate.swift */, C7694E3C259C3E9F0053667F /* SceneDelegate.swift */, + 08FE43F32B73972500D09BB7 /* Client.swift */, C7694E3E259C3E9F0053667F /* BankViewController.swift */, 77B02E312B7306E900C3D686 /* UIStackView+.swift */, 77B02E332B730AD700C3D686 /* Then.swift */, @@ -263,6 +266,7 @@ C7694E3F259C3E9F0053667F /* BankViewController.swift in Sources */, C7694E3B259C3E9F0053667F /* AppDelegate.swift in Sources */, 77B02E322B7306E900C3D686 /* UIStackView+.swift in Sources */, + 08FE43F42B73972500D09BB7 /* Client.swift in Sources */, 77B02E342B730AD700C3D686 /* Then.swift in Sources */, C7694E3D259C3E9F0053667F /* SceneDelegate.swift in Sources */, ); diff --git a/BankManagerUIApp/BankManagerUIApp/Client.swift b/BankManagerUIApp/BankManagerUIApp/Client.swift new file mode 100644 index 00000000..759b91cb --- /dev/null +++ b/BankManagerUIApp/BankManagerUIApp/Client.swift @@ -0,0 +1,18 @@ +// +// Customer.swift +// BankManagerUIApp +// +// Created by ㅣ on 2/7/24. +// + +import Foundation + +struct Client { + let number: Int + let bankTask: BankTask + + init(number: Int, bankTask: BankTask) { + self.number = number + self.bankTask = bankTask + } +} From 72e834b1bef14acd02e183763d237b03b24a07c9 Mon Sep 17 00:00:00 2001 From: suojae3 Date: Wed, 7 Feb 2024 19:50:58 +0900 Subject: [PATCH 08/31] =?UTF-8?q?feat:=20BankTask=20=EB=AA=A8=EB=8D=B8=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../project.pbxproj | 4 +++ .../BankManagerUIApp/BankTask.swift | 26 +++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 BankManagerUIApp/BankManagerUIApp/BankTask.swift diff --git a/BankManagerUIApp/BankManagerUIApp.xcodeproj/project.pbxproj b/BankManagerUIApp/BankManagerUIApp.xcodeproj/project.pbxproj index 72d84aba..e8294d47 100644 --- a/BankManagerUIApp/BankManagerUIApp.xcodeproj/project.pbxproj +++ b/BankManagerUIApp/BankManagerUIApp.xcodeproj/project.pbxproj @@ -8,6 +8,7 @@ /* Begin PBXBuildFile section */ 08FE43F42B73972500D09BB7 /* Client.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08FE43F32B73972500D09BB7 /* Client.swift */; }; + 08FE43F62B73977A00D09BB7 /* BankTask.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08FE43F52B73977A00D09BB7 /* BankTask.swift */; }; 77B02E322B7306E900C3D686 /* UIStackView+.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77B02E312B7306E900C3D686 /* UIStackView+.swift */; }; 77B02E342B730AD700C3D686 /* Then.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77B02E332B730AD700C3D686 /* Then.swift */; }; C7694E3B259C3E9F0053667F /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7694E3A259C3E9F0053667F /* AppDelegate.swift */; }; @@ -38,6 +39,7 @@ /* Begin PBXFileReference section */ 08FE43F32B73972500D09BB7 /* Client.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Client.swift; sourceTree = ""; }; + 08FE43F52B73977A00D09BB7 /* BankTask.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BankTask.swift; sourceTree = ""; }; 77B02E312B7306E900C3D686 /* UIStackView+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIStackView+.swift"; sourceTree = ""; }; 77B02E332B730AD700C3D686 /* Then.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Then.swift; sourceTree = ""; }; C7694E37259C3E9F0053667F /* BankManagerUIApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = BankManagerUIApp.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -105,6 +107,7 @@ children = ( C7694E3A259C3E9F0053667F /* AppDelegate.swift */, C7694E3C259C3E9F0053667F /* SceneDelegate.swift */, + 08FE43F52B73977A00D09BB7 /* BankTask.swift */, 08FE43F32B73972500D09BB7 /* Client.swift */, C7694E3E259C3E9F0053667F /* BankViewController.swift */, 77B02E312B7306E900C3D686 /* UIStackView+.swift */, @@ -265,6 +268,7 @@ files = ( C7694E3F259C3E9F0053667F /* BankViewController.swift in Sources */, C7694E3B259C3E9F0053667F /* AppDelegate.swift in Sources */, + 08FE43F62B73977A00D09BB7 /* BankTask.swift in Sources */, 77B02E322B7306E900C3D686 /* UIStackView+.swift in Sources */, 08FE43F42B73972500D09BB7 /* Client.swift in Sources */, 77B02E342B730AD700C3D686 /* Then.swift in Sources */, diff --git a/BankManagerUIApp/BankManagerUIApp/BankTask.swift b/BankManagerUIApp/BankManagerUIApp/BankTask.swift new file mode 100644 index 00000000..d733feed --- /dev/null +++ b/BankManagerUIApp/BankManagerUIApp/BankTask.swift @@ -0,0 +1,26 @@ +// +// BankTask.swift +// BankManagerUIApp +// +// Created by ㅣ on 2/7/24. +// + +import Foundation + +enum BankTask: String, CaseIterable { + case loan = "대출" + case deposit = "예금" + + var description: String { + return self.rawValue + } + + var requiredTime: Double { + switch self { + case .loan: + return 1.1 + case .deposit: + return 0.7 + } + } +} From d1ced4caea70012b494c2d711ac77ecd78473203 Mon Sep 17 00:00:00 2001 From: eunjuchoi Date: Wed, 7 Feb 2024 21:44:01 +0900 Subject: [PATCH 09/31] =?UTF-8?q?feat:=20ViewModel=20=ED=94=84=EB=A1=9C?= =?UTF-8?q?=ED=86=A0=EC=BD=9C=20=EC=A0=95=EC=9D=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BankManagerUIApp.xcodeproj/project.pbxproj | 4 ++++ BankManagerUIApp/BankManagerUIApp/ViewModel.swift | 15 +++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 BankManagerUIApp/BankManagerUIApp/ViewModel.swift diff --git a/BankManagerUIApp/BankManagerUIApp.xcodeproj/project.pbxproj b/BankManagerUIApp/BankManagerUIApp.xcodeproj/project.pbxproj index e8294d47..a9e2155e 100644 --- a/BankManagerUIApp/BankManagerUIApp.xcodeproj/project.pbxproj +++ b/BankManagerUIApp/BankManagerUIApp.xcodeproj/project.pbxproj @@ -9,6 +9,7 @@ /* Begin PBXBuildFile section */ 08FE43F42B73972500D09BB7 /* Client.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08FE43F32B73972500D09BB7 /* Client.swift */; }; 08FE43F62B73977A00D09BB7 /* BankTask.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08FE43F52B73977A00D09BB7 /* BankTask.swift */; }; + 7796775F2B73B208007315E8 /* ViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7796775E2B73B208007315E8 /* ViewModel.swift */; }; 77B02E322B7306E900C3D686 /* UIStackView+.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77B02E312B7306E900C3D686 /* UIStackView+.swift */; }; 77B02E342B730AD700C3D686 /* Then.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77B02E332B730AD700C3D686 /* Then.swift */; }; C7694E3B259C3E9F0053667F /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7694E3A259C3E9F0053667F /* AppDelegate.swift */; }; @@ -40,6 +41,7 @@ /* Begin PBXFileReference section */ 08FE43F32B73972500D09BB7 /* Client.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Client.swift; sourceTree = ""; }; 08FE43F52B73977A00D09BB7 /* BankTask.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BankTask.swift; sourceTree = ""; }; + 7796775E2B73B208007315E8 /* ViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewModel.swift; sourceTree = ""; }; 77B02E312B7306E900C3D686 /* UIStackView+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIStackView+.swift"; sourceTree = ""; }; 77B02E332B730AD700C3D686 /* Then.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Then.swift; sourceTree = ""; }; C7694E37259C3E9F0053667F /* BankManagerUIApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = BankManagerUIApp.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -110,6 +112,7 @@ 08FE43F52B73977A00D09BB7 /* BankTask.swift */, 08FE43F32B73972500D09BB7 /* Client.swift */, C7694E3E259C3E9F0053667F /* BankViewController.swift */, + 7796775E2B73B208007315E8 /* ViewModel.swift */, 77B02E312B7306E900C3D686 /* UIStackView+.swift */, 77B02E332B730AD700C3D686 /* Then.swift */, C7694E43259C3EA20053667F /* Assets.xcassets */, @@ -267,6 +270,7 @@ buildActionMask = 2147483647; files = ( C7694E3F259C3E9F0053667F /* BankViewController.swift in Sources */, + 7796775F2B73B208007315E8 /* ViewModel.swift in Sources */, C7694E3B259C3E9F0053667F /* AppDelegate.swift in Sources */, 08FE43F62B73977A00D09BB7 /* BankTask.swift in Sources */, 77B02E322B7306E900C3D686 /* UIStackView+.swift in Sources */, diff --git a/BankManagerUIApp/BankManagerUIApp/ViewModel.swift b/BankManagerUIApp/BankManagerUIApp/ViewModel.swift new file mode 100644 index 00000000..1bb469cd --- /dev/null +++ b/BankManagerUIApp/BankManagerUIApp/ViewModel.swift @@ -0,0 +1,15 @@ +// +// ViewModel.swift +// BankManagerUIApp +// +// Created by EUNJU on 2024/02/07. +// + +import Foundation + +protocol ViewModel { + associatedtype Input + associatedtype Output + + func transform(input: Input) -> Output +} From b4b54666d0ec235f88e733a1901ea1d5d957f91b Mon Sep 17 00:00:00 2001 From: eunjuchoi Date: Thu, 8 Feb 2024 09:45:36 +0900 Subject: [PATCH 10/31] =?UTF-8?q?feat:=20UITableViewCell+=20=ED=8C=8C?= =?UTF-8?q?=EC=9D=BC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../project.pbxproj | 4 ++++ .../BankManagerUIApp/UITableViewCell+.swift | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 BankManagerUIApp/BankManagerUIApp/UITableViewCell+.swift diff --git a/BankManagerUIApp/BankManagerUIApp.xcodeproj/project.pbxproj b/BankManagerUIApp/BankManagerUIApp.xcodeproj/project.pbxproj index a9e2155e..c8cbd0c1 100644 --- a/BankManagerUIApp/BankManagerUIApp.xcodeproj/project.pbxproj +++ b/BankManagerUIApp/BankManagerUIApp.xcodeproj/project.pbxproj @@ -10,6 +10,7 @@ 08FE43F42B73972500D09BB7 /* Client.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08FE43F32B73972500D09BB7 /* Client.swift */; }; 08FE43F62B73977A00D09BB7 /* BankTask.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08FE43F52B73977A00D09BB7 /* BankTask.swift */; }; 7796775F2B73B208007315E8 /* ViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7796775E2B73B208007315E8 /* ViewModel.swift */; }; + 779677632B74575F007315E8 /* UITableViewCell+.swift in Sources */ = {isa = PBXBuildFile; fileRef = 779677622B74575F007315E8 /* UITableViewCell+.swift */; }; 77B02E322B7306E900C3D686 /* UIStackView+.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77B02E312B7306E900C3D686 /* UIStackView+.swift */; }; 77B02E342B730AD700C3D686 /* Then.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77B02E332B730AD700C3D686 /* Then.swift */; }; C7694E3B259C3E9F0053667F /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7694E3A259C3E9F0053667F /* AppDelegate.swift */; }; @@ -42,6 +43,7 @@ 08FE43F32B73972500D09BB7 /* Client.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Client.swift; sourceTree = ""; }; 08FE43F52B73977A00D09BB7 /* BankTask.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BankTask.swift; sourceTree = ""; }; 7796775E2B73B208007315E8 /* ViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewModel.swift; sourceTree = ""; }; + 779677622B74575F007315E8 /* UITableViewCell+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UITableViewCell+.swift"; sourceTree = ""; }; 77B02E312B7306E900C3D686 /* UIStackView+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIStackView+.swift"; sourceTree = ""; }; 77B02E332B730AD700C3D686 /* Then.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Then.swift; sourceTree = ""; }; C7694E37259C3E9F0053667F /* BankManagerUIApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = BankManagerUIApp.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -112,6 +114,7 @@ 08FE43F52B73977A00D09BB7 /* BankTask.swift */, 08FE43F32B73972500D09BB7 /* Client.swift */, C7694E3E259C3E9F0053667F /* BankViewController.swift */, + 779677622B74575F007315E8 /* UITableViewCell+.swift */, 7796775E2B73B208007315E8 /* ViewModel.swift */, 77B02E312B7306E900C3D686 /* UIStackView+.swift */, 77B02E332B730AD700C3D686 /* Then.swift */, @@ -272,6 +275,7 @@ C7694E3F259C3E9F0053667F /* BankViewController.swift in Sources */, 7796775F2B73B208007315E8 /* ViewModel.swift in Sources */, C7694E3B259C3E9F0053667F /* AppDelegate.swift in Sources */, + 779677632B74575F007315E8 /* UITableViewCell+.swift in Sources */, 08FE43F62B73977A00D09BB7 /* BankTask.swift in Sources */, 77B02E322B7306E900C3D686 /* UIStackView+.swift in Sources */, 08FE43F42B73972500D09BB7 /* Client.swift in Sources */, diff --git a/BankManagerUIApp/BankManagerUIApp/UITableViewCell+.swift b/BankManagerUIApp/BankManagerUIApp/UITableViewCell+.swift new file mode 100644 index 00000000..0746309d --- /dev/null +++ b/BankManagerUIApp/BankManagerUIApp/UITableViewCell+.swift @@ -0,0 +1,19 @@ +// +// UITableViewCell+.swift +// BankManagerUIApp +// +// Created by EUNJU on 2024/02/08. +// + +import UIKit + +extension UITableViewCell { + + static var className: String { + NSStringFromClass(self.classForCoder()).components(separatedBy: ".").last ?? "" + } + + var className: String { + NSStringFromClass(self.classForCoder).components(separatedBy: ".").last ?? "" + } +} From 673aa2410259b5500ae5b59fb70a8bafbce7fbab Mon Sep 17 00:00:00 2001 From: eunjuchoi Date: Thu, 8 Feb 2024 09:46:26 +0900 Subject: [PATCH 11/31] =?UTF-8?q?feat:=20=EC=BB=A4=EC=8A=A4=ED=85=80=20tab?= =?UTF-8?q?leViewCell=20=EC=A0=95=EC=9D=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../project.pbxproj | 4 ++ .../ClientTableViewCell.swift | 41 +++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 BankManagerUIApp/BankManagerUIApp/ClientTableViewCell.swift diff --git a/BankManagerUIApp/BankManagerUIApp.xcodeproj/project.pbxproj b/BankManagerUIApp/BankManagerUIApp.xcodeproj/project.pbxproj index c8cbd0c1..e6d3ae55 100644 --- a/BankManagerUIApp/BankManagerUIApp.xcodeproj/project.pbxproj +++ b/BankManagerUIApp/BankManagerUIApp.xcodeproj/project.pbxproj @@ -9,6 +9,7 @@ /* Begin PBXBuildFile section */ 08FE43F42B73972500D09BB7 /* Client.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08FE43F32B73972500D09BB7 /* Client.swift */; }; 08FE43F62B73977A00D09BB7 /* BankTask.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08FE43F52B73977A00D09BB7 /* BankTask.swift */; }; + 7796775D2B73AB18007315E8 /* ClientTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7796775C2B73AB18007315E8 /* ClientTableViewCell.swift */; }; 7796775F2B73B208007315E8 /* ViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7796775E2B73B208007315E8 /* ViewModel.swift */; }; 779677632B74575F007315E8 /* UITableViewCell+.swift in Sources */ = {isa = PBXBuildFile; fileRef = 779677622B74575F007315E8 /* UITableViewCell+.swift */; }; 77B02E322B7306E900C3D686 /* UIStackView+.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77B02E312B7306E900C3D686 /* UIStackView+.swift */; }; @@ -42,6 +43,7 @@ /* Begin PBXFileReference section */ 08FE43F32B73972500D09BB7 /* Client.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Client.swift; sourceTree = ""; }; 08FE43F52B73977A00D09BB7 /* BankTask.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BankTask.swift; sourceTree = ""; }; + 7796775C2B73AB18007315E8 /* ClientTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ClientTableViewCell.swift; sourceTree = ""; }; 7796775E2B73B208007315E8 /* ViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewModel.swift; sourceTree = ""; }; 779677622B74575F007315E8 /* UITableViewCell+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UITableViewCell+.swift"; sourceTree = ""; }; 77B02E312B7306E900C3D686 /* UIStackView+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIStackView+.swift"; sourceTree = ""; }; @@ -115,6 +117,7 @@ 08FE43F32B73972500D09BB7 /* Client.swift */, C7694E3E259C3E9F0053667F /* BankViewController.swift */, 779677622B74575F007315E8 /* UITableViewCell+.swift */, + 7796775C2B73AB18007315E8 /* ClientTableViewCell.swift */, 7796775E2B73B208007315E8 /* ViewModel.swift */, 77B02E312B7306E900C3D686 /* UIStackView+.swift */, 77B02E332B730AD700C3D686 /* Then.swift */, @@ -277,6 +280,7 @@ C7694E3B259C3E9F0053667F /* AppDelegate.swift in Sources */, 779677632B74575F007315E8 /* UITableViewCell+.swift in Sources */, 08FE43F62B73977A00D09BB7 /* BankTask.swift in Sources */, + 7796775D2B73AB18007315E8 /* ClientTableViewCell.swift in Sources */, 77B02E322B7306E900C3D686 /* UIStackView+.swift in Sources */, 08FE43F42B73972500D09BB7 /* Client.swift in Sources */, 77B02E342B730AD700C3D686 /* Then.swift in Sources */, diff --git a/BankManagerUIApp/BankManagerUIApp/ClientTableViewCell.swift b/BankManagerUIApp/BankManagerUIApp/ClientTableViewCell.swift new file mode 100644 index 00000000..11d8c54a --- /dev/null +++ b/BankManagerUIApp/BankManagerUIApp/ClientTableViewCell.swift @@ -0,0 +1,41 @@ +// +// ClientTableViewCell.swift +// BankManagerUIApp +// +// Created by EUNJU on 2024/02/07. +// + +import UIKit + +final class ClientTableViewCell: UITableViewCell { + + private let titleLabel = UILabel().then { + $0.font = .systemFont(ofSize: 20) + } + + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + super.init(style: style, reuseIdentifier: reuseIdentifier) + + configureUI() + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + private func configureUI() { + selectionStyle = .none + + contentView.addSubview(titleLabel) + titleLabel.translatesAutoresizingMaskIntoConstraints = false + + NSLayoutConstraint.activate([ + titleLabel.centerXAnchor.constraint(equalTo: contentView.centerXAnchor), + titleLabel.centerYAnchor.constraint(equalTo: contentView.centerYAnchor) + ]) + } + + func setUpData(data: Client) { + titleLabel.text = "\(data.number) - \(data.bankTask.description)" + } +} From c547859be4d2fa03d68e835710ac9e4044630346 Mon Sep 17 00:00:00 2001 From: eunjuchoi Date: Thu, 8 Feb 2024 09:47:29 +0900 Subject: [PATCH 12/31] =?UTF-8?q?feat:=20=EB=8D=94=EB=AF=B8=EB=8D=B0?= =?UTF-8?q?=EC=9D=B4=ED=84=B0=EB=A5=BC=20=ED=99=9C=EC=9A=A9=ED=95=9C=20?= =?UTF-8?q?=ED=85=8C=EC=9D=B4=EB=B8=94=20=EB=B7=B0=20UI=20=EA=B5=AC?= =?UTF-8?q?=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BankManagerUIApp/BankViewController.swift | 76 ++++++++++++++++++- 1 file changed, 74 insertions(+), 2 deletions(-) diff --git a/BankManagerUIApp/BankManagerUIApp/BankViewController.swift b/BankManagerUIApp/BankManagerUIApp/BankViewController.swift index 3c933dbf..ca2c8d13 100644 --- a/BankManagerUIApp/BankManagerUIApp/BankViewController.swift +++ b/BankManagerUIApp/BankManagerUIApp/BankViewController.swift @@ -7,6 +7,27 @@ import UIKit final class BankViewController: UIViewController { + + // TODO: 데이터 위치 수정 예정 + private var waitingQueue: [Client] = [ + Client(number: 1, bankTask: .deposit), + Client(number: 2, bankTask: .deposit), + Client(number: 3, bankTask: .deposit), + Client(number: 4, bankTask: .deposit), + Client(number: 5, bankTask: .deposit), + Client(number: 6, bankTask: .deposit), + Client(number: 7, bankTask: .deposit), + Client(number: 8, bankTask: .deposit), + Client(number: 9, bankTask: .deposit), + Client(number: 10, bankTask: .deposit) + ] + + private var workingQueue: [Client] = [ + Client(number: 1, bankTask: .loan), + Client(number: 2, bankTask: .loan), + Client(number: 3, bankTask: .loan), + Client(number: 4, bankTask: .loan) + ] private let addCustomerButton = UIButton().then { $0.setTitle("고객 10명 추가", for: .normal) @@ -69,9 +90,13 @@ final class BankViewController: UIViewController { $0.translatesAutoresizingMaskIntoConstraints = false } - private let waitingQueueTableView = UITableView() + private let waitingQueueTableView = UITableView().then { + $0.separatorStyle = .none + } - private let workingQueueTableView = UITableView() + private let workingQueueTableView = UITableView().then { + $0.separatorStyle = .none + } private let tableStackView = UIStackView().then { $0.axis = .horizontal @@ -90,6 +115,7 @@ final class BankViewController: UIViewController { super.viewDidLoad() configureUI() + setUpTableView() } private func configureUI() { @@ -119,5 +145,51 @@ final class BankViewController: UIViewController { workingQueueTitleLabel.bottomAnchor.constraint(equalTo: purpleView.bottomAnchor) ]) } + + private func setUpTableView() { + [waitingQueueTableView, workingQueueTableView].forEach { + $0.register(ClientTableViewCell.self, forCellReuseIdentifier: ClientTableViewCell.className) + $0.delegate = self + $0.dataSource = self + } + } } +// MARK: - UITableViewDelegate +extension BankViewController: UITableViewDelegate { + + func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { + return 40 + } +} + +// MARK: - UITableViewDataSource +extension BankViewController: UITableViewDataSource { + + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + switch tableView { + case waitingQueueTableView: + return waitingQueue.count + case workingQueueTableView: + return workingQueue.count + default: + return 0 + } + } + + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + guard let cell = tableView.dequeueReusableCell(withIdentifier: ClientTableViewCell.className, for: indexPath) as? ClientTableViewCell + else { return UITableViewCell() } + + switch tableView { + case waitingQueueTableView: + cell.setUpData(data: waitingQueue[indexPath.row]) + case workingQueueTableView: + cell.setUpData(data: workingQueue[indexPath.row]) + default: + break + } + + return cell + } +} From 33b3c4d43b1f46a4282deff959414570a6477f66 Mon Sep 17 00:00:00 2001 From: suojae3 Date: Thu, 8 Feb 2024 10:23:20 +0900 Subject: [PATCH 13/31] =?UTF-8?q?feat:=20TimerHandler=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../project.pbxproj | 4 ++ .../BankManagerUIApp/TimerHandler.swift | 42 +++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 BankManagerUIApp/BankManagerUIApp/TimerHandler.swift diff --git a/BankManagerUIApp/BankManagerUIApp.xcodeproj/project.pbxproj b/BankManagerUIApp/BankManagerUIApp.xcodeproj/project.pbxproj index e6d3ae55..9d986226 100644 --- a/BankManagerUIApp/BankManagerUIApp.xcodeproj/project.pbxproj +++ b/BankManagerUIApp/BankManagerUIApp.xcodeproj/project.pbxproj @@ -9,6 +9,7 @@ /* Begin PBXBuildFile section */ 08FE43F42B73972500D09BB7 /* Client.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08FE43F32B73972500D09BB7 /* Client.swift */; }; 08FE43F62B73977A00D09BB7 /* BankTask.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08FE43F52B73977A00D09BB7 /* BankTask.swift */; }; + 08FE43FE2B74611C00D09BB7 /* TimerHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08FE43FD2B74611C00D09BB7 /* TimerHandler.swift */; }; 7796775D2B73AB18007315E8 /* ClientTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7796775C2B73AB18007315E8 /* ClientTableViewCell.swift */; }; 7796775F2B73B208007315E8 /* ViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7796775E2B73B208007315E8 /* ViewModel.swift */; }; 779677632B74575F007315E8 /* UITableViewCell+.swift in Sources */ = {isa = PBXBuildFile; fileRef = 779677622B74575F007315E8 /* UITableViewCell+.swift */; }; @@ -43,6 +44,7 @@ /* Begin PBXFileReference section */ 08FE43F32B73972500D09BB7 /* Client.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Client.swift; sourceTree = ""; }; 08FE43F52B73977A00D09BB7 /* BankTask.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BankTask.swift; sourceTree = ""; }; + 08FE43FD2B74611C00D09BB7 /* TimerHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimerHandler.swift; sourceTree = ""; }; 7796775C2B73AB18007315E8 /* ClientTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ClientTableViewCell.swift; sourceTree = ""; }; 7796775E2B73B208007315E8 /* ViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewModel.swift; sourceTree = ""; }; 779677622B74575F007315E8 /* UITableViewCell+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UITableViewCell+.swift"; sourceTree = ""; }; @@ -117,6 +119,7 @@ 08FE43F32B73972500D09BB7 /* Client.swift */, C7694E3E259C3E9F0053667F /* BankViewController.swift */, 779677622B74575F007315E8 /* UITableViewCell+.swift */, + 08FE43FD2B74611C00D09BB7 /* TimerHandler.swift */, 7796775C2B73AB18007315E8 /* ClientTableViewCell.swift */, 7796775E2B73B208007315E8 /* ViewModel.swift */, 77B02E312B7306E900C3D686 /* UIStackView+.swift */, @@ -282,6 +285,7 @@ 08FE43F62B73977A00D09BB7 /* BankTask.swift in Sources */, 7796775D2B73AB18007315E8 /* ClientTableViewCell.swift in Sources */, 77B02E322B7306E900C3D686 /* UIStackView+.swift in Sources */, + 08FE43FE2B74611C00D09BB7 /* TimerHandler.swift in Sources */, 08FE43F42B73972500D09BB7 /* Client.swift in Sources */, 77B02E342B730AD700C3D686 /* Then.swift in Sources */, C7694E3D259C3E9F0053667F /* SceneDelegate.swift in Sources */, diff --git a/BankManagerUIApp/BankManagerUIApp/TimerHandler.swift b/BankManagerUIApp/BankManagerUIApp/TimerHandler.swift new file mode 100644 index 00000000..11a4f295 --- /dev/null +++ b/BankManagerUIApp/BankManagerUIApp/TimerHandler.swift @@ -0,0 +1,42 @@ +// +// TimerHandler.swift +// BankManagerUIApp +// +// Created by ㅣ on 2/8/24. +// + +import Foundation + + +final class TimerHandler { + + private var timer = Timer() + private var count = 0 + private(set) var timeString = "" + + func startTimer() { + timer = Timer.scheduledTimer(timeInterval: 0.00001, target: self, selector: #selector(timerCounter), userInfo: nil, repeats: true) + } + + @objc func timerCounter() { + count += 1 + let time = secondsToHoursMinutesSeconds(seconds: count) + let timeString = makeTimeString(hours: time.0, minutes: time.1, seconds: time.2) + self.timeString = timeString + } + + private func secondsToHoursMinutesSeconds(seconds: Int) -> (Int, Int, Int) { + return ((seconds / 3600), ((seconds % 3600) / 60),((seconds % 3600) % 60)) + } + + private func makeTimeString(hours: Int, minutes: Int, seconds : Int) -> String { + var timeString = "" + timeString += String(format: "%02d", hours) + timeString += " : " + timeString += String(format: "%02d", minutes) + timeString += " : " + timeString += String(format: "%02d", seconds) + return timeString + } + +} From ddadc9f80a90d797e9cf143c88cfd7b6ca635975 Mon Sep 17 00:00:00 2001 From: suojae3 Date: Thu, 8 Feb 2024 10:43:08 +0900 Subject: [PATCH 14/31] =?UTF-8?q?chore:=20TimeUnit=20=EA=B5=AC=EC=A1=B0?= =?UTF-8?q?=EC=B2=B4=20=EC=B6=94=EA=B0=80=20=EB=B0=8F=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BankManagerUIApp/TimerHandler.swift | 31 ++++++++++--------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/BankManagerUIApp/BankManagerUIApp/TimerHandler.swift b/BankManagerUIApp/BankManagerUIApp/TimerHandler.swift index 11a4f295..38605fb0 100644 --- a/BankManagerUIApp/BankManagerUIApp/TimerHandler.swift +++ b/BankManagerUIApp/BankManagerUIApp/TimerHandler.swift @@ -7,8 +7,13 @@ import Foundation +private struct TimeUnit { + let hours: Int + let minutes: Int + let seconds: Int +} -final class TimerHandler { +final class TimerHandler { private var timer = Timer() private var count = 0 @@ -18,25 +23,23 @@ final class TimerHandler { timer = Timer.scheduledTimer(timeInterval: 0.00001, target: self, selector: #selector(timerCounter), userInfo: nil, repeats: true) } - @objc func timerCounter() { + func stopTimer() { + timer.invalidate() + timeString = "00:00:00" + } + + @objc private func timerCounter() { count += 1 let time = secondsToHoursMinutesSeconds(seconds: count) - let timeString = makeTimeString(hours: time.0, minutes: time.1, seconds: time.2) + let timeString = makeTimeString(time) self.timeString = timeString } - private func secondsToHoursMinutesSeconds(seconds: Int) -> (Int, Int, Int) { - return ((seconds / 3600), ((seconds % 3600) / 60),((seconds % 3600) % 60)) + private func secondsToHoursMinutesSeconds(seconds: Int) -> TimeUnit { + return TimeUnit.init(hours: (seconds / 3600), minutes: ((seconds % 3600) / 60), seconds: ((seconds % 3600) % 60)) } - private func makeTimeString(hours: Int, minutes: Int, seconds : Int) -> String { - var timeString = "" - timeString += String(format: "%02d", hours) - timeString += " : " - timeString += String(format: "%02d", minutes) - timeString += " : " - timeString += String(format: "%02d", seconds) - return timeString + private func makeTimeString(_ timeUnit: TimeUnit) -> String { + return String(format: "%02d:%02d:%02d", timeUnit.hours, timeUnit.minutes, timeUnit.seconds) } - } From b60a8535936ed7ab4059f16fe23b77b0d91b6fcb Mon Sep 17 00:00:00 2001 From: eunjuchoi Date: Thu, 8 Feb 2024 10:50:24 +0900 Subject: [PATCH 15/31] =?UTF-8?q?config:=20=ED=94=84=EB=A1=9C=EC=A0=9D?= =?UTF-8?q?=ED=8A=B8=20=ED=8C=8C=EC=9D=BC=20=ED=8F=B4=EB=8D=94=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../project.pbxproj | 104 +++++++++++++++--- .../{ => App}/AppDelegate.swift | 0 .../{ => App}/SceneDelegate.swift | 0 .../AccentColor.colorset/Contents.json | 0 .../AppIcon.appiconset/Contents.json | 0 .../Assets.xcassets/Contents.json | 0 .../Base.lproj/LaunchScreen.storyboard | 0 .../{ => Resource}/Info.plist | 0 .../BankScene}/BankViewController.swift | 0 .../BankScene}/ClientTableViewCell.swift | 0 .../{ => Scene/BankScene}/TimerHandler.swift | 0 .../{ => Util/Constant}/BankTask.swift | 0 .../{ => Util/Extension}/UIStackView+.swift | 0 .../Extension}/UITableViewCell+.swift | 0 .../{ => Util/Model}/Client.swift | 0 .../{ => Util/Protocol}/Then.swift | 0 .../{ => Util/Protocol}/ViewModel.swift | 0 17 files changed, 88 insertions(+), 16 deletions(-) rename BankManagerUIApp/BankManagerUIApp/{ => App}/AppDelegate.swift (100%) rename BankManagerUIApp/BankManagerUIApp/{ => App}/SceneDelegate.swift (100%) rename BankManagerUIApp/BankManagerUIApp/{ => Resource}/Assets.xcassets/AccentColor.colorset/Contents.json (100%) rename BankManagerUIApp/BankManagerUIApp/{ => Resource}/Assets.xcassets/AppIcon.appiconset/Contents.json (100%) rename BankManagerUIApp/BankManagerUIApp/{ => Resource}/Assets.xcassets/Contents.json (100%) rename BankManagerUIApp/BankManagerUIApp/{ => Resource}/Base.lproj/LaunchScreen.storyboard (100%) rename BankManagerUIApp/BankManagerUIApp/{ => Resource}/Info.plist (100%) rename BankManagerUIApp/BankManagerUIApp/{ => Scene/BankScene}/BankViewController.swift (100%) rename BankManagerUIApp/BankManagerUIApp/{ => Scene/BankScene}/ClientTableViewCell.swift (100%) rename BankManagerUIApp/BankManagerUIApp/{ => Scene/BankScene}/TimerHandler.swift (100%) rename BankManagerUIApp/BankManagerUIApp/{ => Util/Constant}/BankTask.swift (100%) rename BankManagerUIApp/BankManagerUIApp/{ => Util/Extension}/UIStackView+.swift (100%) rename BankManagerUIApp/BankManagerUIApp/{ => Util/Extension}/UITableViewCell+.swift (100%) rename BankManagerUIApp/BankManagerUIApp/{ => Util/Model}/Client.swift (100%) rename BankManagerUIApp/BankManagerUIApp/{ => Util/Protocol}/Then.swift (100%) rename BankManagerUIApp/BankManagerUIApp/{ => Util/Protocol}/ViewModel.swift (100%) diff --git a/BankManagerUIApp/BankManagerUIApp.xcodeproj/project.pbxproj b/BankManagerUIApp/BankManagerUIApp.xcodeproj/project.pbxproj index 9d986226..721bf391 100644 --- a/BankManagerUIApp/BankManagerUIApp.xcodeproj/project.pbxproj +++ b/BankManagerUIApp/BankManagerUIApp.xcodeproj/project.pbxproj @@ -90,6 +90,88 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 77F8FBA92B7469500085F544 /* App */ = { + isa = PBXGroup; + children = ( + C7694E3A259C3E9F0053667F /* AppDelegate.swift */, + C7694E3C259C3E9F0053667F /* SceneDelegate.swift */, + ); + path = App; + sourceTree = ""; + }; + 77F8FBAA2B7469630085F544 /* Util */ = { + isa = PBXGroup; + children = ( + 77F8FBB02B746A460085F544 /* Model */, + 77F8FBAD2B74699F0085F544 /* Constant */, + 77F8FBAC2B74697E0085F544 /* Protocol */, + 77F8FBAB2B74696D0085F544 /* Extension */, + ); + path = Util; + sourceTree = ""; + }; + 77F8FBAB2B74696D0085F544 /* Extension */ = { + isa = PBXGroup; + children = ( + 77B02E312B7306E900C3D686 /* UIStackView+.swift */, + 779677622B74575F007315E8 /* UITableViewCell+.swift */, + ); + path = Extension; + sourceTree = ""; + }; + 77F8FBAC2B74697E0085F544 /* Protocol */ = { + isa = PBXGroup; + children = ( + 7796775E2B73B208007315E8 /* ViewModel.swift */, + 77B02E332B730AD700C3D686 /* Then.swift */, + ); + path = Protocol; + sourceTree = ""; + }; + 77F8FBAD2B74699F0085F544 /* Constant */ = { + isa = PBXGroup; + children = ( + 08FE43F52B73977A00D09BB7 /* BankTask.swift */, + ); + path = Constant; + sourceTree = ""; + }; + 77F8FBAE2B7469CF0085F544 /* Resource */ = { + isa = PBXGroup; + children = ( + C7694E43259C3EA20053667F /* Assets.xcassets */, + C7694E45259C3EA20053667F /* LaunchScreen.storyboard */, + C7694E48259C3EA20053667F /* Info.plist */, + ); + path = Resource; + sourceTree = ""; + }; + 77F8FBAF2B746A1B0085F544 /* Scene */ = { + isa = PBXGroup; + children = ( + 77F8FBB12B746A520085F544 /* BankScene */, + ); + path = Scene; + sourceTree = ""; + }; + 77F8FBB02B746A460085F544 /* Model */ = { + isa = PBXGroup; + children = ( + 08FE43F32B73972500D09BB7 /* Client.swift */, + ); + path = Model; + sourceTree = ""; + }; + 77F8FBB12B746A520085F544 /* BankScene */ = { + isa = PBXGroup; + children = ( + C7694E3E259C3E9F0053667F /* BankViewController.swift */, + 7796775C2B73AB18007315E8 /* ClientTableViewCell.swift */, + 08FE43FD2B74611C00D09BB7 /* TimerHandler.swift */, + ); + path = BankScene; + sourceTree = ""; + }; C7694E2E259C3E9F0053667F = { isa = PBXGroup; children = ( @@ -113,20 +195,10 @@ C7694E39259C3E9F0053667F /* BankManagerUIApp */ = { isa = PBXGroup; children = ( - C7694E3A259C3E9F0053667F /* AppDelegate.swift */, - C7694E3C259C3E9F0053667F /* SceneDelegate.swift */, - 08FE43F52B73977A00D09BB7 /* BankTask.swift */, - 08FE43F32B73972500D09BB7 /* Client.swift */, - C7694E3E259C3E9F0053667F /* BankViewController.swift */, - 779677622B74575F007315E8 /* UITableViewCell+.swift */, - 08FE43FD2B74611C00D09BB7 /* TimerHandler.swift */, - 7796775C2B73AB18007315E8 /* ClientTableViewCell.swift */, - 7796775E2B73B208007315E8 /* ViewModel.swift */, - 77B02E312B7306E900C3D686 /* UIStackView+.swift */, - 77B02E332B730AD700C3D686 /* Then.swift */, - C7694E43259C3EA20053667F /* Assets.xcassets */, - C7694E45259C3EA20053667F /* LaunchScreen.storyboard */, - C7694E48259C3EA20053667F /* Info.plist */, + 77F8FBA92B7469500085F544 /* App */, + 77F8FBAA2B7469630085F544 /* Util */, + 77F8FBAF2B746A1B0085F544 /* Scene */, + 77F8FBAE2B7469CF0085F544 /* Resource */, ); path = BankManagerUIApp; sourceTree = ""; @@ -457,7 +529,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; - INFOPLIST_FILE = BankManagerUIApp/Info.plist; + INFOPLIST_FILE = BankManagerUIApp/Resource/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 14.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", @@ -476,7 +548,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; - INFOPLIST_FILE = BankManagerUIApp/Info.plist; + INFOPLIST_FILE = BankManagerUIApp/Resource/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 14.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", diff --git a/BankManagerUIApp/BankManagerUIApp/AppDelegate.swift b/BankManagerUIApp/BankManagerUIApp/App/AppDelegate.swift similarity index 100% rename from BankManagerUIApp/BankManagerUIApp/AppDelegate.swift rename to BankManagerUIApp/BankManagerUIApp/App/AppDelegate.swift diff --git a/BankManagerUIApp/BankManagerUIApp/SceneDelegate.swift b/BankManagerUIApp/BankManagerUIApp/App/SceneDelegate.swift similarity index 100% rename from BankManagerUIApp/BankManagerUIApp/SceneDelegate.swift rename to BankManagerUIApp/BankManagerUIApp/App/SceneDelegate.swift diff --git a/BankManagerUIApp/BankManagerUIApp/Assets.xcassets/AccentColor.colorset/Contents.json b/BankManagerUIApp/BankManagerUIApp/Resource/Assets.xcassets/AccentColor.colorset/Contents.json similarity index 100% rename from BankManagerUIApp/BankManagerUIApp/Assets.xcassets/AccentColor.colorset/Contents.json rename to BankManagerUIApp/BankManagerUIApp/Resource/Assets.xcassets/AccentColor.colorset/Contents.json diff --git a/BankManagerUIApp/BankManagerUIApp/Assets.xcassets/AppIcon.appiconset/Contents.json b/BankManagerUIApp/BankManagerUIApp/Resource/Assets.xcassets/AppIcon.appiconset/Contents.json similarity index 100% rename from BankManagerUIApp/BankManagerUIApp/Assets.xcassets/AppIcon.appiconset/Contents.json rename to BankManagerUIApp/BankManagerUIApp/Resource/Assets.xcassets/AppIcon.appiconset/Contents.json diff --git a/BankManagerUIApp/BankManagerUIApp/Assets.xcassets/Contents.json b/BankManagerUIApp/BankManagerUIApp/Resource/Assets.xcassets/Contents.json similarity index 100% rename from BankManagerUIApp/BankManagerUIApp/Assets.xcassets/Contents.json rename to BankManagerUIApp/BankManagerUIApp/Resource/Assets.xcassets/Contents.json diff --git a/BankManagerUIApp/BankManagerUIApp/Base.lproj/LaunchScreen.storyboard b/BankManagerUIApp/BankManagerUIApp/Resource/Base.lproj/LaunchScreen.storyboard similarity index 100% rename from BankManagerUIApp/BankManagerUIApp/Base.lproj/LaunchScreen.storyboard rename to BankManagerUIApp/BankManagerUIApp/Resource/Base.lproj/LaunchScreen.storyboard diff --git a/BankManagerUIApp/BankManagerUIApp/Info.plist b/BankManagerUIApp/BankManagerUIApp/Resource/Info.plist similarity index 100% rename from BankManagerUIApp/BankManagerUIApp/Info.plist rename to BankManagerUIApp/BankManagerUIApp/Resource/Info.plist diff --git a/BankManagerUIApp/BankManagerUIApp/BankViewController.swift b/BankManagerUIApp/BankManagerUIApp/Scene/BankScene/BankViewController.swift similarity index 100% rename from BankManagerUIApp/BankManagerUIApp/BankViewController.swift rename to BankManagerUIApp/BankManagerUIApp/Scene/BankScene/BankViewController.swift diff --git a/BankManagerUIApp/BankManagerUIApp/ClientTableViewCell.swift b/BankManagerUIApp/BankManagerUIApp/Scene/BankScene/ClientTableViewCell.swift similarity index 100% rename from BankManagerUIApp/BankManagerUIApp/ClientTableViewCell.swift rename to BankManagerUIApp/BankManagerUIApp/Scene/BankScene/ClientTableViewCell.swift diff --git a/BankManagerUIApp/BankManagerUIApp/TimerHandler.swift b/BankManagerUIApp/BankManagerUIApp/Scene/BankScene/TimerHandler.swift similarity index 100% rename from BankManagerUIApp/BankManagerUIApp/TimerHandler.swift rename to BankManagerUIApp/BankManagerUIApp/Scene/BankScene/TimerHandler.swift diff --git a/BankManagerUIApp/BankManagerUIApp/BankTask.swift b/BankManagerUIApp/BankManagerUIApp/Util/Constant/BankTask.swift similarity index 100% rename from BankManagerUIApp/BankManagerUIApp/BankTask.swift rename to BankManagerUIApp/BankManagerUIApp/Util/Constant/BankTask.swift diff --git a/BankManagerUIApp/BankManagerUIApp/UIStackView+.swift b/BankManagerUIApp/BankManagerUIApp/Util/Extension/UIStackView+.swift similarity index 100% rename from BankManagerUIApp/BankManagerUIApp/UIStackView+.swift rename to BankManagerUIApp/BankManagerUIApp/Util/Extension/UIStackView+.swift diff --git a/BankManagerUIApp/BankManagerUIApp/UITableViewCell+.swift b/BankManagerUIApp/BankManagerUIApp/Util/Extension/UITableViewCell+.swift similarity index 100% rename from BankManagerUIApp/BankManagerUIApp/UITableViewCell+.swift rename to BankManagerUIApp/BankManagerUIApp/Util/Extension/UITableViewCell+.swift diff --git a/BankManagerUIApp/BankManagerUIApp/Client.swift b/BankManagerUIApp/BankManagerUIApp/Util/Model/Client.swift similarity index 100% rename from BankManagerUIApp/BankManagerUIApp/Client.swift rename to BankManagerUIApp/BankManagerUIApp/Util/Model/Client.swift diff --git a/BankManagerUIApp/BankManagerUIApp/Then.swift b/BankManagerUIApp/BankManagerUIApp/Util/Protocol/Then.swift similarity index 100% rename from BankManagerUIApp/BankManagerUIApp/Then.swift rename to BankManagerUIApp/BankManagerUIApp/Util/Protocol/Then.swift diff --git a/BankManagerUIApp/BankManagerUIApp/ViewModel.swift b/BankManagerUIApp/BankManagerUIApp/Util/Protocol/ViewModel.swift similarity index 100% rename from BankManagerUIApp/BankManagerUIApp/ViewModel.swift rename to BankManagerUIApp/BankManagerUIApp/Util/Protocol/ViewModel.swift From e9686addf6a58742913c0545740eb7516670b577 Mon Sep 17 00:00:00 2001 From: eunjuchoi Date: Thu, 8 Feb 2024 15:38:40 +0900 Subject: [PATCH 16/31] =?UTF-8?q?feat:=20Observable=20=ED=83=80=EC=9E=85?= =?UTF-8?q?=20=EC=A0=95=EC=9D=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../project.pbxproj | 10 +++++-- .../Util/{Model => Type}/Client.swift | 0 .../Util/Type/Observable.swift | 28 +++++++++++++++++++ 3 files changed, 35 insertions(+), 3 deletions(-) rename BankManagerUIApp/BankManagerUIApp/Util/{Model => Type}/Client.swift (100%) create mode 100644 BankManagerUIApp/BankManagerUIApp/Util/Type/Observable.swift diff --git a/BankManagerUIApp/BankManagerUIApp.xcodeproj/project.pbxproj b/BankManagerUIApp/BankManagerUIApp.xcodeproj/project.pbxproj index 721bf391..e5ce5486 100644 --- a/BankManagerUIApp/BankManagerUIApp.xcodeproj/project.pbxproj +++ b/BankManagerUIApp/BankManagerUIApp.xcodeproj/project.pbxproj @@ -15,6 +15,7 @@ 779677632B74575F007315E8 /* UITableViewCell+.swift in Sources */ = {isa = PBXBuildFile; fileRef = 779677622B74575F007315E8 /* UITableViewCell+.swift */; }; 77B02E322B7306E900C3D686 /* UIStackView+.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77B02E312B7306E900C3D686 /* UIStackView+.swift */; }; 77B02E342B730AD700C3D686 /* Then.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77B02E332B730AD700C3D686 /* Then.swift */; }; + 77F8FBB52B74AE510085F544 /* Observable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77F8FBB42B74AE510085F544 /* Observable.swift */; }; C7694E3B259C3E9F0053667F /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7694E3A259C3E9F0053667F /* AppDelegate.swift */; }; C7694E3D259C3E9F0053667F /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7694E3C259C3E9F0053667F /* SceneDelegate.swift */; }; C7694E3F259C3E9F0053667F /* BankViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7694E3E259C3E9F0053667F /* BankViewController.swift */; }; @@ -50,6 +51,7 @@ 779677622B74575F007315E8 /* UITableViewCell+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UITableViewCell+.swift"; sourceTree = ""; }; 77B02E312B7306E900C3D686 /* UIStackView+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIStackView+.swift"; sourceTree = ""; }; 77B02E332B730AD700C3D686 /* Then.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Then.swift; sourceTree = ""; }; + 77F8FBB42B74AE510085F544 /* Observable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Observable.swift; sourceTree = ""; }; C7694E37259C3E9F0053667F /* BankManagerUIApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = BankManagerUIApp.app; sourceTree = BUILT_PRODUCTS_DIR; }; C7694E3A259C3E9F0053667F /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; C7694E3C259C3E9F0053667F /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; @@ -102,7 +104,7 @@ 77F8FBAA2B7469630085F544 /* Util */ = { isa = PBXGroup; children = ( - 77F8FBB02B746A460085F544 /* Model */, + 77F8FBB02B746A460085F544 /* Type */, 77F8FBAD2B74699F0085F544 /* Constant */, 77F8FBAC2B74697E0085F544 /* Protocol */, 77F8FBAB2B74696D0085F544 /* Extension */, @@ -154,12 +156,13 @@ path = Scene; sourceTree = ""; }; - 77F8FBB02B746A460085F544 /* Model */ = { + 77F8FBB02B746A460085F544 /* Type */ = { isa = PBXGroup; children = ( 08FE43F32B73972500D09BB7 /* Client.swift */, + 77F8FBB42B74AE510085F544 /* Observable.swift */, ); - path = Model; + path = Type; sourceTree = ""; }; 77F8FBB12B746A520085F544 /* BankScene */ = { @@ -354,6 +357,7 @@ 7796775F2B73B208007315E8 /* ViewModel.swift in Sources */, C7694E3B259C3E9F0053667F /* AppDelegate.swift in Sources */, 779677632B74575F007315E8 /* UITableViewCell+.swift in Sources */, + 77F8FBB52B74AE510085F544 /* Observable.swift in Sources */, 08FE43F62B73977A00D09BB7 /* BankTask.swift in Sources */, 7796775D2B73AB18007315E8 /* ClientTableViewCell.swift in Sources */, 77B02E322B7306E900C3D686 /* UIStackView+.swift in Sources */, diff --git a/BankManagerUIApp/BankManagerUIApp/Util/Model/Client.swift b/BankManagerUIApp/BankManagerUIApp/Util/Type/Client.swift similarity index 100% rename from BankManagerUIApp/BankManagerUIApp/Util/Model/Client.swift rename to BankManagerUIApp/BankManagerUIApp/Util/Type/Client.swift diff --git a/BankManagerUIApp/BankManagerUIApp/Util/Type/Observable.swift b/BankManagerUIApp/BankManagerUIApp/Util/Type/Observable.swift new file mode 100644 index 00000000..1b57c15c --- /dev/null +++ b/BankManagerUIApp/BankManagerUIApp/Util/Type/Observable.swift @@ -0,0 +1,28 @@ +// +// Observable.swift +// BankManagerUIApp +// +// Created by EUNJU on 2024/02/08. +// + +import Foundation + +final class Observable { + + private var listener: ((T) -> Void)? + + var value: T { + didSet { + self.listener?(value) + } + } + + init(_ value: T) { + self.value = value + } + + func subscribe(_ closure: @escaping (T) -> Void) { + closure(value) + self.listener = closure + } +} From 9b1cdd99574e13596023dfa4c63ba1439d04a467 Mon Sep 17 00:00:00 2001 From: eunjuchoi Date: Thu, 8 Feb 2024 16:15:57 +0900 Subject: [PATCH 17/31] =?UTF-8?q?feat:=20BankRepository=20=EC=A0=95?= =?UTF-8?q?=EC=9D=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../project.pbxproj | 3 +++ .../Model/BankRepository.swift | 26 +++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 BankManagerUIApp/BankManagerUIApp/Model/BankRepository.swift diff --git a/BankManagerUIApp/BankManagerUIApp.xcodeproj/project.pbxproj b/BankManagerUIApp/BankManagerUIApp.xcodeproj/project.pbxproj index e5ce5486..93e2d4ff 100644 --- a/BankManagerUIApp/BankManagerUIApp.xcodeproj/project.pbxproj +++ b/BankManagerUIApp/BankManagerUIApp.xcodeproj/project.pbxproj @@ -16,6 +16,7 @@ 77B02E322B7306E900C3D686 /* UIStackView+.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77B02E312B7306E900C3D686 /* UIStackView+.swift */; }; 77B02E342B730AD700C3D686 /* Then.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77B02E332B730AD700C3D686 /* Then.swift */; }; 77F8FBB52B74AE510085F544 /* Observable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77F8FBB42B74AE510085F544 /* Observable.swift */; }; + 77F8FBBA2B74B6A40085F544 /* BankRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77F8FBB92B74B6A40085F544 /* BankRepository.swift */; }; C7694E3B259C3E9F0053667F /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7694E3A259C3E9F0053667F /* AppDelegate.swift */; }; C7694E3D259C3E9F0053667F /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7694E3C259C3E9F0053667F /* SceneDelegate.swift */; }; C7694E3F259C3E9F0053667F /* BankViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7694E3E259C3E9F0053667F /* BankViewController.swift */; }; @@ -52,6 +53,7 @@ 77B02E312B7306E900C3D686 /* UIStackView+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIStackView+.swift"; sourceTree = ""; }; 77B02E332B730AD700C3D686 /* Then.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Then.swift; sourceTree = ""; }; 77F8FBB42B74AE510085F544 /* Observable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Observable.swift; sourceTree = ""; }; + 77F8FBB92B74B6A40085F544 /* BankRepository.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BankRepository.swift; sourceTree = ""; }; C7694E37259C3E9F0053667F /* BankManagerUIApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = BankManagerUIApp.app; sourceTree = BUILT_PRODUCTS_DIR; }; C7694E3A259C3E9F0053667F /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; C7694E3C259C3E9F0053667F /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; @@ -353,6 +355,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 77F8FBBA2B74B6A40085F544 /* BankRepository.swift in Sources */, C7694E3F259C3E9F0053667F /* BankViewController.swift in Sources */, 7796775F2B73B208007315E8 /* ViewModel.swift in Sources */, C7694E3B259C3E9F0053667F /* AppDelegate.swift in Sources */, diff --git a/BankManagerUIApp/BankManagerUIApp/Model/BankRepository.swift b/BankManagerUIApp/BankManagerUIApp/Model/BankRepository.swift new file mode 100644 index 00000000..2c280961 --- /dev/null +++ b/BankManagerUIApp/BankManagerUIApp/Model/BankRepository.swift @@ -0,0 +1,26 @@ +// +// BankRepository.swift +// BankManagerUIApp +// +// Created by EUNJU on 2024/02/08. +// + +import Foundation + +final class BankRepository { + + private var clientNumber: Int = 1 + + func makeClientData(onCompleted: @escaping ([Client]) -> Void) { + let startNumber = clientNumber + var waitingQueue: [Client] = [] + + (startNumber..<(startNumber + 10)).forEach { + guard let task = BankTask.allCases.randomElement() else { return } + waitingQueue.append(Client(number: $0, bankTask: task)) + } + + clientNumber += 10 + onCompleted(waitingQueue) + } +} From ab84765907d4c2193e2e2ee6d799722928d06673 Mon Sep 17 00:00:00 2001 From: eunjuchoi Date: Thu, 8 Feb 2024 16:17:32 +0900 Subject: [PATCH 18/31] =?UTF-8?q?feat:=20BankViewModel=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=20=EB=B0=8F=20=ED=8F=B4=EB=8D=94=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../project.pbxproj | 13 ++++++++++++ .../Scene/BankScene/BankViewModel.swift | 21 +++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 BankManagerUIApp/BankManagerUIApp/Scene/BankScene/BankViewModel.swift diff --git a/BankManagerUIApp/BankManagerUIApp.xcodeproj/project.pbxproj b/BankManagerUIApp/BankManagerUIApp.xcodeproj/project.pbxproj index 93e2d4ff..99260578 100644 --- a/BankManagerUIApp/BankManagerUIApp.xcodeproj/project.pbxproj +++ b/BankManagerUIApp/BankManagerUIApp.xcodeproj/project.pbxproj @@ -16,6 +16,7 @@ 77B02E322B7306E900C3D686 /* UIStackView+.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77B02E312B7306E900C3D686 /* UIStackView+.swift */; }; 77B02E342B730AD700C3D686 /* Then.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77B02E332B730AD700C3D686 /* Then.swift */; }; 77F8FBB52B74AE510085F544 /* Observable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77F8FBB42B74AE510085F544 /* Observable.swift */; }; + 77F8FBB72B74AEEF0085F544 /* BankViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77F8FBB62B74AEEF0085F544 /* BankViewModel.swift */; }; 77F8FBBA2B74B6A40085F544 /* BankRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77F8FBB92B74B6A40085F544 /* BankRepository.swift */; }; C7694E3B259C3E9F0053667F /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7694E3A259C3E9F0053667F /* AppDelegate.swift */; }; C7694E3D259C3E9F0053667F /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7694E3C259C3E9F0053667F /* SceneDelegate.swift */; }; @@ -53,6 +54,7 @@ 77B02E312B7306E900C3D686 /* UIStackView+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIStackView+.swift"; sourceTree = ""; }; 77B02E332B730AD700C3D686 /* Then.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Then.swift; sourceTree = ""; }; 77F8FBB42B74AE510085F544 /* Observable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Observable.swift; sourceTree = ""; }; + 77F8FBB62B74AEEF0085F544 /* BankViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BankViewModel.swift; sourceTree = ""; }; 77F8FBB92B74B6A40085F544 /* BankRepository.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BankRepository.swift; sourceTree = ""; }; C7694E37259C3E9F0053667F /* BankManagerUIApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = BankManagerUIApp.app; sourceTree = BUILT_PRODUCTS_DIR; }; C7694E3A259C3E9F0053667F /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; @@ -173,10 +175,19 @@ C7694E3E259C3E9F0053667F /* BankViewController.swift */, 7796775C2B73AB18007315E8 /* ClientTableViewCell.swift */, 08FE43FD2B74611C00D09BB7 /* TimerHandler.swift */, + 77F8FBB62B74AEEF0085F544 /* BankViewModel.swift */, ); path = BankScene; sourceTree = ""; }; + 77F8FBB82B74B67D0085F544 /* Model */ = { + isa = PBXGroup; + children = ( + 77F8FBB92B74B6A40085F544 /* BankRepository.swift */, + ); + path = Model; + sourceTree = ""; + }; C7694E2E259C3E9F0053667F = { isa = PBXGroup; children = ( @@ -202,6 +213,7 @@ children = ( 77F8FBA92B7469500085F544 /* App */, 77F8FBAA2B7469630085F544 /* Util */, + 77F8FBB82B74B67D0085F544 /* Model */, 77F8FBAF2B746A1B0085F544 /* Scene */, 77F8FBAE2B7469CF0085F544 /* Resource */, ); @@ -355,6 +367,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 77F8FBB72B74AEEF0085F544 /* BankViewModel.swift in Sources */, 77F8FBBA2B74B6A40085F544 /* BankRepository.swift in Sources */, C7694E3F259C3E9F0053667F /* BankViewController.swift in Sources */, 7796775F2B73B208007315E8 /* ViewModel.swift in Sources */, diff --git a/BankManagerUIApp/BankManagerUIApp/Scene/BankScene/BankViewModel.swift b/BankManagerUIApp/BankManagerUIApp/Scene/BankScene/BankViewModel.swift new file mode 100644 index 00000000..2c72c4be --- /dev/null +++ b/BankManagerUIApp/BankManagerUIApp/Scene/BankScene/BankViewModel.swift @@ -0,0 +1,21 @@ +// +// BankViewModel.swift +// BankManagerUIApp +// +// Created by EUNJU on 2024/02/08. +// + +import Foundation + +final class BankViewModel { + + private let repository = BankRepository() + + private(set) var waitingClients: Observable<[Client]> = Observable([]) + + func fetchData() { + repository.makeClientData { [weak self] result in + self?.waitingClients.value += result + } + } +} From 90b816d35677db0739459eff780551d5d74e3420 Mon Sep 17 00:00:00 2001 From: eunjuchoi Date: Thu, 8 Feb 2024 16:17:58 +0900 Subject: [PATCH 19/31] =?UTF-8?q?feat:=20=EA=B3=A0=EA=B0=9D=2010=EB=AA=85?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80=20=EA=B8=B0=EB=8A=A5=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Scene/BankScene/BankViewController.swift | 49 +++++++++++++------ 1 file changed, 34 insertions(+), 15 deletions(-) diff --git a/BankManagerUIApp/BankManagerUIApp/Scene/BankScene/BankViewController.swift b/BankManagerUIApp/BankManagerUIApp/Scene/BankScene/BankViewController.swift index ca2c8d13..7498e782 100644 --- a/BankManagerUIApp/BankManagerUIApp/Scene/BankScene/BankViewController.swift +++ b/BankManagerUIApp/BankManagerUIApp/Scene/BankScene/BankViewController.swift @@ -9,19 +9,6 @@ import UIKit final class BankViewController: UIViewController { // TODO: 데이터 위치 수정 예정 - private var waitingQueue: [Client] = [ - Client(number: 1, bankTask: .deposit), - Client(number: 2, bankTask: .deposit), - Client(number: 3, bankTask: .deposit), - Client(number: 4, bankTask: .deposit), - Client(number: 5, bankTask: .deposit), - Client(number: 6, bankTask: .deposit), - Client(number: 7, bankTask: .deposit), - Client(number: 8, bankTask: .deposit), - Client(number: 9, bankTask: .deposit), - Client(number: 10, bankTask: .deposit) - ] - private var workingQueue: [Client] = [ Client(number: 1, bankTask: .loan), Client(number: 2, bankTask: .loan), @@ -111,11 +98,24 @@ final class BankViewController: UIViewController { $0.translatesAutoresizingMaskIntoConstraints = false } + private let viewModel: BankViewModel + + init(viewModel: BankViewModel) { + self.viewModel = viewModel + super.init(nibName: nil, bundle: nil) + } + + required init?(coder: NSCoder) { + fatalError("BankViewController Init Error!") + } + override func viewDidLoad() { super.viewDidLoad() configureUI() setUpTableView() + addButtonTarget() + bind() } private func configureUI() { @@ -153,6 +153,25 @@ final class BankViewController: UIViewController { $0.dataSource = self } } + + private func addButtonTarget() { + addCustomerButton.addTarget(self, action: #selector(addCustommerButtonDidTap), for: .touchUpInside) + resetButton.addTarget(self, action: #selector(resetButtonDidTap), for: .touchUpInside) + } + + private func bind() { + viewModel.waitingClients.subscribe { [weak self] _ in + self?.waitingQueueTableView.reloadData() + } + } + + @objc private func addCustommerButtonDidTap() { + viewModel.fetchData() + } + + @objc private func resetButtonDidTap() { + + } } // MARK: - UITableViewDelegate @@ -169,7 +188,7 @@ extension BankViewController: UITableViewDataSource { func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { switch tableView { case waitingQueueTableView: - return waitingQueue.count + return viewModel.waitingClients.value.count case workingQueueTableView: return workingQueue.count default: @@ -183,7 +202,7 @@ extension BankViewController: UITableViewDataSource { switch tableView { case waitingQueueTableView: - cell.setUpData(data: waitingQueue[indexPath.row]) + cell.setUpData(data: viewModel.waitingClients.value[indexPath.row]) case workingQueueTableView: cell.setUpData(data: workingQueue[indexPath.row]) default: From f614f299ae6a0cbb83b3b6bf4bdbec58a217bfe8 Mon Sep 17 00:00:00 2001 From: eunjuchoi Date: Thu, 8 Feb 2024 16:18:10 +0900 Subject: [PATCH 20/31] =?UTF-8?q?feat:=20=EC=9D=98=EC=A1=B4=EC=84=B1=20?= =?UTF-8?q?=EC=A3=BC=EC=9E=85=20=EC=BD=94=EB=93=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BankManagerUIApp/BankManagerUIApp/App/SceneDelegate.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BankManagerUIApp/BankManagerUIApp/App/SceneDelegate.swift b/BankManagerUIApp/BankManagerUIApp/App/SceneDelegate.swift index 6ae236ea..deffed98 100644 --- a/BankManagerUIApp/BankManagerUIApp/App/SceneDelegate.swift +++ b/BankManagerUIApp/BankManagerUIApp/App/SceneDelegate.swift @@ -14,7 +14,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { guard let windowScene = (scene as? UIWindowScene) else { return } window = UIWindow(windowScene: windowScene) - window?.rootViewController = BankViewController() + window?.rootViewController = BankViewController(viewModel: BankViewModel()) window?.makeKeyAndVisible() } From f6e4a0e6e689a490aef2a33133f2f593e432c0f1 Mon Sep 17 00:00:00 2001 From: suojae3 Date: Thu, 8 Feb 2024 16:32:46 +0900 Subject: [PATCH 21/31] =?UTF-8?q?chore:=20BankTimer=20=EB=84=A4=EC=9D=B4?= =?UTF-8?q?=EB=B0=8D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BankManagerUIApp.xcodeproj/project.pbxproj | 10 ++++++---- .../{TimerHandler.swift => BankTimer.swift} | 18 +++++++++--------- 2 files changed, 15 insertions(+), 13 deletions(-) rename BankManagerUIApp/BankManagerUIApp/Scene/BankScene/{TimerHandler.swift => BankTimer.swift} (68%) diff --git a/BankManagerUIApp/BankManagerUIApp.xcodeproj/project.pbxproj b/BankManagerUIApp/BankManagerUIApp.xcodeproj/project.pbxproj index 99260578..d88b5a4c 100644 --- a/BankManagerUIApp/BankManagerUIApp.xcodeproj/project.pbxproj +++ b/BankManagerUIApp/BankManagerUIApp.xcodeproj/project.pbxproj @@ -9,7 +9,7 @@ /* Begin PBXBuildFile section */ 08FE43F42B73972500D09BB7 /* Client.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08FE43F32B73972500D09BB7 /* Client.swift */; }; 08FE43F62B73977A00D09BB7 /* BankTask.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08FE43F52B73977A00D09BB7 /* BankTask.swift */; }; - 08FE43FE2B74611C00D09BB7 /* TimerHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08FE43FD2B74611C00D09BB7 /* TimerHandler.swift */; }; + 08FE43FE2B74611C00D09BB7 /* BankTimer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08FE43FD2B74611C00D09BB7 /* BankTimer.swift */; }; 7796775D2B73AB18007315E8 /* ClientTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7796775C2B73AB18007315E8 /* ClientTableViewCell.swift */; }; 7796775F2B73B208007315E8 /* ViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7796775E2B73B208007315E8 /* ViewModel.swift */; }; 779677632B74575F007315E8 /* UITableViewCell+.swift in Sources */ = {isa = PBXBuildFile; fileRef = 779677622B74575F007315E8 /* UITableViewCell+.swift */; }; @@ -47,7 +47,7 @@ /* Begin PBXFileReference section */ 08FE43F32B73972500D09BB7 /* Client.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Client.swift; sourceTree = ""; }; 08FE43F52B73977A00D09BB7 /* BankTask.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BankTask.swift; sourceTree = ""; }; - 08FE43FD2B74611C00D09BB7 /* TimerHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimerHandler.swift; sourceTree = ""; }; + 08FE43FD2B74611C00D09BB7 /* BankTimer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BankTimer.swift; sourceTree = ""; }; 7796775C2B73AB18007315E8 /* ClientTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ClientTableViewCell.swift; sourceTree = ""; }; 7796775E2B73B208007315E8 /* ViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewModel.swift; sourceTree = ""; }; 779677622B74575F007315E8 /* UITableViewCell+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UITableViewCell+.swift"; sourceTree = ""; }; @@ -174,7 +174,7 @@ children = ( C7694E3E259C3E9F0053667F /* BankViewController.swift */, 7796775C2B73AB18007315E8 /* ClientTableViewCell.swift */, - 08FE43FD2B74611C00D09BB7 /* TimerHandler.swift */, + 08FE43FD2B74611C00D09BB7 /* BankTimer.swift */, 77F8FBB62B74AEEF0085F544 /* BankViewModel.swift */, ); path = BankScene; @@ -377,7 +377,7 @@ 08FE43F62B73977A00D09BB7 /* BankTask.swift in Sources */, 7796775D2B73AB18007315E8 /* ClientTableViewCell.swift in Sources */, 77B02E322B7306E900C3D686 /* UIStackView+.swift in Sources */, - 08FE43FE2B74611C00D09BB7 /* TimerHandler.swift in Sources */, + 08FE43FE2B74611C00D09BB7 /* BankTimer.swift in Sources */, 08FE43F42B73972500D09BB7 /* Client.swift in Sources */, 77B02E342B730AD700C3D686 /* Then.swift in Sources */, C7694E3D259C3E9F0053667F /* SceneDelegate.swift in Sources */, @@ -549,6 +549,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = VGM28F2FH7; INFOPLIST_FILE = BankManagerUIApp/Resource/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 14.0; LD_RUNPATH_SEARCH_PATHS = ( @@ -568,6 +569,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = VGM28F2FH7; INFOPLIST_FILE = BankManagerUIApp/Resource/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 14.0; LD_RUNPATH_SEARCH_PATHS = ( diff --git a/BankManagerUIApp/BankManagerUIApp/Scene/BankScene/TimerHandler.swift b/BankManagerUIApp/BankManagerUIApp/Scene/BankScene/BankTimer.swift similarity index 68% rename from BankManagerUIApp/BankManagerUIApp/Scene/BankScene/TimerHandler.swift rename to BankManagerUIApp/BankManagerUIApp/Scene/BankScene/BankTimer.swift index 38605fb0..28adc2b3 100644 --- a/BankManagerUIApp/BankManagerUIApp/Scene/BankScene/TimerHandler.swift +++ b/BankManagerUIApp/BankManagerUIApp/Scene/BankScene/BankTimer.swift @@ -13,26 +13,26 @@ private struct TimeUnit { let seconds: Int } -final class TimerHandler { +final class BankTimer { private var timer = Timer() private var count = 0 - private(set) var timeString = "" - - func startTimer() { - timer = Timer.scheduledTimer(timeInterval: 0.00001, target: self, selector: #selector(timerCounter), userInfo: nil, repeats: true) + var getTimeString: ((String) -> Void)? + + func start() { + timer = Timer.scheduledTimer(timeInterval: 0.001, target: self, selector: #selector(timerCounter), userInfo: nil, repeats: true) } - func stopTimer() { + func stop() { timer.invalidate() - timeString = "00:00:00" + getTimeString?("00:00:00") } @objc private func timerCounter() { count += 1 let time = secondsToHoursMinutesSeconds(seconds: count) - let timeString = makeTimeString(time) - self.timeString = timeString + var convertedTimeString = makeTimeString(time) + getTimeString?(convertedTimeString) } private func secondsToHoursMinutesSeconds(seconds: Int) -> TimeUnit { From 965cd93e5fd7297f5ffcae2bcc29c0a695938efd Mon Sep 17 00:00:00 2001 From: suojae3 Date: Thu, 8 Feb 2024 16:34:17 +0900 Subject: [PATCH 22/31] =?UTF-8?q?chore:=20Observable=20=EC=9D=B4=EC=9A=A9?= =?UTF-8?q?=ED=95=9C=20Timer=20=EB=8D=B0=EC=9D=B4=ED=84=B0=20=EB=B0=94?= =?UTF-8?q?=EC=9D=B8=EB=94=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Scene/BankScene/BankViewController.swift | 8 ++++++++ .../Scene/BankScene/BankViewModel.swift | 19 ++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/BankManagerUIApp/BankManagerUIApp/Scene/BankScene/BankViewController.swift b/BankManagerUIApp/BankManagerUIApp/Scene/BankScene/BankViewController.swift index 7498e782..3886044c 100644 --- a/BankManagerUIApp/BankManagerUIApp/Scene/BankScene/BankViewController.swift +++ b/BankManagerUIApp/BankManagerUIApp/Scene/BankScene/BankViewController.swift @@ -163,10 +163,18 @@ final class BankViewController: UIViewController { viewModel.waitingClients.subscribe { [weak self] _ in self?.waitingQueueTableView.reloadData() } + + /// Timer 비동기로 인한 UI 메인스레드 업데이트 + DispatchQueue.main.async { [weak self] in + self?.viewModel.timeString.subscribe { + self?.timerLabel.text = $0 + } + } } @objc private func addCustommerButtonDidTap() { viewModel.fetchData() + viewModel.start() } @objc private func resetButtonDidTap() { diff --git a/BankManagerUIApp/BankManagerUIApp/Scene/BankScene/BankViewModel.swift b/BankManagerUIApp/BankManagerUIApp/Scene/BankScene/BankViewModel.swift index 2c72c4be..a518c039 100644 --- a/BankManagerUIApp/BankManagerUIApp/Scene/BankScene/BankViewModel.swift +++ b/BankManagerUIApp/BankManagerUIApp/Scene/BankScene/BankViewModel.swift @@ -10,12 +10,29 @@ import Foundation final class BankViewModel { private let repository = BankRepository() + private let timer = BankTimer() private(set) var waitingClients: Observable<[Client]> = Observable([]) - + private(set) var timeString: Observable = Observable("") + func fetchData() { repository.makeClientData { [weak self] result in self?.waitingClients.value += result } } + + func fetchTimeString() { + timer.getTimeString = { + self.timeString.value = $0 + } + } + + func start() { + timer.start() + fetchTimeString() + } + + func stop() { + timer.stop() + } } From f4fb31f7536e9b799887a20ce505d644143db0db Mon Sep 17 00:00:00 2001 From: suojae3 Date: Thu, 8 Feb 2024 16:34:41 +0900 Subject: [PATCH 23/31] =?UTF-8?q?feat:=20reset=EB=B2=84=ED=8A=BC=20?= =?UTF-8?q?=EC=95=A1=EC=85=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BankManagerUIApp/Scene/BankScene/BankViewController.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BankManagerUIApp/BankManagerUIApp/Scene/BankScene/BankViewController.swift b/BankManagerUIApp/BankManagerUIApp/Scene/BankScene/BankViewController.swift index 3886044c..a1b2ac0a 100644 --- a/BankManagerUIApp/BankManagerUIApp/Scene/BankScene/BankViewController.swift +++ b/BankManagerUIApp/BankManagerUIApp/Scene/BankScene/BankViewController.swift @@ -178,7 +178,7 @@ final class BankViewController: UIViewController { } @objc private func resetButtonDidTap() { - + viewModel.stop() } } From e3af0eeada9ab1e4ce1e15e142e2220f9887dc2b Mon Sep 17 00:00:00 2001 From: suojae3 Date: Thu, 8 Feb 2024 16:42:18 +0900 Subject: [PATCH 24/31] =?UTF-8?q?chore:=20=EB=B3=80=EC=88=98=EB=AA=85?= =?UTF-8?q?=EC=97=90=EC=84=9C=20get=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BankManagerUIApp/Scene/BankScene/BankTimer.swift | 6 +++--- .../BankManagerUIApp/Scene/BankScene/BankViewModel.swift | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/BankManagerUIApp/BankManagerUIApp/Scene/BankScene/BankTimer.swift b/BankManagerUIApp/BankManagerUIApp/Scene/BankScene/BankTimer.swift index 28adc2b3..ec7c7bd4 100644 --- a/BankManagerUIApp/BankManagerUIApp/Scene/BankScene/BankTimer.swift +++ b/BankManagerUIApp/BankManagerUIApp/Scene/BankScene/BankTimer.swift @@ -17,7 +17,7 @@ final class BankTimer { private var timer = Timer() private var count = 0 - var getTimeString: ((String) -> Void)? + var timeString: ((String) -> Void)? func start() { timer = Timer.scheduledTimer(timeInterval: 0.001, target: self, selector: #selector(timerCounter), userInfo: nil, repeats: true) @@ -25,14 +25,14 @@ final class BankTimer { func stop() { timer.invalidate() - getTimeString?("00:00:00") + timeString?("00:00:00") } @objc private func timerCounter() { count += 1 let time = secondsToHoursMinutesSeconds(seconds: count) var convertedTimeString = makeTimeString(time) - getTimeString?(convertedTimeString) + timeString?(convertedTimeString) } private func secondsToHoursMinutesSeconds(seconds: Int) -> TimeUnit { diff --git a/BankManagerUIApp/BankManagerUIApp/Scene/BankScene/BankViewModel.swift b/BankManagerUIApp/BankManagerUIApp/Scene/BankScene/BankViewModel.swift index a518c039..c8389a90 100644 --- a/BankManagerUIApp/BankManagerUIApp/Scene/BankScene/BankViewModel.swift +++ b/BankManagerUIApp/BankManagerUIApp/Scene/BankScene/BankViewModel.swift @@ -22,7 +22,7 @@ final class BankViewModel { } func fetchTimeString() { - timer.getTimeString = { + timer.timeString = { self.timeString.value = $0 } } From bb1d7faa5c0ff76ad376575d3b7c03a859e8b025 Mon Sep 17 00:00:00 2001 From: eunjuchoi Date: Thu, 8 Feb 2024 16:44:22 +0900 Subject: [PATCH 25/31] =?UTF-8?q?feat:=20=EC=85=80=20=EC=9E=AC=EC=82=AC?= =?UTF-8?q?=EC=9A=A9=EC=97=90=20=EB=8C=80=EB=B9=84=ED=95=9C=20=EC=B4=88?= =?UTF-8?q?=EA=B8=B0=ED=99=94=20=EB=B0=8F=20UI=20=EC=84=A4=EC=A0=95=20?= =?UTF-8?q?=EC=BD=94=EB=93=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Scene/BankScene/ClientTableViewCell.swift | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/BankManagerUIApp/BankManagerUIApp/Scene/BankScene/ClientTableViewCell.swift b/BankManagerUIApp/BankManagerUIApp/Scene/BankScene/ClientTableViewCell.swift index 11d8c54a..5205f242 100644 --- a/BankManagerUIApp/BankManagerUIApp/Scene/BankScene/ClientTableViewCell.swift +++ b/BankManagerUIApp/BankManagerUIApp/Scene/BankScene/ClientTableViewCell.swift @@ -11,8 +11,16 @@ final class ClientTableViewCell: UITableViewCell { private let titleLabel = UILabel().then { $0.font = .systemFont(ofSize: 20) + $0.font = .systemFont(ofSize: 20, weight: .medium) } + override func prepareForReuse() { + super.prepareForReuse() + + titleLabel.text = "" + titleLabel.textColor = .black + } + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) @@ -37,5 +45,6 @@ final class ClientTableViewCell: UITableViewCell { func setUpData(data: Client) { titleLabel.text = "\(data.number) - \(data.bankTask.description)" + titleLabel.textColor = data.bankTask == .loan ? .systemPurple : .black } } From 41c2dd3a7b273d07a858011c514da3b6eb678dfb Mon Sep 17 00:00:00 2001 From: eunjuchoi Date: Fri, 9 Feb 2024 12:08:46 +0900 Subject: [PATCH 26/31] =?UTF-8?q?feat:=20=EC=9D=80=ED=96=89=20=EC=97=85?= =?UTF-8?q?=EB=AC=B4=20=EC=B2=98=EB=A6=AC=20=EA=B8=B0=EB=8A=A5=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Scene/BankScene/BankViewModel.swift | 31 +++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/BankManagerUIApp/BankManagerUIApp/Scene/BankScene/BankViewModel.swift b/BankManagerUIApp/BankManagerUIApp/Scene/BankScene/BankViewModel.swift index c8389a90..bbd97b5b 100644 --- a/BankManagerUIApp/BankManagerUIApp/Scene/BankScene/BankViewModel.swift +++ b/BankManagerUIApp/BankManagerUIApp/Scene/BankScene/BankViewModel.swift @@ -8,16 +8,23 @@ import Foundation final class BankViewModel { - + + // MARK: Properties private let repository = BankRepository() private let timer = BankTimer() private(set) var waitingClients: Observable<[Client]> = Observable([]) + private(set) var workingClients: Observable<[Client]> = Observable([]) private(set) var timeString: Observable = Observable("") - + private let loanSemaphore = DispatchSemaphore(value: 1) + private let depositSemaphore = DispatchSemaphore(value: 2) + + // MARK: Custom Methods func fetchData() { repository.makeClientData { [weak self] result in self?.waitingClients.value += result + self?.startTask() + self?.start() } } @@ -35,4 +42,24 @@ final class BankViewModel { func stop() { timer.stop() } + func startTask() { + while !waitingClients.value.isEmpty { + let client = waitingClients.value.removeFirst() + workingClients.value.append(client) + handleTask(of: client) + } + } + + private func handleTask(of client: Client) { + let semaphore = client.bankTask == .loan ? loanSemaphore : depositSemaphore + + semaphore.wait() + DispatchQueue.global().async { [weak self] in + guard let self = self else {return} + Thread.sleep(forTimeInterval: client.bankTask.requiredTime) + if self.workingClients.value.isEmpty { return } + self.workingClients.value.removeFirst() + semaphore.signal() + } + } } From 2e695670d3a00c190746ff3f7f11a1bd7c6dcc3f Mon Sep 17 00:00:00 2001 From: eunjuchoi Date: Fri, 9 Feb 2024 12:09:15 +0900 Subject: [PATCH 27/31] =?UTF-8?q?fix:=20=EC=88=9C=ED=99=98=20=EC=B0=B8?= =?UTF-8?q?=EC=A1=B0=20=EB=AC=B8=EC=A0=9C=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BankManagerUIApp/Scene/BankScene/BankViewModel.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/BankManagerUIApp/BankManagerUIApp/Scene/BankScene/BankViewModel.swift b/BankManagerUIApp/BankManagerUIApp/Scene/BankScene/BankViewModel.swift index bbd97b5b..fadfc103 100644 --- a/BankManagerUIApp/BankManagerUIApp/Scene/BankScene/BankViewModel.swift +++ b/BankManagerUIApp/BankManagerUIApp/Scene/BankScene/BankViewModel.swift @@ -29,8 +29,8 @@ final class BankViewModel { } func fetchTimeString() { - timer.timeString = { - self.timeString.value = $0 + timer.timeString = { [weak self] in + self?.timeString.value = $0 } } From af19f16e83470ddd4c60228729447fa29bd038bc Mon Sep 17 00:00:00 2001 From: eunjuchoi Date: Fri, 9 Feb 2024 12:09:55 +0900 Subject: [PATCH 28/31] =?UTF-8?q?chore:=20life=20cycle=20=EC=BD=94?= =?UTF-8?q?=EB=93=9C=20=EC=9C=84=EC=B9=98=20=EC=88=98=EC=A0=95=20=EB=B0=8F?= =?UTF-8?q?=20=EB=A7=88=ED=81=AC=20=EA=B5=AC=EB=AC=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Scene/BankScene/ClientTableViewCell.swift | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/BankManagerUIApp/BankManagerUIApp/Scene/BankScene/ClientTableViewCell.swift b/BankManagerUIApp/BankManagerUIApp/Scene/BankScene/ClientTableViewCell.swift index 5205f242..242d892f 100644 --- a/BankManagerUIApp/BankManagerUIApp/Scene/BankScene/ClientTableViewCell.swift +++ b/BankManagerUIApp/BankManagerUIApp/Scene/BankScene/ClientTableViewCell.swift @@ -9,18 +9,13 @@ import UIKit final class ClientTableViewCell: UITableViewCell { + // MARK: Properties private let titleLabel = UILabel().then { $0.font = .systemFont(ofSize: 20) $0.font = .systemFont(ofSize: 20, weight: .medium) } - - override func prepareForReuse() { - super.prepareForReuse() - - titleLabel.text = "" - titleLabel.textColor = .black - } + // MARK: Initializer override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) @@ -31,6 +26,15 @@ final class ClientTableViewCell: UITableViewCell { fatalError("init(coder:) has not been implemented") } + // MARK: Life Cycle + override func prepareForReuse() { + super.prepareForReuse() + + titleLabel.text = nil + titleLabel.textColor = .black + } + + // MARK: Custom Methods private func configureUI() { selectionStyle = .none From 57066b48656a169aadb4219edff3a4261ce5f67f Mon Sep 17 00:00:00 2001 From: eunjuchoi Date: Fri, 9 Feb 2024 12:10:45 +0900 Subject: [PATCH 29/31] =?UTF-8?q?chore:=20=EB=A9=94=EC=84=9C=EB=93=9C=20?= =?UTF-8?q?=EB=84=A4=EC=9D=B4=EB=B0=8D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BankManagerUIApp/Scene/BankScene/BankTimer.swift | 2 +- .../BankManagerUIApp/Scene/BankScene/BankViewModel.swift | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/BankManagerUIApp/BankManagerUIApp/Scene/BankScene/BankTimer.swift b/BankManagerUIApp/BankManagerUIApp/Scene/BankScene/BankTimer.swift index ec7c7bd4..f0fb0fab 100644 --- a/BankManagerUIApp/BankManagerUIApp/Scene/BankScene/BankTimer.swift +++ b/BankManagerUIApp/BankManagerUIApp/Scene/BankScene/BankTimer.swift @@ -23,7 +23,7 @@ final class BankTimer { timer = Timer.scheduledTimer(timeInterval: 0.001, target: self, selector: #selector(timerCounter), userInfo: nil, repeats: true) } - func stop() { + func reset() { timer.invalidate() timeString?("00:00:00") } diff --git a/BankManagerUIApp/BankManagerUIApp/Scene/BankScene/BankViewModel.swift b/BankManagerUIApp/BankManagerUIApp/Scene/BankScene/BankViewModel.swift index fadfc103..4678d2cd 100644 --- a/BankManagerUIApp/BankManagerUIApp/Scene/BankScene/BankViewModel.swift +++ b/BankManagerUIApp/BankManagerUIApp/Scene/BankScene/BankViewModel.swift @@ -39,9 +39,10 @@ final class BankViewModel { fetchTimeString() } - func stop() { - timer.stop() + func reset() { + timer.reset() } + func startTask() { while !waitingClients.value.isEmpty { let client = waitingClients.value.removeFirst() From 942a16b8fc451d5889e930f7a478cf75f629e70e Mon Sep 17 00:00:00 2001 From: eunjuchoi Date: Fri, 9 Feb 2024 12:12:08 +0900 Subject: [PATCH 30/31] =?UTF-8?q?feat:=20=EC=97=85=EB=AC=B4=EC=A4=91=20?= =?UTF-8?q?=ED=85=8C=EC=9D=B4=EB=B8=94=20=EB=B7=B0=20UI=20=EC=97=B0?= =?UTF-8?q?=EA=B2=B0=20=EB=B0=8F=20=EB=A7=88=ED=81=AC=20=EA=B5=AC=EB=AC=B8?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Scene/BankScene/BankViewController.swift | 31 +++++++++---------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/BankManagerUIApp/BankManagerUIApp/Scene/BankScene/BankViewController.swift b/BankManagerUIApp/BankManagerUIApp/Scene/BankScene/BankViewController.swift index a1b2ac0a..e262a970 100644 --- a/BankManagerUIApp/BankManagerUIApp/Scene/BankScene/BankViewController.swift +++ b/BankManagerUIApp/BankManagerUIApp/Scene/BankScene/BankViewController.swift @@ -7,15 +7,8 @@ import UIKit final class BankViewController: UIViewController { - - // TODO: 데이터 위치 수정 예정 - private var workingQueue: [Client] = [ - Client(number: 1, bankTask: .loan), - Client(number: 2, bankTask: .loan), - Client(number: 3, bankTask: .loan), - Client(number: 4, bankTask: .loan) - ] + // MARK: Properties private let addCustomerButton = UIButton().then { $0.setTitle("고객 10명 추가", for: .normal) $0.setTitleColor(.systemBlue, for: .normal) @@ -100,6 +93,7 @@ final class BankViewController: UIViewController { private let viewModel: BankViewModel + // MARK: Initializer init(viewModel: BankViewModel) { self.viewModel = viewModel super.init(nibName: nil, bundle: nil) @@ -109,6 +103,7 @@ final class BankViewController: UIViewController { fatalError("BankViewController Init Error!") } + // MARK: Life Cycle override func viewDidLoad() { super.viewDidLoad() @@ -118,6 +113,7 @@ final class BankViewController: UIViewController { bind() } + // MARK: Custom Methods private func configureUI() { view.backgroundColor = .white view.addSubview(entireStackView) @@ -164,21 +160,22 @@ final class BankViewController: UIViewController { self?.waitingQueueTableView.reloadData() } - /// Timer 비동기로 인한 UI 메인스레드 업데이트 - DispatchQueue.main.async { [weak self] in - self?.viewModel.timeString.subscribe { - self?.timerLabel.text = $0 - } + viewModel.workingClients.subscribe { [weak self] _ in + self?.workingQueueTableView.reloadData() + } + + viewModel.timeString.subscribe { [weak self] result in + self?.timerLabel.text = result } } + // MARK: @objc Methods @objc private func addCustommerButtonDidTap() { viewModel.fetchData() - viewModel.start() } @objc private func resetButtonDidTap() { - viewModel.stop() + viewModel.reset() } } @@ -198,7 +195,7 @@ extension BankViewController: UITableViewDataSource { case waitingQueueTableView: return viewModel.waitingClients.value.count case workingQueueTableView: - return workingQueue.count + return viewModel.workingClients.value.count default: return 0 } @@ -212,7 +209,7 @@ extension BankViewController: UITableViewDataSource { case waitingQueueTableView: cell.setUpData(data: viewModel.waitingClients.value[indexPath.row]) case workingQueueTableView: - cell.setUpData(data: workingQueue[indexPath.row]) + cell.setUpData(data: viewModel.workingClients.value[indexPath.row]) default: break } From 27084bc97e9b6d93b78c236fb3a5328e56dff52b Mon Sep 17 00:00:00 2001 From: eunjuchoi Date: Fri, 9 Feb 2024 12:12:21 +0900 Subject: [PATCH 31/31] =?UTF-8?q?chore:=20=EC=9E=90=EC=9E=98=ED=95=9C=20?= =?UTF-8?q?=EC=BD=94=EB=93=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BankManagerUIApp/Scene/BankScene/BankTimer.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BankManagerUIApp/BankManagerUIApp/Scene/BankScene/BankTimer.swift b/BankManagerUIApp/BankManagerUIApp/Scene/BankScene/BankTimer.swift index f0fb0fab..b90d4dde 100644 --- a/BankManagerUIApp/BankManagerUIApp/Scene/BankScene/BankTimer.swift +++ b/BankManagerUIApp/BankManagerUIApp/Scene/BankScene/BankTimer.swift @@ -31,7 +31,7 @@ final class BankTimer { @objc private func timerCounter() { count += 1 let time = secondsToHoursMinutesSeconds(seconds: count) - var convertedTimeString = makeTimeString(time) + let convertedTimeString = makeTimeString(time) timeString?(convertedTimeString) }