diff --git a/Pinit/Pinit/DesignSystem/DesignSystem.swift b/Pinit/Pinit/DesignSystem/DesignSystem.swift index b7ff268..2388c85 100644 --- a/Pinit/Pinit/DesignSystem/DesignSystem.swift +++ b/Pinit/Pinit/DesignSystem/DesignSystem.swift @@ -9,16 +9,25 @@ import UIKit enum DesignSystemColor { case Purple + case Purple50 case Lavender + case Lavender10 + case Lavender1 } extension DesignSystemColor { var value: UIColor { switch self { case .Purple: UIColor(hex: "#561CE2") + case .Purple50: + UIColor(hex: "#8562D5") case .Lavender: UIColor(hex: "#6450E2") - + case .Lavender10: + UIColor(hex: "#C2BFD2") + case .Lavender1: + UIColor(hex: "#CECCCF") + } } } diff --git a/Pinit/Pinit/Repository/Moya/Network.swift b/Pinit/Pinit/Repository/Moya/Network.swift deleted file mode 100644 index 911402a..0000000 --- a/Pinit/Pinit/Repository/Moya/Network.swift +++ /dev/null @@ -1,12 +0,0 @@ -// -// Network.swift -// Pinit -// -// Created by 안세훈 on 3/14/25. -// -import UIKit -import Moya - -class Network { - -} diff --git a/Pinit/Pinit/Views/Cells/PinRecordCell.swift b/Pinit/Pinit/Views/Cells/PinRecordCell.swift index 35b911b..6413d2b 100644 --- a/Pinit/Pinit/Views/Cells/PinRecordCell.swift +++ b/Pinit/Pinit/Views/Cells/PinRecordCell.swift @@ -21,8 +21,9 @@ final class PinRecordCell: UICollectionViewCell { }() public lazy var thumbnailImageView: UIImageView = { let imageView = UIImageView() - imageView.contentMode = .scaleToFill + imageView.contentMode = .scaleAspectFill imageView.backgroundColor = .lightGray + imageView.clipsToBounds = true return imageView }() private lazy var pinTitleLabel: UILabel = { @@ -98,19 +99,19 @@ final class PinRecordCell: UICollectionViewCell { extension PinRecordCell { func captureMapSnapshotWithPin(center: CLLocationCoordinate2D, imageSize: CGSize, completion: @escaping (UIImage?) -> Void) { let options = MKMapSnapshotter.Options() - options.region = MKCoordinateRegion(center: center, span: MKCoordinateSpan(latitudeDelta: 0.003, longitudeDelta: 0.003)) - options.size = imageSize - options.mapType = .standard - - let snapshotter = MKMapSnapshotter(options: options) - snapshotter.start { snapshot, error in - guard let snapshot = snapshot, error == nil else { - print("스냅샷 생성 실패") - completion(nil) - return - } - - completion(snapshot.image) + options.region = MKCoordinateRegion(center: center, span: MKCoordinateSpan(latitudeDelta: 0.003, longitudeDelta: 0.003)) + options.size = imageSize + options.mapType = .standard + + let snapshotter = MKMapSnapshotter(options: options) + snapshotter.start { snapshot, error in + guard let snapshot = snapshot, error == nil else { + print("스냅샷 생성 실패") + completion(nil) + return } + + completion(snapshot.image) + } } } diff --git a/Pinit/Pinit/Views/Cells/ReviewCell.swift b/Pinit/Pinit/Views/Cells/ReviewCell.swift index fcc08ab..1be1b06 100644 --- a/Pinit/Pinit/Views/Cells/ReviewCell.swift +++ b/Pinit/Pinit/Views/Cells/ReviewCell.swift @@ -10,17 +10,6 @@ import SnapKit class ReviewCell: UITableViewCell { - // MARK: - init - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { - super.init(style: style, reuseIdentifier: reuseIdentifier) - - addComponents() - } - - required init?(coder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - // MARK: - 컴포넌트 설정 public lazy var reviewCellPanel: UIView = { let view = UIView() @@ -31,7 +20,7 @@ class ReviewCell: UITableViewCell { public lazy var reviewDate: UILabel = { let label = UILabel() label.text = "25년 3월 3일" - label.font = DesignSystemFont.Pretendard_SemiBold16.value + label.font = DesignSystemFont.Pretendard_Bold16.value return label }() @@ -49,6 +38,34 @@ class ReviewCell: UITableViewCell { return button }() + // MARK: - init + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + super.init(style: style, reuseIdentifier: reuseIdentifier) + addComponents() + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + override func layoutSubviews() { + super.layoutSubviews() + + contentView.frame = contentView.frame.inset(by: UIEdgeInsets(top: 4, left: 0, bottom: 2, right: 0)) + } + + + override func setSelected(_ selected: Bool, animated: Bool) { + super.setSelected(selected, animated: animated) + + if selected { + contentView.layer.shadowOffset = CGSize(width: 10, height: 10) + contentView.layer.shadowColor = DesignSystemColor.Purple.value.cgColor + }else{ + contentView.layer.shadowOffset = CGSize(width: 10, height: 10) + contentView.layer.shadowColor = DesignSystemColor.Purple.value.cgColor + } + } // MARK: - 데이터 설정 메서드 @@ -56,24 +73,19 @@ class ReviewCell: UITableViewCell { reviewDate.text = date reviewText.text = desc } - - - - // MARK: - 레이아웃 private func addComponents() { + self.addSubviews(reviewCellPanel) reviewCellPanel.addSubviews(reviewDate, reviewText, reviewMenuButton) - reviewCellPanel.snp.makeConstraints { - $0.width.equalToSuperview() - $0.height.equalTo(60) - $0.centerY.equalToSuperview() + reviewCellPanel.snp.makeConstraints{ + $0.edges.equalToSuperview() } reviewDate.snp.makeConstraints { - $0.top.equalToSuperview() + $0.top.equalToSuperview().inset(10) $0.leading.equalToSuperview().inset(10) } @@ -82,10 +94,10 @@ class ReviewCell: UITableViewCell { $0.leading.equalToSuperview().inset(10) } - reviewMenuButton.snp.makeConstraints { - $0.top.equalToSuperview() - $0.trailing.equalToSuperview().inset(10) - } +// reviewMenuButton.snp.makeConstraints { +// $0.top.equalToSuperview() +// $0.trailing.equalToSuperview().inset(10) +// } } diff --git a/Pinit/Pinit/Views/Home/HomeViewController.swift b/Pinit/Pinit/Views/Home/HomeViewController.swift index 0db1dc3..c3fefca 100644 --- a/Pinit/Pinit/Views/Home/HomeViewController.swift +++ b/Pinit/Pinit/Views/Home/HomeViewController.swift @@ -21,12 +21,12 @@ class HomeViewController: UIViewController { private var adapter: PinCollectionViewAdapter? private let mapView = MKMapView(frame: .zero) private let bottomSheet = CustomBottomSheet() + private lazy var addPinButton: UIButton = { let button = UIButton() - let image = UIImage(systemName: "pencil.line") button.setImage(UIImage(systemName: "pencil.line"), for: .normal) - button.backgroundColor = .secondarySystemBackground - button.tintColor = DesignSystemColor.Purple.value + button.backgroundColor = DesignSystemColor.Lavender.value + button.tintColor = .white button.layer.cornerRadius = circleButtonSize / 2 button.clipsToBounds = true return button @@ -34,8 +34,8 @@ class HomeViewController: UIViewController { private lazy var currentLocationButton: UIButton = { let button = UIButton() button.setImage(UIImage(systemName: "dot.scope"), for: .normal) - button.backgroundColor = .secondarySystemBackground - button.tintColor = DesignSystemColor.Purple.value + button.backgroundColor = DesignSystemColor.Lavender.value + button.tintColor = .white button.layer.cornerRadius = circleButtonSize / 2 button.clipsToBounds = true return button @@ -67,7 +67,8 @@ class HomeViewController: UIViewController { mapView.delegate = self mapView.showsUserLocation = true - mapView.setCameraZoomRange(.init(minCenterCoordinateDistance: 333, maxCenterCoordinateDistance: 5000), animated: true) +#warning("setCameraZoomRange 주석") +// mapView.setCameraZoomRange(.init(minCenterCoordinateDistance: 333, maxCenterCoordinateDistance: 5000), animated: true) // Location 불러오기 전 기본값 설정 var currentLocation = CLLocationCoordinate2D( latitude: 37.277252, @@ -298,7 +299,9 @@ extension HomeViewController { bottomSheetHeight = large bottomSheet.collectionView.isUserInteractionEnabled = true } - else if newHeight > (view.frame.height * 0.3) { + + else if newHeight > (view.frame.height * 0.25) { +#warning("0.3 -> 0.25") bottomSheetHeight = medium bottomSheet.collectionView.isUserInteractionEnabled = true } diff --git a/Pinit/Pinit/Views/Home/SubViews/CustomBottomSheet.swift b/Pinit/Pinit/Views/Home/SubViews/CustomBottomSheet.swift index 10a5114..e8a8de1 100644 --- a/Pinit/Pinit/Views/Home/SubViews/CustomBottomSheet.swift +++ b/Pinit/Pinit/Views/Home/SubViews/CustomBottomSheet.swift @@ -13,7 +13,7 @@ final class CustomBottomSheet: UIView { let grabber: UIView = { let grabber = UIView() grabber.layer.cornerRadius = 4 - grabber.backgroundColor = DesignSystemColor.Purple.value + grabber.backgroundColor = DesignSystemColor.Lavender.value grabber.layer.borderColor = UIColor.white.cgColor grabber.layer.borderWidth = 1 grabber.clipsToBounds = true @@ -33,6 +33,7 @@ final class CustomBottomSheet: UIView { func setupLayout() { let cornerRadius = 20.0 self.backgroundColor = .secondarySystemBackground +// self.backgroundColor = DesignSystemColor.Lavender1.value self.layer.cornerRadius = cornerRadius // cornerRadius 상단 좌,우측만 적용하기 self.layer.maskedCorners = .init(arrayLiteral: [.layerMaxXMinYCorner, .layerMinXMinYCorner]) diff --git a/Pinit/Pinit/Views/PastPin/PastPinViewController.swift b/Pinit/Pinit/Views/PastPin/PastPinViewController.swift index a03cfef..6c49976 100644 --- a/Pinit/Pinit/Views/PastPin/PastPinViewController.swift +++ b/Pinit/Pinit/Views/PastPin/PastPinViewController.swift @@ -95,6 +95,8 @@ final class PastPinViewController: UIViewController { PinCalendar.backgroundColor = .white PinCalendar.layer.cornerRadius = 10 + PinCalendar.layer.borderColor = DesignSystemColor.Lavender10.value.cgColor + PinCalendar.layer.borderWidth = 2 PinCalendar.locale = Locale.init(identifier: "ko_KR") PinCalendar.firstWeekday = 1 PinCalendar.appearance.headerDateFormat = "YYYY년 MM월" @@ -103,16 +105,18 @@ final class PastPinViewController: UIViewController { //년월 폰트 PinCalendar.appearance.headerTitleFont = DesignSystemFont.Pretendard_Bold20.value - PinCalendar.appearance.headerTitleColor = .black + PinCalendar.appearance.headerTitleColor = DesignSystemColor.Purple.value //요일 폰트 - PinCalendar.appearance.weekdayFont = DesignSystemFont.Pretendard_Bold12.value + PinCalendar.appearance.weekdayFont = DesignSystemFont.Pretendard_Medium16.value PinCalendar.appearance.weekdayTextColor = .black //날짜 폰트 - PinCalendar.appearance.titleFont = DesignSystemFont.Pretendard_Medium12.value + PinCalendar.appearance.titleFont = DesignSystemFont.Pretendard_Medium14.value //오늘 - PinCalendar.appearance.todayColor = .systemGray3 + PinCalendar.appearance.todayColor = DesignSystemColor.Lavender10.value + PinCalendar.appearance.todaySelectionColor = DesignSystemColor.Purple50.value + //오늘 아님 - PinCalendar.appearance.selectionColor = .systemBlue + PinCalendar.appearance.selectionColor = DesignSystemColor.Purple50.value } } @@ -128,10 +132,10 @@ extension PastPinViewController : FSCalendarDelegate, FSCalendarDataSource, FSCa } - //해당 pinEntity안에 데이터의 유무에 따라 해당 날짜에 dot이 노출댑니당>.< - func calendar(_ calendar: FSCalendar, numberOfEventsFor date: Date) -> Int { - return pinData.contains { Calendar.current.isDate($0.date, inSameDayAs: date) } ? 1 : 0 - } +// //해당 pinEntity안에 데이터의 유무에 따라 해당 날짜에 dot이 노출댑니당>.< +// func calendar(_ calendar: FSCalendar, numberOfEventsFor date: Date) -> Int { +// return pinData.contains { Calendar.current.isDate($0.date, inSameDayAs: date) } ? 1 : 0 +// } func calendar(_ calendar: FSCalendar, appearance: FSCalendarAppearance, titleDefaultColorFor date: Date) -> UIColor? { let day = Calendar.current.component(.weekday, from: date) - 1 @@ -139,7 +143,7 @@ extension PastPinViewController : FSCalendarDelegate, FSCalendarDataSource, FSCa if Calendar.current.shortWeekdaySymbols[day] == "Sun" || Calendar.current.shortWeekdaySymbols[day] == "일" { return .systemRed //일요일 색 } else if Calendar.current.shortWeekdaySymbols[day] == "Sat" || Calendar.current.shortWeekdaySymbols[day] == "토" { - return .systemBlue //토요일 색 + return DesignSystemColor.Purple.value //토요일 색 } else { return .label //기본색 } diff --git a/Pinit/Pinit/Views/PinDetail/PinDetailViewController.swift b/Pinit/Pinit/Views/PinDetail/PinDetailViewController.swift index 6e30cd1..2805bf2 100644 --- a/Pinit/Pinit/Views/PinDetail/PinDetailViewController.swift +++ b/Pinit/Pinit/Views/PinDetail/PinDetailViewController.swift @@ -43,7 +43,7 @@ final class PinDetailViewController: UIViewController { // MARK: - VIewDidLoad override func viewDidLoad() { super.viewDidLoad() - self.view.backgroundColor = .white + self.view.backgroundColor = .secondarySystemBackground setupReviewTable() addComponents() @@ -84,6 +84,9 @@ final class PinDetailViewController: UIViewController { map.setRegion(region, animated: true) map.showsUserLocation = false map.isUserInteractionEnabled = false + map.layer.cornerRadius = 10 + map.layer.borderColor = DesignSystemColor.Lavender10.value.cgColor + map.layer.borderWidth = 2 let annotation = MKPointAnnotation() annotation.coordinate = CLLocationCoordinate2D(latitude: lat, longitude: long) @@ -102,26 +105,44 @@ final class PinDetailViewController: UIViewController { button.tintColor = .black button.alpha = 0.7 // 투명도 50% 설정 button.addTarget(self, action: #selector(dismissButtonTapped), for: .touchUpInside) - + return button }() // 리뷰 테이블뷰 설정 private func setupReviewTable() { -// pinTableView = UITableView(frame: .zero, style: .grouped) + // pinTableView = UITableView(frame: .zero, style: .grouped) + + pinTableView.layer.cornerRadius = 10 + pinTableView.layer.shadowColor = DesignSystemColor.Purple.value.cgColor + + pinTableView.backgroundColor = .clear + pinTableView.separatorStyle = .none + pinTableView.estimatedRowHeight = UITableView.automaticDimension pinTableView.dataSource = self pinTableView.delegate = self pinTableView.register(ReviewCell.self, forCellReuseIdentifier: "CustomCell") + } // 리뷰 작성 패널 public lazy var reviewPanelContainer: NewPinReviewPanel = { let view = NewPinReviewPanel() + view.reviewText.delegate = self + view.reviewText.inputAccessoryView = keyboardToolBar return view }() + private lazy var keyboardToolBar: UIToolbar = { + let toolbar = UIToolbar() + let flexBarButton = UIBarButtonItem(barButtonSystemItem: .flexibleSpace, target: nil, action: nil) + let doneBarButton = UIBarButtonItem(title: "완료", style: .plain, target: self, action: #selector(doneBtnClicked)) + toolbar.items = [flexBarButton, doneBarButton] + toolbar.sizeToFit() + return toolbar + }() // MARK: - Layout private func addComponents() { @@ -133,8 +154,8 @@ final class PinDetailViewController: UIViewController { // 지도 constraint mapView.snp.makeConstraints { - $0.top.equalTo(view.safeAreaLayoutGuide.snp.top) // 기기의 안전구역부터 시작하도록 - $0.leading.trailing.equalToSuperview() + $0.top.equalTo(view.safeAreaLayoutGuide.snp.top).inset(4) + $0.leading.trailing.equalToSuperview().inset(3) $0.height.equalToSuperview().multipliedBy(0.25) // 기기의 높이 *0.25로 높이 설정 } @@ -154,8 +175,8 @@ final class PinDetailViewController: UIViewController { pinTableView.snp.makeConstraints { - $0.width.equalToSuperview() - $0.top.equalTo(mapView.snp.bottom) + $0.leading.trailing.equalTo(mapView) + $0.top.equalTo(mapView.snp.bottom).offset(4) $0.bottom.equalTo(reviewPanelContainer.snp.top) } } @@ -189,7 +210,7 @@ extension PinDetailViewController { @objc func doneBtnClicked() { view.endEditing(true) } - + @objc func keyboardWillShow(notification: NSNotification) { if let keyboardFrame = notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? CGRect { @@ -301,6 +322,8 @@ extension PinDetailViewController: UITableViewDataSource, UITableViewDelegate { // 셀 재사용을 위한 찌꺼기 제거 절차 cell.contentView.subviews.forEach { $0.removeFromSuperview() } + cell.backgroundColor = .clear + cell.layer.cornerRadius = 10 cell.configure(date: data.date.koreanDateString(), desc: data.description) @@ -311,7 +334,19 @@ extension PinDetailViewController: UITableViewDataSource, UITableViewDelegate { } +extension PinDetailViewController : UITextFieldDelegate { + + func textFieldDidBeginEditing(_ textField: UITextField) { + textField.layer.borderColor = DesignSystemColor.Purple.value.cgColor + textField.layer.borderWidth = 2.0 + } + + func textFieldDidEndEditing(_ textField: UITextField) { + textField.layer.borderColor = UIColor.lightGray.cgColor + textField.layer.borderWidth = 1.0 + } +} #Preview { - PinDetailViewController(PinEntity.sampleData[1], isPin: true) + PinDetailViewController(PinEntity.producerData[0], isPin: true) } diff --git a/Pinit/Pinit/Views/PinDetail/SubViews/NewPinReviewPanel.swift b/Pinit/Pinit/Views/PinDetail/SubViews/NewPinReviewPanel.swift index 658a27f..468c6f1 100644 --- a/Pinit/Pinit/Views/PinDetail/SubViews/NewPinReviewPanel.swift +++ b/Pinit/Pinit/Views/PinDetail/SubViews/NewPinReviewPanel.swift @@ -40,6 +40,7 @@ class NewPinReviewPanel: UIView { textField.layer.borderColor = UIColor(red: 169/255, green: 169/255, blue: 169/255, alpha: 1).cgColor // #A9A9A9 (다크 라이트 그레이) textField.layer.borderWidth = 2 textField.textColor = .black + textField.tintColor = DesignSystemColor.Purple.value textField.layer.cornerRadius = 20 textField.font = DesignSystemFont.Pretendard_Medium16 .value diff --git a/Pinit/Pinit/Views/PinDetail/SubViews/PinDetailHeader.swift b/Pinit/Pinit/Views/PinDetail/SubViews/PinDetailHeader.swift index affab84..f8b378a 100644 --- a/Pinit/Pinit/Views/PinDetail/SubViews/PinDetailHeader.swift +++ b/Pinit/Pinit/Views/PinDetail/SubViews/PinDetailHeader.swift @@ -28,7 +28,6 @@ class PinDetailHeader: UIView { // 핀 상세 뷰 컨테이너 private lazy var pinDetailPanel: UIView = { let view = UIView() - view.backgroundColor = .white return view }() @@ -61,7 +60,7 @@ class PinDetailHeader: UIView { public lazy var pinMenuButton: UIButton = { let button = UIButton(type: .system) button.setImage(UIImage(systemName: "ellipsis.circle"), for: .normal) - button.tintColor = .black + button.tintColor = DesignSystemColor.Lavender.value return button }() @@ -69,9 +68,10 @@ class PinDetailHeader: UIView { private lazy var pinImageView: UIImageView = { let imageView = UIImageView() imageView.image = entity.mediaPath - imageView.backgroundColor = DesignSystemColor.Lavender.value -// imageView.layer.borderWidth = 4 -// imageView.layer.borderColor = DesignSystemColor.Purple.value.cgColor + imageView.backgroundColor = DesignSystemColor.Lavender.value.withAlphaComponent(0.7) + imageView.layer.cornerRadius = 8 + imageView.layer.borderColor = DesignSystemColor.Lavender10.value.cgColor + imageView.layer.borderWidth = 2 imageView.layer.cornerRadius = 8 imageView.contentMode = .scaleAspectFit imageView.clipsToBounds = true @@ -129,13 +129,13 @@ class PinDetailHeader: UIView { } pinMenuButton.snp.makeConstraints { - $0.top.equalTo(pinTitle) - $0.trailing.equalToSuperview().inset(10) + $0.centerY.equalTo(pinTitle) + $0.trailing.equalToSuperview().inset(20) } pinDate.snp.makeConstraints { - $0.top.equalTo(pinTitle.snp.bottom) - $0.leading.equalToSuperview().inset(10) + $0.top.equalTo(pinTitle.snp.bottom).offset(5) + $0.leading.equalToSuperview().inset(20) } pinImageView.snp.makeConstraints { @@ -154,7 +154,7 @@ class PinDetailHeader: UIView { pinDescription.snp.makeConstraints { $0.top.equalTo(pinImageView.snp.bottom).offset(20) - $0.leading.trailing.equalToSuperview().inset(20) + $0.leading.trailing.equalToSuperview().inset(10) if pinDescription.text == nil || pinDescription.text == "" { $0.height.equalTo(0) @@ -169,9 +169,6 @@ class PinDetailHeader: UIView { } } -#Preview { - PinDetailHeader(entity: PinEntity.sampleData[0]) -} #Preview { PinDetailViewController(PinEntity.producerData[1], isPin: true) diff --git a/Pinit/Pinit/Views/PinEdit/PinEditViewController.swift b/Pinit/Pinit/Views/PinEdit/PinEditViewController.swift index 8c66de9..3344eb8 100644 --- a/Pinit/Pinit/Views/PinEdit/PinEditViewController.swift +++ b/Pinit/Pinit/Views/PinEdit/PinEditViewController.swift @@ -14,9 +14,7 @@ enum PinMode { case edit(PinEntity : PinEntity) } - - -final class PinEditViewController: UIViewController, UITextViewDelegate { +final class PinEditViewController: UIViewController{ private var pinEntity: PinEntity! var isAdded: ((PinEntity) -> Void)? // 핀추가가 됐을때 호출되는 클로저 (홈에서만 사용) private var pickedImage: UIImage? @@ -25,40 +23,46 @@ final class PinEditViewController: UIViewController, UITextViewDelegate { private let saveButton : UIButton = { let button = UIButton() - button.backgroundColor = UIColor(red: 28/255, green: 70/255, blue: 245/255, alpha: 1) // #FF8C42 (딥 오렌지) + button.backgroundColor = DesignSystemColor.Purple.value // #FF8C42 (딥 오렌지) button.setTitle("저장", for: .normal) + button.titleLabel?.font = DesignSystemFont.Pretendard_Bold14.value button.layer.cornerRadius = 10 return button }() - let contentTextView : UITextView = { - let textview = UITextView() - textview.backgroundColor = .white - textview.layer.borderColor = UIColor(red: 169/255, green: 169/255, blue: 169/255, alpha: 1).cgColor // #A9A9A9 (다크 라이트 그레이) - textview.layer.borderWidth = 2 // 테두리 두께 설정 - textview.layer.cornerRadius = 5 - textview.text = "남기고자 하는 메모가 있다면 작성해주세요." - textview.textAlignment = .center - textview.textColor = UIColor.black - textview.font = UIFont.systemFont(ofSize: 16) - textview.autocorrectionType = .no - textview.autocapitalizationType = .none - textview.spellCheckingType = .no - return textview + let contentTextView: UITextView = { + let textView = UITextView() + textView.backgroundColor = .white + textView.layer.borderColor = DesignSystemColor.Lavender10.value.cgColor + textView.layer.borderWidth = 2 + textView.layer.cornerRadius = 5 + textView.text = "남기고자 하는 메모가 있다면 작성해주세요." + textView.tintColor = DesignSystemColor.Purple.value + textView.textAlignment = .left + textView.textColor = UIColor.lightGray + textView.font = DesignSystemFont.Pretendard_Bold14.value + textView.autocorrectionType = .no + textView.autocapitalizationType = .none + textView.spellCheckingType = .no + + // Add padding here + textView.textContainerInset = UIEdgeInsets(top: 10, left: 10, bottom: 10, right: 10) + + return textView }() private let titleTextField : UITextField = { let textfield = UITextField() - textfield.layer.borderColor = UIColor(red: 169/255, green: 169/255, blue: 169/255, alpha: 1).cgColor + textfield.layer.borderColor = DesignSystemColor.Lavender10.value.cgColor + textfield.tintColor = DesignSystemColor.Purple.value textfield.layer.borderWidth = 2 textfield.textColor = .black textfield.layer.cornerRadius = 5 textfield.attributedPlaceholder = NSAttributedString( - string: "제목 작성", - attributes: [NSAttributedString.Key.foregroundColor: UIColor.black] + string: "제목을 작성해주세요.", + attributes: [NSAttributedString.Key.foregroundColor: UIColor.lightGray] ) - textfield.font = DesignSystemFont.Pretendard_Bold14 - .value + textfield.font = DesignSystemFont.Pretendard_Bold14.value textfield.leftView = UIView(frame: CGRect(x: 0, y: 0, width: 16, height: 0)) textfield.leftViewMode = .always textfield.autocorrectionType = .no @@ -72,7 +76,7 @@ final class PinEditViewController: UIViewController, UITextViewDelegate { //MARK: 아래 카메라 버튼 button.backgroundColor = .white button.layer.cornerRadius = 75 - button.layer.shadowColor = UIColor.black.cgColor // 색깔 + button.layer.shadowColor = DesignSystemColor.Purple.value.cgColor // 색깔 button.layer.masksToBounds = false // 내부에 속한 요소들이 UIView 밖을 벗어날 때, 잘라낼 것인지. 그림자는 밖에 그려지는 것이므로 false 로 설정 button.layer.shadowOffset = CGSize(width: 0, height: 4) // 위치조정 button.layer.shadowRadius = 10 // 반경 @@ -83,7 +87,8 @@ final class PinEditViewController: UIViewController, UITextViewDelegate { let largeImage = cameraImage.withConfiguration(largeConfig) button.setImage(largeImage, for: .normal) } - button.tintColor = UIColor(red: 96/255, green: 99/255, blue: 104/255, alpha: 1) + // button.tintColor = UIColor(red: 96/255, green: 99/255, blue: 104/255, alpha: 1) + button.tintColor = DesignSystemColor.Purple.value button.imageView?.contentMode = .scaleAspectFit return button @@ -98,6 +103,7 @@ final class PinEditViewController: UIViewController, UITextViewDelegate { private let dateLabel : UILabel = { let label = UILabel() label.text = Date().koreanDateString() + label.font = DesignSystemFont.Pretendard_Bold18.value return label }() @@ -144,7 +150,7 @@ final class PinEditViewController: UIViewController, UITextViewDelegate { init(pinMode: PinMode) { super.init(nibName: nil, bundle: nil) - + switch pinMode { case let .create(latitude, longitude): self.pinEntity = PinEntity( @@ -172,6 +178,9 @@ final class PinEditViewController: UIViewController, UITextViewDelegate { let long = pinEntity.longitude let center = CLLocationCoordinate2D(latitude: lat, longitude: long) // San Francisco, CA let region = MKCoordinateRegion(center: center, span: MKCoordinateSpan(latitudeDelta: 0.005, longitudeDelta: 0.005)) + map.layer.cornerRadius = 10 + map.layer.borderColor = DesignSystemColor.Lavender10.value.cgColor + map.layer.borderWidth = 2 map.setRegion(region, animated: true) @@ -194,6 +203,7 @@ final class PinEditViewController: UIViewController, UITextViewDelegate { titleTextField.inputAccessoryView = keyboardToolBar contentTextView.inputAccessoryView = keyboardToolBar contentTextView.delegate = self + titleTextField.delegate = self closeButton.addTarget(self, action: #selector(dismissButtonTapped), for: .touchUpInside) saveButton.addTarget(self, action: #selector(saveButtonTapped), for: .touchUpInside) @@ -203,8 +213,8 @@ final class PinEditViewController: UIViewController, UITextViewDelegate { mapView.snp.makeConstraints { $0.top.equalTo(view.safeAreaLayoutGuide.snp.top) - $0.width.equalToSuperview() - $0.height.equalToSuperview().dividedBy(4) + $0.leading.trailing.equalToSuperview().inset(3) + $0.height.equalToSuperview().multipliedBy(0.25) } closeButton.snp.makeConstraints { @@ -215,7 +225,7 @@ final class PinEditViewController: UIViewController, UITextViewDelegate { weatherImage.snp.makeConstraints{ $0.top.equalTo(mapView.snp.bottom).offset(10) -// $0.leading.equalTo(view.snp.centerX).offset(100) + // $0.leading.equalTo(view.snp.centerX).offset(100) $0.trailing.equalToSuperview().inset(20) $0.height.width.equalTo(35) } @@ -340,22 +350,6 @@ final class PinEditViewController: UIViewController, UITextViewDelegate { @objc func keyboardWillHide(notification: NSNotification) { view.frame.origin.y = 0 } - - //MARK: 사용자가 텍스트뷰에 입력을 시작할 때 기본 안내 문구 - func textViewDidBeginEditing(_ textView: UITextView) { - if textView.text == "남기고자 하는 메모가 있다면 작성해주세요." { - textView.text = "" - textView.textColor = .black - } - } - - //MARK: 텍스트뷰가 비어있을 때 안내 메시지를 다시 표시 - func textViewDidEndEditing(_ textView: UITextView) { - if textView.text.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty { - textView.text = "남기고자 하는 메모가 있다면 작성해주세요." - textView.textColor = UIColor.lightGray - } - } } //MARK: - PinEditViewController 내에서 사진 선택 기능을 쉽게 사용 @@ -373,6 +367,46 @@ extension PinEditViewController: UIImagePickerControllerDelegate, UINavigationCo } } +extension PinEditViewController: UITextFieldDelegate, UITextViewDelegate{ + + func textFieldDidBeginEditing(_ textField: UITextField) { + if textField.text == "제목을 작성해주세요." { + textField.text = "" + } + textField.layer.borderColor = DesignSystemColor.Purple.value.cgColor + textField.layer.borderWidth = 2.0 + } + + func textFieldDidEndEditing(_ textField: UITextField) { + textField.layer.borderColor = DesignSystemColor.Lavender10.value.cgColor + textField.layer.borderWidth = 2.0 + } + + + //MARK: 사용자가 텍스트뷰에 입력을 시작할 때 기본 안내 문구 + func textViewDidBeginEditing(_ textView: UITextView) { + if textView.text == "남기고자 하는 메모가 있다면 작성해주세요." { + textView.text = "" + textView.textColor = .black + } + textView.layer.borderColor = DesignSystemColor.Purple.value.cgColor + textView.layer.borderWidth = 2.0 + } + + // MARK: 텍스트뷰가 비어있을 때 안내 메시지를 다시 표시 + func textViewDidEndEditing(_ textView: UITextView) { + if textView.text.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty { + textView.text = "남기고자 하는 메모가 있다면 작성해주세요." + textView.textColor = .lightGray + } + + DispatchQueue.main.async { + textView.layer.borderColor = DesignSystemColor.Lavender10.value.cgColor + textView.layer.borderWidth = 2.0 + } + } +} + #Preview{ PinEditViewController(pinMode: .create(latitude: 128.125312, longitude: 37.4864321)) diff --git a/Pinit/Pinit/Views/Setting/SettingViewController.swift b/Pinit/Pinit/Views/Setting/SettingViewController.swift index f24e63b..fb37c23 100644 --- a/Pinit/Pinit/Views/Setting/SettingViewController.swift +++ b/Pinit/Pinit/Views/Setting/SettingViewController.swift @@ -43,12 +43,12 @@ final class SettingViewController: UIViewController { //버튼 레이아웃 설정 resetButton.setTitle("전체 기록 삭제", for: .normal) - resetButton.titleLabel?.font = DesignSystemFont.Pretendard_Medium18.value + resetButton.titleLabel?.font = DesignSystemFont.Pretendard_Bold14.value resetButton.addTarget(self, action: #selector(resetAlert), for: .touchUpInside) resetButton.setTitleColor(.white, for: .normal) - resetButton.backgroundColor = .red + resetButton.backgroundColor = DesignSystemColor.Purple.value resetButton.layer.cornerRadius = 10 resetButton.layer.masksToBounds = false