-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEAT] #142 - 그룹명 변경 기능 구현 #143
Changes from 5 commits
219169f
4afd320
0c1181d
9530b6a
c4a0ca8
ecccb5a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -186,11 +186,11 @@ class CommonBottomSheetViewController: UIViewController { | |
self.dimmedBackView.alpha = 0.0 | ||
self.view.layoutIfNeeded() | ||
self.bottomSheetCoverView.isHidden = false | ||
}) { _ in | ||
}, completion: { _ in | ||
if self.presentingViewController != nil { | ||
self.dismiss(animated: false, completion: nil) | ||
} | ||
} | ||
}) | ||
Comment on lines
+189
to
+193
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 이것도 워닝 해결이죵? 굳입니다! |
||
} | ||
|
||
// 바텀 시트 사라지고 바로 다시 다음 바텀 시트 올라오는 애니메이션 | ||
|
@@ -202,7 +202,7 @@ class CommonBottomSheetViewController: UIViewController { | |
self.dimmedBackView.alpha = 0.0 | ||
self.view.layoutIfNeeded() | ||
self.bottomSheetCoverView.isHidden = false | ||
}) { _ in | ||
}, completion: { _ in | ||
if self.presentingViewController != nil { | ||
guard let presentingVC = self.presentingViewController else { return } | ||
self.dismiss(animated: false) { | ||
|
@@ -211,7 +211,7 @@ class CommonBottomSheetViewController: UIViewController { | |
presentingVC.present(nextVC, animated: false, completion: nil) | ||
} | ||
} | ||
} | ||
}) | ||
} | ||
|
||
func hideBottomSheetAndPresentVC(nextViewController: UIViewController) { | ||
|
@@ -222,7 +222,7 @@ class CommonBottomSheetViewController: UIViewController { | |
self.dimmedBackView.alpha = 0.0 | ||
self.view.layoutIfNeeded() | ||
self.bottomSheetCoverView.isHidden = false | ||
}) { _ in | ||
}, completion: { _ in | ||
if self.presentingViewController != nil { | ||
guard let presentingVC = self.presentingViewController else { return } | ||
self.dismiss(animated: false) { | ||
|
@@ -231,7 +231,7 @@ class CommonBottomSheetViewController: UIViewController { | |
presentingVC.present(nextVC, animated: true, completion: nil) | ||
} | ||
} | ||
} | ||
}) | ||
} | ||
|
||
// UITapGestureRecognizer 연결 함수 부분 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
// | ||
// GroupNameEditBottomSheetViewController.swift | ||
// NADA-iOS-forRelease | ||
// | ||
// Created by 민 on 2021/12/11. | ||
// | ||
|
||
import UIKit | ||
import IQKeyboardManagerSwift | ||
|
||
class GroupNameEditBottomSheetViewController: CommonBottomSheetViewController, UITextFieldDelegate { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 슬랙봤어여! 기디결정에 따라서 수정할수도 있을텐데 화이팅입니다! |
||
|
||
// MARK: - Properties | ||
|
||
// 넘어온 그룹 이름 데이터를 받는 변수 선언 | ||
var text: String = "" | ||
|
||
// 그룹 추가 텍스트 필드 | ||
private let addGroupTextField: UITextField = { | ||
let textField = UITextField() | ||
textField.borderStyle = .none | ||
textField.cornerRadius = 10 | ||
textField.backgroundColor = .textBox | ||
textField.attributedPlaceholder = NSAttributedString(string: "변경할 그룹명을 입력하세요.", attributes: [.foregroundColor: UIColor.quaternary, .font: UIFont.textRegular04]) | ||
textField.returnKeyType = .done | ||
textField.setLeftPaddingPoints(12) | ||
textField.setRightPaddingPoints(12) | ||
|
||
return textField | ||
}() | ||
|
||
private let checkImageView: UIImageView = { | ||
let imageView = UIImageView() | ||
imageView.image = UIImage(named: "iconDone") | ||
|
||
return imageView | ||
}() | ||
|
||
private let explainLabel: UILabel = { | ||
let label = UILabel() | ||
label.text = "새로운 그룹은 최대 4개까지만 등록 가능합니다." | ||
label.textColor = .mainColorButtonText | ||
label.font = .textRegular05 | ||
|
||
return label | ||
}() | ||
|
||
// MARK: - View Life Cycle | ||
override func viewDidLoad() { | ||
super.viewDidLoad() | ||
|
||
setupUI() | ||
addGroupTextField.delegate = self | ||
IQKeyboardManager.shared.shouldResignOnTouchOutside = false | ||
} | ||
|
||
override func viewDidAppear(_ animated: Bool) { | ||
super.viewDidAppear(animated) | ||
|
||
self.addGroupTextField.becomeFirstResponder() | ||
} | ||
|
||
// MARK: - @Functions | ||
// UI 세팅 작업 | ||
private func setupUI() { | ||
view.addSubview(addGroupTextField) | ||
view.addSubview(checkImageView) | ||
view.addSubview(explainLabel) | ||
|
||
setupLayout() | ||
|
||
addGroupTextField.text = text | ||
} | ||
|
||
// 레이아웃 세팅 | ||
private func setupLayout() { | ||
addGroupTextField.translatesAutoresizingMaskIntoConstraints = false | ||
NSLayoutConstraint.activate([ | ||
addGroupTextField.topAnchor.constraint(equalTo: titleLabel.bottomAnchor, constant: 20), | ||
addGroupTextField.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 24), | ||
addGroupTextField.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -24), | ||
addGroupTextField.heightAnchor.constraint(equalToConstant: 45) | ||
]) | ||
|
||
checkImageView.translatesAutoresizingMaskIntoConstraints = false | ||
NSLayoutConstraint.activate([ | ||
checkImageView.topAnchor.constraint(equalTo: addGroupTextField.bottomAnchor, constant: 7), | ||
checkImageView.leadingAnchor.constraint(equalTo: addGroupTextField.leadingAnchor, constant: 4), | ||
checkImageView.widthAnchor.constraint(equalToConstant: 16), | ||
checkImageView.heightAnchor.constraint(equalToConstant: 16) | ||
]) | ||
|
||
explainLabel.translatesAutoresizingMaskIntoConstraints = false | ||
NSLayoutConstraint.activate([ | ||
explainLabel.topAnchor.constraint(equalTo: addGroupTextField.bottomAnchor, constant: 8), | ||
explainLabel.leadingAnchor.constraint(equalTo: checkImageView.trailingAnchor, constant: 5) | ||
]) | ||
} | ||
} | ||
|
||
extension GroupNameEditBottomSheetViewController { | ||
func textFieldShouldReturn(_ textField: UITextField) -> Bool { | ||
textField.resignFirstResponder() | ||
hideBottomSheetAndGoBack() | ||
return true | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,8 +7,8 @@ | |
|
||
import UIKit | ||
|
||
class GroupEditViewController: UIViewController { | ||
|
||
class GroupEditViewController: UIViewController, GroupEditViewDelegate { | ||
// MARK: - Properties | ||
var cardItems = ["SOPT", "동아리", "학교", "NADA NADA NADA NADA NADA"] | ||
|
||
|
@@ -32,11 +32,30 @@ class GroupEditViewController: UIViewController { | |
|
||
@IBAction func presentToAddGroupBottom(_ sender: UIButton) { | ||
let nextVC = AddGroupBottomSheetViewController() | ||
.setTitle("그룹 추가") | ||
.setHeight(184) | ||
.setTitle("그룹 추가") | ||
.setHeight(184) | ||
nextVC.modalPresentationStyle = .overFullScreen | ||
self.present(nextVC, animated: false, completion: nil) | ||
} | ||
} | ||
|
||
// MARK: - Extensions | ||
extension GroupEditViewController { | ||
|
||
func presentToGroupNameEdit(_ sender: UILabel) { | ||
let contentView = sender.superview | ||
guard let cell = contentView?.superview as? UITableViewCell else { return } | ||
let index = groupEditTableView.indexPath(for: cell) | ||
|
||
let nextVC = GroupNameEditBottomSheetViewController() | ||
.setTitle("그룹명 변경") | ||
.setHeight(184) | ||
nextVC.modalPresentationStyle = .overFullScreen | ||
nextVC.text = cardItems[index!.row] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 강제추출은 지양하는것이 좋을거 같아요!! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 맞네욥!!! 좋은 피드백 감사합니당 ^__^ |
||
|
||
self.present(nextVC, animated: false, completion: nil) | ||
} | ||
|
||
} | ||
|
||
// MARK: - TableView Delegate | ||
|
@@ -51,7 +70,7 @@ extension GroupEditViewController: UITableViewDelegate { | |
self.makeCancelDeleteAlert(title: "그룹 삭제", message: "해당 그룹에 있던 명함은\n미분류 그룹으로 이동합니다.", cancelAction: { _ in | ||
// 취소 눌렀을 때 액션이 들어갈 부분 | ||
}, deleteAction: { _ in | ||
// | ||
// | ||
}) | ||
}) | ||
deleteAction.backgroundColor = .red | ||
|
@@ -61,6 +80,7 @@ extension GroupEditViewController: UITableViewDelegate { | |
|
||
return swipeActions | ||
} | ||
|
||
} | ||
|
||
// MARK: - TableView DataSource | ||
|
@@ -73,6 +93,7 @@ extension GroupEditViewController: UITableViewDataSource { | |
guard let serviceCell = tableView.dequeueReusableCell(withIdentifier: Const.Xib.groupEditTableViewCell, for: indexPath) as? GroupEditTableViewCell else { return UITableViewCell() } | ||
|
||
serviceCell.initData(title: cardItems[indexPath.row]) | ||
serviceCell.delegate = self | ||
|
||
return serviceCell | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
추가할 때 다같이 한번 이야기해봐요!
저번에 제가 swift lint 같이 쓰던 팀원은 저보다 경험이 좀 더 많은데 최대한 추가하지 않으려고 하더라구요 분명 cyclomatic_complexity 도 클린코딩을 추구하면서 리펙하면 워닝을해결할 수 있을거에요..!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
넵넵 알겠습니다!!