diff --git a/WeekFlex/Podfile.lock b/WeekFlex/Podfile.lock index 4adac04..c0d6749 100644 --- a/WeekFlex/Podfile.lock +++ b/WeekFlex/Podfile.lock @@ -33,4 +33,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: f8a75cd5d955ea9933e3e2065e0b955b78cacaeb -COCOAPODS: 1.10.1 +COCOAPODS: 1.10.0 diff --git a/WeekFlex/WeekFlex.xcodeproj/project.pbxproj b/WeekFlex/WeekFlex.xcodeproj/project.pbxproj index d9453f4..9b3d2b5 100644 --- a/WeekFlex/WeekFlex.xcodeproj/project.pbxproj +++ b/WeekFlex/WeekFlex.xcodeproj/project.pbxproj @@ -67,7 +67,7 @@ 9BB52E7B25F0C2F6001C63E5 /* UIFont+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIFont+Extension.swift"; sourceTree = ""; }; 9BC81A9F25FA80CB001B1D83 /* AddRoutine.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = AddRoutine.storyboard; sourceTree = ""; }; 9E5FD60125F4CAD6008EB927 /* MyRoutine.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = MyRoutine.storyboard; sourceTree = ""; }; - 9E5FD60825F4CB33008EB927 /* MyRoutineListVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyRoutineListVC.swift; sourceTree = ""; }; + 9E5FD60825F4CB33008EB927 /* MyRoutineListVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyRoutineListVC.swift; sourceTree = ""; wrapsLines = 0; }; 9E5FD60B25F4CBD5008EB927 /* MyRoutineAddVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyRoutineAddVC.swift; sourceTree = ""; }; 9E5FD66426045B0C008EB927 /* UIColor+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIColor+Extension.swift"; sourceTree = ""; }; 9E5FD6BF260733DF008EB927 /* UIView+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIView+Extension.swift"; sourceTree = ""; }; @@ -665,7 +665,7 @@ CODE_SIGN_ENTITLEMENTS = WeekFlex/WeekFlex.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = DUQE66MABG; + DEVELOPMENT_TEAM = WFRFQ5S6AR; INFOPLIST_FILE = WeekFlex/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", @@ -687,7 +687,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_ENTITLEMENTS = WeekFlex/WeekFlex.entitlements; CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = DUQE66MABG; + DEVELOPMENT_TEAM = WFRFQ5S6AR; INFOPLIST_FILE = WeekFlex/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", diff --git a/WeekFlex/WeekFlex/Global/Extension/UIColor+Extension.swift b/WeekFlex/WeekFlex/Global/Extension/UIColor+Extension.swift index d851028..24aa89c 100644 --- a/WeekFlex/WeekFlex/Global/Extension/UIColor+Extension.swift +++ b/WeekFlex/WeekFlex/Global/Extension/UIColor+Extension.swift @@ -9,97 +9,101 @@ import Foundation import UIKit extension UIColor { - - @nonobjc class var white: UIColor { - return UIColor(white: 1.0, alpha: 1.0) - } - - @nonobjc class var bgSelected: UIColor { - return UIColor(white: 245.0 / 255.0, alpha: 1.0) - } - - @nonobjc class var gray1: UIColor { - return UIColor(white: 238.0 / 255.0, alpha: 1.0) - } - - @nonobjc class var gray2: UIColor { - return UIColor(white: 204.0 / 255.0, alpha: 1.0) - } - - @nonobjc class var gray3: UIColor { - return UIColor(red: 164.0 / 255.0, green: 164.0 / 255.0, blue: 169.0 / 255.0, alpha: 1.0) - } - - @nonobjc class var gray4: UIColor { - return UIColor(white: 102.0 / 255.0, alpha: 1.0) - } - - @nonobjc class var gray5: UIColor { - return UIColor(white: 51.0 / 255.0, alpha: 1.0) - } - - @nonobjc class var black: UIColor { - return UIColor(white: 24.0 / 255.0, alpha: 1.0) - } - - @nonobjc class var color1: UIColor { - return UIColor(red: 1.0, green: 104.0 / 255.0, blue: 104.0 / 255.0, alpha: 1.0) - } - - @nonobjc class var color5: UIColor { - return UIColor(red: 244.0 / 255.0, green: 175.0 / 255.0, blue: 206.0 / 255.0, alpha: 1.0) - } - - @nonobjc class var color6: UIColor { - return UIColor(red: 104.0 / 255.0, green: 79.0 / 255.0, blue: 252.0 / 255.0, alpha: 1.0) - } - - @nonobjc class var color3: UIColor { - return UIColor(red: 1.0, green: 214.0 / 255.0, blue: 67.0 / 255.0, alpha: 1.0) - } - - @nonobjc class var color2: UIColor { - return UIColor(red: 1.0, green: 157.0 / 255.0, blue: 67.0 / 255.0, alpha: 1.0) - } - - @nonobjc class var color7: UIColor { - return UIColor(red: 141.0 / 255.0, green: 166.0 / 255.0, blue: 1.0, alpha: 1.0) - } - - @nonobjc class var color8: UIColor { - return UIColor(red: 42.0 / 255.0, green: 181.0 / 255.0, blue: 241.0 / 255.0, alpha: 1.0) - } - - @nonobjc class var color4: UIColor { - return UIColor(red: 249.0 / 255.0, green: 235.0 / 255.0, blue: 136.0 / 255.0, alpha: 1.0) - } - - @nonobjc class var color9: UIColor { - return UIColor(red: 0.0, green: 215.0 / 255.0, blue: 121.0 / 255.0, alpha: 1.0) - } - - @nonobjc class var color12: UIColor { - return UIColor(red: 77.0 / 255.0, green: 81.0 / 255.0, blue: 246.0 / 255.0, alpha: 1.0) - } - - @nonobjc class var color11: UIColor { - return UIColor(red: 110.0 / 255.0, green: 201.0 / 255.0, blue: 196.0 / 255.0, alpha: 1.0) - } - - @nonobjc class var color10: UIColor { - return UIColor(red: 34.0 / 255.0, green: 185.0 / 255.0, blue: 176.0 / 255.0, alpha: 1.0) - } - - @nonobjc class var color13: UIColor { - return UIColor(red: 143.0 / 255.0, green: 114.0 / 255.0, blue: 225.0 / 255.0, alpha: 1.0) - } - - @nonobjc class var color14: UIColor { - return UIColor(red: 1.0, green: 102.0 / 255.0, blue: 65.0 / 255.0, alpha: 1.0) - } - - @nonobjc class var color15: UIColor { - return UIColor(red: 251.0 / 255.0, green: 101.0 / 255.0, blue: 209.0 / 255.0, alpha: 1.0) - } - + + @nonobjc class var white: UIColor { + return UIColor(white: 1.0, alpha: 1.0) + } + + @nonobjc class var bgSelected: UIColor { + return UIColor(white: 245.0 / 255.0, alpha: 1.0) + } + + @nonobjc class var gray1: UIColor { + return UIColor(white: 238.0 / 255.0, alpha: 1.0) + } + + @nonobjc class var gray2: UIColor { + return UIColor(white: 204.0 / 255.0, alpha: 1.0) + } + + @nonobjc class var gray3: UIColor { + return UIColor(red: 164.0 / 255.0, green: 164.0 / 255.0, blue: 169.0 / 255.0, alpha: 1.0) + } + + @nonobjc class var gray4: UIColor { + return UIColor(white: 102.0 / 255.0, alpha: 1.0) + } + + @nonobjc class var gray5: UIColor { + return UIColor(white: 51.0 / 255.0, alpha: 1.0) + } + + @nonobjc class var black: UIColor { + return UIColor(white: 24.0 / 255.0, alpha: 1.0) + } + + @nonobjc class var color1: UIColor { + return UIColor(red: 1.0, green: 104.0 / 255.0, blue: 104.0 / 255.0, alpha: 1.0) + } + + @nonobjc class var color5: UIColor { + return UIColor(red: 244.0 / 255.0, green: 175.0 / 255.0, blue: 206.0 / 255.0, alpha: 1.0) + } + + @nonobjc class var color6: UIColor { + return UIColor(red: 104.0 / 255.0, green: 79.0 / 255.0, blue: 252.0 / 255.0, alpha: 1.0) + } + + @nonobjc class var color3: UIColor { + return UIColor(red: 1.0, green: 214.0 / 255.0, blue: 67.0 / 255.0, alpha: 1.0) + } + + @nonobjc class var color2: UIColor { + return UIColor(red: 1.0, green: 157.0 / 255.0, blue: 67.0 / 255.0, alpha: 1.0) + } + + @nonobjc class var color7: UIColor { + return UIColor(red: 141.0 / 255.0, green: 166.0 / 255.0, blue: 1.0, alpha: 1.0) + } + + @nonobjc class var color8: UIColor { + return UIColor(red: 42.0 / 255.0, green: 181.0 / 255.0, blue: 241.0 / 255.0, alpha: 1.0) + } + + @nonobjc class var color4: UIColor { + return UIColor(red: 249.0 / 255.0, green: 235.0 / 255.0, blue: 136.0 / 255.0, alpha: 1.0) + } + + @nonobjc class var color9: UIColor { + return UIColor(red: 0.0, green: 215.0 / 255.0, blue: 121.0 / 255.0, alpha: 1.0) + } + + @nonobjc class var color12: UIColor { + return UIColor(red: 77.0 / 255.0, green: 81.0 / 255.0, blue: 246.0 / 255.0, alpha: 1.0) + } + + @nonobjc class var color11: UIColor { + return UIColor(red: 110.0 / 255.0, green: 201.0 / 255.0, blue: 196.0 / 255.0, alpha: 1.0) + } + + @nonobjc class var color10: UIColor { + return UIColor(red: 34.0 / 255.0, green: 185.0 / 255.0, blue: 176.0 / 255.0, alpha: 1.0) + } + + @nonobjc class var color13: UIColor { + return UIColor(red: 143.0 / 255.0, green: 114.0 / 255.0, blue: 225.0 / 255.0, alpha: 1.0) + } + + @nonobjc class var color14: UIColor { + return UIColor(red: 1.0, green: 102.0 / 255.0, blue: 65.0 / 255.0, alpha: 1.0) + } + + @nonobjc class var color15: UIColor { + return UIColor(red: 251.0 / 255.0, green: 101.0 / 255.0, blue: 209.0 / 255.0, alpha: 1.0) + } + + @nonobjc class var lightSalmon: UIColor { + return UIColor(red: 1.0, green: 153.0 / 255.0, blue: 153.0 / 255.0, alpha: 1.0) + } + } diff --git a/WeekFlex/WeekFlex/Info.plist b/WeekFlex/WeekFlex/Info.plist index 277efbd..c7ba71f 100644 --- a/WeekFlex/WeekFlex/Info.plist +++ b/WeekFlex/WeekFlex/Info.plist @@ -46,7 +46,7 @@ UISceneDelegateClassName $(PRODUCT_MODULE_NAME).SceneDelegate UISceneStoryboardFile - Main + MyRoutine diff --git a/WeekFlex/WeekFlex/Screen/MyRoutine/Cell/MyRoutineListItemTableViewCell.swift b/WeekFlex/WeekFlex/Screen/MyRoutine/Cell/MyRoutineListItemTableViewCell.swift index 4a0e5fa..98280ed 100644 --- a/WeekFlex/WeekFlex/Screen/MyRoutine/Cell/MyRoutineListItemTableViewCell.swift +++ b/WeekFlex/WeekFlex/Screen/MyRoutine/Cell/MyRoutineListItemTableViewCell.swift @@ -31,11 +31,11 @@ class MyRoutineListItemTableViewCell: UITableViewCell { super.setSelected(selected, animated: animated) } - override func layoutSubviews() { - super.layoutSubviews() - let bottomSpace: CGFloat = 8 - self.contentView.frame = self.contentView.frame.inset(by: UIEdgeInsets(top: 0, left: 0, bottom: bottomSpace, right: 0)) - } +// override func layoutSubviews() { +// super.layoutSubviews() +// let bottomSpace: CGFloat = 8 +// self.contentView.frame = self.contentView.frame.inset(by: UIEdgeInsets(top: 0, left: 0, bottom: bottomSpace, right: 0)) +// } // MARK: Function diff --git a/WeekFlex/WeekFlex/Screen/MyRoutine/Storyboard/MyRoutine.storyboard b/WeekFlex/WeekFlex/Screen/MyRoutine/Storyboard/MyRoutine.storyboard index 8870437..4f9b96b 100644 --- a/WeekFlex/WeekFlex/Screen/MyRoutine/Storyboard/MyRoutine.storyboard +++ b/WeekFlex/WeekFlex/Screen/MyRoutine/Storyboard/MyRoutine.storyboard @@ -2,6 +2,7 @@ + @@ -36,12 +37,36 @@ - - + + - - - + + + + + + + + + + + + + + + + + + + + + + @@ -87,40 +112,13 @@ - - - - - - - - - - - - - - - - - - - - - - - + @@ -128,7 +126,6 @@ - @@ -139,7 +136,6 @@ - diff --git a/WeekFlex/WeekFlex/Screen/MyRoutine/ViewController/MyRoutineListVC.swift b/WeekFlex/WeekFlex/Screen/MyRoutine/ViewController/MyRoutineListVC.swift index b69c924..e54443f 100644 --- a/WeekFlex/WeekFlex/Screen/MyRoutine/ViewController/MyRoutineListVC.swift +++ b/WeekFlex/WeekFlex/Screen/MyRoutine/ViewController/MyRoutineListVC.swift @@ -8,9 +8,9 @@ import UIKit class MyRoutineListVC: UIViewController { - + // MARK: IBOutlet - + var viewModel : MyRoutineListViewModel? let identifier = "MyRoutineListItemTableViewCell" @@ -23,7 +23,6 @@ class MyRoutineListVC: UIViewController { // table view @IBOutlet var routineTableView: UITableView! - @IBOutlet var routineTableViewHeight: NSLayoutConstraint! // new routine button @IBOutlet var routineCreateButtonView: UIView! @@ -32,7 +31,7 @@ class MyRoutineListVC: UIViewController { // MARK: Life Cycle - + override func viewDidLoad() { super.viewDidLoad() viewModel = MyRoutineListViewModel() @@ -56,11 +55,9 @@ extension MyRoutineListVC { backButton.setImage(UIImage(named: "icon32BackBlack"), for: .normal) headerLabel.setLabel(text: "나의 루틴", color: .black, font: .appleBold(size: 24)) subLabel.setLabel(text: "루틴 카드로 쉽게 할 일을 추가하세요", color: .gray5, font: .appleRegular(size: 16)) - + // table view routineTableView.separatorStyle = .none - let count = viewModel?.items.count ?? 0 - routineTableViewHeight.constant = CGFloat(count*98) // new routine button routineCreateButtonView.setBorder(borderColor: .black, borderWidth: 3) @@ -70,26 +67,65 @@ extension MyRoutineListVC { func setDelegate() { routineTableView.dataSource = self - + routineTableView.delegate = self } } extension MyRoutineListVC: UITableViewDataSource { - func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + + func numberOfSections(in tableView: UITableView) -> Int { guard let count = viewModel?.items.count else { return 0 } - return count } + // pacing between sections + func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat { + return 8 + } + + // section header 를 투명하게 해준다. + func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? { + let headerView = UIView() + headerView.backgroundColor = UIColor.clear + return headerView + } + + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + // 각 섹션에 대해서 하나의 아이템만 넣어준다. + return 1 + } + + // indexpath.row 가 아닌, section 으로 array 데이터를 가져와준다. func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { guard let cell = tableView.dequeueReusableCell(withIdentifier: identifier) as? MyRoutineListItemTableViewCell else { return UITableViewCell() } - guard let itemViewModel = viewModel?.items[indexPath.row] else { return UITableViewCell() } + guard let itemViewModel = viewModel?.items[indexPath.section] else { return UITableViewCell() } - cell.configure(withViewModel: itemViewModel, index: indexPath.row) + cell.configure(withViewModel: itemViewModel, index: indexPath.section) return cell } +} + +extension MyRoutineListVC: UITableViewDelegate { - + func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? { + + let deleteAction = UIContextualAction(style: .destructive, title: nil) { (_, _, completionHandler) in + completionHandler(true) + } + + deleteAction.image = UIImage(named: "icon40DeleteWhite") + deleteAction.backgroundColor = .color1 + + let editAction = UIContextualAction(style: .normal, title: nil) { (_, _, completionHandler) in + completionHandler(true) + } + editAction.image = UIImage(named: "icon32Edit") + editAction.backgroundColor = .lightSalmon + + let configuration = UISwipeActionsConfiguration(actions: [deleteAction, editAction, ]) + + return configuration + } } diff --git a/WeekFlex/WeekFlex/Support/Assets.xcassets/icon32Edit.imageset/Contents.json b/WeekFlex/WeekFlex/Support/Assets.xcassets/icon32Edit.imageset/Contents.json new file mode 100644 index 0000000..0ac1dc5 --- /dev/null +++ b/WeekFlex/WeekFlex/Support/Assets.xcassets/icon32Edit.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "icon32Edit.pdf", + "idiom" : "universal" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/WeekFlex/WeekFlex/Support/Assets.xcassets/icon32Edit.imageset/icon32Edit.pdf b/WeekFlex/WeekFlex/Support/Assets.xcassets/icon32Edit.imageset/icon32Edit.pdf new file mode 100644 index 0000000..4ae0da7 Binary files /dev/null and b/WeekFlex/WeekFlex/Support/Assets.xcassets/icon32Edit.imageset/icon32Edit.pdf differ diff --git a/WeekFlex/WeekFlex/Support/Assets.xcassets/icon40DeleteWhite.imageset/Contents.json b/WeekFlex/WeekFlex/Support/Assets.xcassets/icon40DeleteWhite.imageset/Contents.json new file mode 100644 index 0000000..e96972a --- /dev/null +++ b/WeekFlex/WeekFlex/Support/Assets.xcassets/icon40DeleteWhite.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "icon40DeleteWhite.pdf", + "idiom" : "universal" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/WeekFlex/WeekFlex/Support/Assets.xcassets/icon40DeleteWhite.imageset/icon40DeleteWhite.pdf b/WeekFlex/WeekFlex/Support/Assets.xcassets/icon40DeleteWhite.imageset/icon40DeleteWhite.pdf new file mode 100644 index 0000000..5f4dc29 Binary files /dev/null and b/WeekFlex/WeekFlex/Support/Assets.xcassets/icon40DeleteWhite.imageset/icon40DeleteWhite.pdf differ