From 3d777d05e05f30a76c9e5c51f13ecb5f9f5b504f Mon Sep 17 00:00:00 2001 From: Yoonseo Kim Date: Fri, 24 Sep 2021 14:11:10 +0900 Subject: [PATCH] =?UTF-8?q?[#4]=20=E1=84=91=E1=85=A9=E1=86=AF=E1=84=83?= =?UTF-8?q?=E1=85=A5=E1=84=85=E1=85=B5=E1=86=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CheoMooRac.xcodeproj/project.pbxproj | 14 ++++++++++- .../{ViewModels => Dynamic}/Dynamic.swift | 0 .../Exensions/UIViewController+embed.swift | 16 +++++++++++++ .../ViewControllers/MainViewController.swift | 11 +-------- .../Sources/ViewModels/MainViewModel.swift | 24 ------------------- 5 files changed, 30 insertions(+), 35 deletions(-) rename CheoMooRac/CheoMooRac/Sources/{ViewModels => Dynamic}/Dynamic.swift (100%) create mode 100644 CheoMooRac/CheoMooRac/Sources/Exensions/UIViewController+embed.swift diff --git a/CheoMooRac/CheoMooRac.xcodeproj/project.pbxproj b/CheoMooRac/CheoMooRac.xcodeproj/project.pbxproj index d0c057b..3e523aa 100644 --- a/CheoMooRac/CheoMooRac.xcodeproj/project.pbxproj +++ b/CheoMooRac/CheoMooRac.xcodeproj/project.pbxproj @@ -30,6 +30,7 @@ DD868E7026FB56D700D5BE38 /* StringManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD868E6F26FB56D700D5BE38 /* StringManager.swift */; }; DD8A91E226FD7AFB004DAF3B /* Dynamic.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD8A91E126FD7AFB004DAF3B /* Dynamic.swift */; }; DD8A91E526FD7B6C004DAF3B /* MainTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD8A91E426FD7B6C004DAF3B /* MainTableViewController.swift */; }; + DD8A91E726FD94FA004DAF3B /* UIViewController+embed.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD8A91E626FD94FA004DAF3B /* UIViewController+embed.swift */; }; DD96AA7126FCC44A00C9AA43 /* Person.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD96AA7026FCC44A00C9AA43 /* Person.swift */; }; DD96AA7426FCC61200C9AA43 /* MainViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD96AA7326FCC61200C9AA43 /* MainViewModel.swift */; }; DDC49F1C26F8A829001921C1 /* ReadViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDC49F1B26F8A829001921C1 /* ReadViewController.swift */; }; @@ -56,6 +57,7 @@ DD868E6F26FB56D700D5BE38 /* StringManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StringManager.swift; sourceTree = ""; }; DD8A91E126FD7AFB004DAF3B /* Dynamic.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Dynamic.swift; sourceTree = ""; }; DD8A91E426FD7B6C004DAF3B /* MainTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainTableViewController.swift; sourceTree = ""; }; + DD8A91E626FD94FA004DAF3B /* UIViewController+embed.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIViewController+embed.swift"; sourceTree = ""; }; DD96AA7026FCC44A00C9AA43 /* Person.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Person.swift; sourceTree = ""; }; DD96AA7326FCC61200C9AA43 /* MainViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainViewModel.swift; sourceTree = ""; }; DDC49F1B26F8A829001921C1 /* ReadViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ReadViewController.swift; sourceTree = ""; }; @@ -116,6 +118,7 @@ DD2844BD26EF35EB004FC840 /* Sources */ = { isa = PBXGroup; children = ( + DD8A91E826FD9523004DAF3B /* Dynamic */, DD8A91E326FD7B3B004DAF3B /* Views */, DD96AA7226FCC5EA00C9AA43 /* ViewModels */, DD96AA6F26FCC43A00C9AA43 /* Models */, @@ -180,6 +183,7 @@ DD6CCCE726F0811600C7BA2C /* UIView+addSubviews.swift */, DD6CCCE926F0814300C7BA2C /* UIStackView+addArrangedSubviews.swift */, DD372A5E26F0FD760033D40A /* UIButton+setBackgroundColor.swift */, + DD8A91E626FD94FA004DAF3B /* UIViewController+embed.swift */, ); path = Exensions; sourceTree = ""; @@ -209,6 +213,14 @@ path = Views; sourceTree = ""; }; + DD8A91E826FD9523004DAF3B /* Dynamic */ = { + isa = PBXGroup; + children = ( + DD8A91E126FD7AFB004DAF3B /* Dynamic.swift */, + ); + path = Dynamic; + sourceTree = ""; + }; DD96AA6F26FCC43A00C9AA43 /* Models */ = { isa = PBXGroup; children = ( @@ -221,7 +233,6 @@ isa = PBXGroup; children = ( DD96AA7326FCC61200C9AA43 /* MainViewModel.swift */, - DD8A91E126FD7AFB004DAF3B /* Dynamic.swift */, ); path = ViewModels; sourceTree = ""; @@ -311,6 +322,7 @@ DD8A91E526FD7B6C004DAF3B /* MainTableViewController.swift in Sources */, DD96AA7126FCC44A00C9AA43 /* Person.swift in Sources */, DD6CCCE826F0811600C7BA2C /* UIView+addSubviews.swift in Sources */, + DD8A91E726FD94FA004DAF3B /* UIViewController+embed.swift in Sources */, DD2844AA26EF35C4004FC840 /* MainViewController.swift in Sources */, DD372A5D26F0EEAF0033D40A /* ProfileHeaderView.swift in Sources */, DD6CCCEF26F08EB200C7BA2C /* CreateViewController.swift in Sources */, diff --git a/CheoMooRac/CheoMooRac/Sources/ViewModels/Dynamic.swift b/CheoMooRac/CheoMooRac/Sources/Dynamic/Dynamic.swift similarity index 100% rename from CheoMooRac/CheoMooRac/Sources/ViewModels/Dynamic.swift rename to CheoMooRac/CheoMooRac/Sources/Dynamic/Dynamic.swift diff --git a/CheoMooRac/CheoMooRac/Sources/Exensions/UIViewController+embed.swift b/CheoMooRac/CheoMooRac/Sources/Exensions/UIViewController+embed.swift new file mode 100644 index 0000000..4267d47 --- /dev/null +++ b/CheoMooRac/CheoMooRac/Sources/Exensions/UIViewController+embed.swift @@ -0,0 +1,16 @@ +// +// UIViewController+embed.swift +// CheoMooRac +// +// Created by 김윤서 on 2021/09/24. +// + +import UIKit + +extension UIViewController { + func embed(_ viewController: UIViewController) { + viewController.willMove(toParent: self) + self.addChild(viewController) + viewController.didMove(toParent: self) + } +} diff --git a/CheoMooRac/CheoMooRac/Sources/ViewControllers/MainViewController.swift b/CheoMooRac/CheoMooRac/Sources/ViewControllers/MainViewController.swift index a40fc4e..cb2b61f 100644 --- a/CheoMooRac/CheoMooRac/Sources/ViewControllers/MainViewController.swift +++ b/CheoMooRac/CheoMooRac/Sources/ViewControllers/MainViewController.swift @@ -7,25 +7,16 @@ import UIKit - import SnapKit import Then -extension UIViewController { - func embed(_ viewController: UIViewController) { - viewController.willMove(toParent: self) - self.addChild(viewController) - viewController.didMove(toParent: self) - } -} - - class MainViewController: UIViewController { var tableViewController: MainTableViewController! override func viewDidLoad() { super.viewDidLoad() + let mainViewModel = MainViewModel() self.tableViewController = MainTableViewController(with: mainViewModel) initViewController() diff --git a/CheoMooRac/CheoMooRac/Sources/ViewModels/MainViewModel.swift b/CheoMooRac/CheoMooRac/Sources/ViewModels/MainViewModel.swift index 6c88b75..21bb66d 100644 --- a/CheoMooRac/CheoMooRac/Sources/ViewModels/MainViewModel.swift +++ b/CheoMooRac/CheoMooRac/Sources/ViewModels/MainViewModel.swift @@ -46,30 +46,6 @@ class MainViewModel: MainViewModelProtocol { return Dynamic(list$) } -// private var filteredList: [String] = [] -// private var filterdHeaderList: [String] = [] - // private var list = ["김윤서", "김루희", "윤예지", "김혜수", "코코", "민재", "잼권이", "리헤이", "노제", "몬익화", "립제이", "잘린이", "엠마", "모아나", "케이데이", "가비", "시미즈zz", "강호동", "이수근", "유재석", "리정" ] -// -// private var filteredList: [String] = [] -// private var filterdHeaderList: [String] = [] -// -// private var sectionHeaderList: [String] { -// var sectionHeaderList: [String] = [] -// list.forEach { name in -// sectionHeaderList.append(StringManager.shared.chosungCheck(word: name)) -// } -// -// return Array(Set(sectionHeaderList)).sorted() -// } - -// var sectionHeaderList$: [String] { -// var sectionHeaderList: [String] = [] -// self.list?.forEach { name in -// sectionHeaderList.append(StringManager.shared.chosungCheck(word: name)) -// } -// -// return Array(Set(sectionHeaderList)).sorted() -// } init() { self.list.value = ["김윤서", "김루희", "윤예지", "김혜수", "코코", "민재", "잼권이", "리헤이", "노제", "몬익화", "립제이", "잘린이", "엠마", "모아나", "케이데이", "가비", "시미즈zz", "강호동", "이수근", "유재석", "리정" ]