diff --git a/EATSSU/App/Sources/Data/Firebase/NoticeViewController.swift b/EATSSU/App/Sources/Data/Firebase/NoticeViewController.swift index 08593b93..117de06e 100644 --- a/EATSSU/App/Sources/Data/Firebase/NoticeViewController.swift +++ b/EATSSU/App/Sources/Data/Firebase/NoticeViewController.swift @@ -7,10 +7,10 @@ import UIKit -import EATSSUDesign - import SnapKit +import EATSSUDesign + /// FirebaseRemoteConfig 관련 ViewController class NoticeViewController: BaseViewController { // MARK: - Properties diff --git a/EATSSU/App/Sources/Presentation/Auth/View/LoginView.swift b/EATSSU/App/Sources/Presentation/Auth/View/LoginView.swift index cd3562b2..b576ff6f 100644 --- a/EATSSU/App/Sources/Presentation/Auth/View/LoginView.swift +++ b/EATSSU/App/Sources/Presentation/Auth/View/LoginView.swift @@ -7,35 +7,42 @@ import UIKit -import EATSSUDesign - import SnapKit -import Then import EATSSUDesign final class LoginView: BaseUIView { // MARK: - UI Components - private let logoImage = UIImageView().then { - $0.image = EATSSUDesignAsset.Images.authLogo.image - } + private let logoImage: UIImageView = { + let imageView = UIImageView() + imageView.image = EATSSUDesignAsset.Images.authLogo.image + return imageView + }() - private let logoSubTitle = UIImageView().then { imageView in + private let logoSubTitle: UIImageView = { + let imageView = UIImageView() imageView.image = EATSSUDesignAsset.Images.authSubTitle.image - } + return imageView + }() - let appleLoginButton = UIButton().then { button in + let appleLoginButton: UIButton = { + let button = UIButton() button.setImage(EATSSUDesignAsset.Images.appleLoginButton.image, for: .normal) - } + return button + }() - let kakaoLoginButton = UIButton().then { button in + let kakaoLoginButton: UIButton = { + let button = UIButton() button.setImage(EATSSUDesignAsset.Images.kakaoLoginButton.image, for: .normal) - } + return button + }() - let lookingWithNoSignInButton = UIButton().then { button in + let lookingWithNoSignInButton: UIButton = { + let button = UIButton() button.setImage(EATSSUDesignAsset.Images.lookAroundButton.image, for: .normal) - } + return button + }() override func configureUI() { addSubviews( @@ -48,29 +55,29 @@ final class LoginView: BaseUIView { } override func setLayout() { - logoImage.snp.makeConstraints { make in - make.centerX.equalToSuperview() - make.top.equalToSuperview().inset(223) + logoImage.snp.makeConstraints { + $0.centerX.equalToSuperview() + $0.top.equalToSuperview().inset(223) } - logoSubTitle.snp.makeConstraints { make in - make.centerX.equalToSuperview() - make.top.equalTo(logoImage.snp.bottom) + logoSubTitle.snp.makeConstraints { + $0.centerX.equalToSuperview() + $0.top.equalTo(logoImage.snp.bottom) } - appleLoginButton.snp.makeConstraints { make in - make.centerX.equalToSuperview() - make.bottom.equalTo(self.safeAreaLayoutGuide).inset(151) + appleLoginButton.snp.makeConstraints { + $0.centerX.equalToSuperview() + $0.bottom.equalTo(self.safeAreaLayoutGuide).inset(151) } - kakaoLoginButton.snp.makeConstraints { make in - make.centerX.equalToSuperview() - make.bottom.equalTo(self.safeAreaLayoutGuide).inset(90) + kakaoLoginButton.snp.makeConstraints { + $0.centerX.equalToSuperview() + $0.bottom.equalTo(self.safeAreaLayoutGuide).inset(90) } - lookingWithNoSignInButton.snp.makeConstraints { make in - make.centerX.equalToSuperview() - make.bottom.equalTo(self.safeAreaLayoutGuide).inset(30) + lookingWithNoSignInButton.snp.makeConstraints { + $0.centerX.equalToSuperview() + $0.bottom.equalTo(self.safeAreaLayoutGuide).inset(30) } } } diff --git a/EATSSU/App/Sources/Presentation/Auth/View/SetNickNameView.swift b/EATSSU/App/Sources/Presentation/Auth/View/SetNickNameView.swift index b20d3f7e..738592d3 100644 --- a/EATSSU/App/Sources/Presentation/Auth/View/SetNickNameView.swift +++ b/EATSSU/App/Sources/Presentation/Auth/View/SetNickNameView.swift @@ -7,10 +7,9 @@ import UIKit -import EATSSUDesign - import SnapKit -import Then + +import EATSSUDesign final class SetNickNameView: BaseUIView { // MARK: - Properties @@ -19,52 +18,48 @@ final class SetNickNameView: BaseUIView { // MARK: - UI Components - /// "EAT-SSU에서 사용할 닉네임을 설정해 주세요" 레이블 - private let nickNameLabel = UILabel().then { - $0.text = "EAT-SSU에서 사용할\n닉네임을 설정해 주세요" - $0.numberOfLines = 2 - $0.font = EATSSUDesignFontFamily.Pretendard.bold.font(size: 18) - } - - /// 닉네임 입력 텍스트필드 - public let inputNickNameTextField = ESTextField(placeholder: TextLiteral.inputNickName).then { _ in - /* - 해야 할 일 - - 현재 ESTextField로서는 크게 문제가 없는데, 혹시 모르는 추가 설정이 놓친 게 없나 검토 필요 - */ - } - - /// "중복확인" 버튼 - public var nicknameDoubleCheckButton = ESButton(size: .small, title: "중복 확인").then { esButton in - /* - 해야 할 일 - - 초기 버튼의 세팅값을 false로 주는 항목은 ESButton 초기화 값으로 할당하고 싶다. - - 하지만 계산된 프로퍼티로 설계되어 있어서 어떻게 해야 할 지 모르겠다. - */ - esButton.isEnabled = false - } - - /// 닉네임 중복확인 결과 메시지 레이블 - public var nicknameValidationMessageLabel = UILabel().then { - $0.text = TextLiteral.hintInputNickName - $0.textColor = EATSSUDesignAsset.Color.GrayScale.gray400.color - $0.font = EATSSUDesignFontFamily.Pretendard.regular.font(size: 12) - } - - private lazy var setNickNameStackView: UIStackView = .init( - arrangedSubviews: [ + private let nickNameLabel: UILabel = { + let label = UILabel() + label.text = "EAT-SSU에서 사용할\n닉네임을 설정해 주세요" + label.numberOfLines = 2 + label.font = EATSSUDesignFontFamily.Pretendard.bold.font(size: 18) + return label + }() + + public let inputNickNameTextField: ESTextField = { + let textField = ESTextField(placeholder: TextLiteral.inputNickName) + return textField + }() + + public var nicknameDoubleCheckButton: ESButton = { + let button = ESButton(size: .small, title: "중복 확인") + button.isEnabled = false + return button + }() + + public var nicknameValidationMessageLabel: UILabel = { + let label = UILabel() + label.text = TextLiteral.hintInputNickName + label.textColor = EATSSUDesignAsset.Color.GrayScale.gray400.color + label.font = EATSSUDesignFontFamily.Pretendard.regular.font(size: 12) + return label + }() + + private lazy var setNickNameStackView: UIStackView = { + let stackView = UIStackView(arrangedSubviews: [ inputNickNameTextField, - nicknameValidationMessageLabel, - ] - ).then { - $0.axis = .vertical - $0.spacing = 8.0 - } - - /// "완료하기" 버튼 - public var completeSettingNickNameButton = ESButton(size: .big, title: "완료하기").then { esButton in - esButton.isEnabled = false - } + nicknameValidationMessageLabel + ]) + stackView.axis = .vertical + stackView.spacing = 8.0 + return stackView + }() + + public var completeSettingNickNameButton: ESButton = { + let button = ESButton(size: .big, title: "완료하기") + button.isEnabled = false + return button + }() // MARK: - Initializer @@ -105,7 +100,7 @@ final class SetNickNameView: BaseUIView { } completeSettingNickNameButton.snp.makeConstraints { $0.horizontalEdges.equalToSuperview().inset(16) - $0.bottom.equalTo(self.safeAreaLayoutGuide).inset(26) + $0.bottom.equalTo(safeAreaLayoutGuide).inset(26) $0.height.equalTo(50) } } diff --git a/EATSSU/App/Sources/Presentation/Auth/ViewController/LoginViewController.swift b/EATSSU/App/Sources/Presentation/Auth/ViewController/LoginViewController.swift index ed3029bb..2d87980b 100644 --- a/EATSSU/App/Sources/Presentation/Auth/ViewController/LoginViewController.swift +++ b/EATSSU/App/Sources/Presentation/Auth/ViewController/LoginViewController.swift @@ -13,7 +13,6 @@ import KakaoSDKUser import Moya import RealmSwift import SnapKit -import Then final class LoginViewController: BaseViewController { // MARK: - Properties diff --git a/EATSSU/App/Sources/Presentation/Home/View/HomeCalendarView.swift b/EATSSU/App/Sources/Presentation/Home/View/HomeCalendarView.swift index e65a4186..0fed7030 100644 --- a/EATSSU/App/Sources/Presentation/Home/View/HomeCalendarView.swift +++ b/EATSSU/App/Sources/Presentation/Home/View/HomeCalendarView.swift @@ -7,11 +7,10 @@ import UIKit -import EATSSUDesign - import FSCalendar import SnapKit -import Then + +import EATSSUDesign protocol CalendarSeletionDelegate: AnyObject { func didSelectCalendar(date: Date) diff --git a/EATSSU/App/Sources/Presentation/Home/View/HomeRestaurantView.swift b/EATSSU/App/Sources/Presentation/Home/View/HomeRestaurantView.swift index 93860b5d..816fb743 100644 --- a/EATSSU/App/Sources/Presentation/Home/View/HomeRestaurantView.swift +++ b/EATSSU/App/Sources/Presentation/Home/View/HomeRestaurantView.swift @@ -9,17 +9,21 @@ import UIKit import Moya import SnapKit -import Then + +import EATSSUDesign final class HomeRestaurantView: BaseUIView { // MARK: - UI Components let refreshControl = UIRefreshControl() - lazy var restaurantTableView = UITableView(frame: .zero, style: .insetGrouped).then { - $0.separatorStyle = .none - $0.contentInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0) - } + lazy var restaurantTableView: UITableView = { + let tableView = UITableView(frame: .zero, style: .insetGrouped) + tableView.separatorStyle = .none + tableView.contentInset = .zero + tableView.backgroundColor = EATSSUDesignAsset.Color.GrayScale.gray100.color + return tableView + }() // MARK: - init @@ -37,8 +41,7 @@ final class HomeRestaurantView: BaseUIView { override func setLayout() { restaurantTableView.snp.makeConstraints { - $0.top.equalToSuperview().offset(45) - $0.leading.bottom.trailing.equalToSuperview() + $0.edges.equalToSuperview() } } diff --git a/EATSSU/App/Sources/Presentation/Home/View/RestaurantInfoView/RestaurantInfoView.swift b/EATSSU/App/Sources/Presentation/Home/View/RestaurantInfoView/RestaurantInfoView.swift index 266bb18b..41498abe 100644 --- a/EATSSU/App/Sources/Presentation/Home/View/RestaurantInfoView/RestaurantInfoView.swift +++ b/EATSSU/App/Sources/Presentation/Home/View/RestaurantInfoView/RestaurantInfoView.swift @@ -7,68 +7,85 @@ import UIKit -import EATSSUDesign - import MapKit import SnapKit -import Then + +import EATSSUDesign final class RestaurantInfoView: BaseUIView { // MARK: - UI Components let restaurantImage = UIImageView(image: EATSSUDesignAsset.Images.restaurantImage.image) - var restaurantNameLabel = UILabel().then { - $0.text = "학생 식당" - $0.font = .header1 - } - - private let locationTitleLabel = UILabel().then { - $0.text = "식당 위치" - $0.font = .header2 - } - - private let imageTitleLabel = UILabel().then { - $0.text = "식당 사진" - $0.font = .header2 - } - - private var locationLabel = UILabel().then { - $0.text = "숭실대학교" - $0.font = .body1 - } - - private let openingTimeTitleLabel = UILabel().then { - $0.text = "영업 시간" - $0.font = .header2 - } - - private let openingTimeLabel = UILabel().then { + var restaurantNameLabel: UILabel = { + let label = UILabel() + label.text = "학생 식당" + label.font = EATSSUDesignFontFamily.Pretendard.bold.font(size: 20) + return label + }() + + private let locationTitleLabel: UILabel = { + let label = UILabel() + label.text = "식당 위치" + label.font = EATSSUDesignFontFamily.Pretendard.bold.font(size: 18) + return label + }() + + private let imageTitleLabel: UILabel = { + let label = UILabel() + label.text = "식당 사진" + label.font = EATSSUDesignFontFamily.Pretendard.bold.font(size: 18) + return label + }() + + private var locationLabel: UILabel = { + let label = UILabel() + label.text = "숭실대학교" + label.font = EATSSUDesignFontFamily.Pretendard.medium.font(size: 16) + return label + }() + + private let openingTimeTitleLabel: UILabel = { + let label = UILabel() + label.text = "영업 시간" + label.font = EATSSUDesignFontFamily.Pretendard.bold.font(size: 18) + return label + }() + + private let openingTimeLabel: UILabel = { + let label = UILabel() let paragraphStyle = NSMutableParagraphStyle() paragraphStyle.lineSpacing = 10 - let attributedString = NSAttributedString(string: "08:00~09:30\n11:00~14:00\n17:00~18:30", - attributes: [NSAttributedString.Key.paragraphStyle: paragraphStyle]) - $0.attributedText = attributedString - $0.numberOfLines = 0 - $0.textAlignment = .right - $0.font = .body1 - } - - private let ectTitleLabel = UILabel().then { - $0.text = "비고" - $0.font = .header2 - } - - private let ectLabel = UILabel().then { + label.attributedText = NSAttributedString( + string: "08:00~09:30\n11:00~14:00\n17:00~18:30", + attributes: [NSAttributedString.Key.paragraphStyle: paragraphStyle] + ) + label.numberOfLines = 0 + label.textAlignment = .right + label.font = EATSSUDesignFontFamily.Pretendard.medium.font(size: 16) + return label + }() + + private let ectTitleLabel: UILabel = { + let label = UILabel() + label.text = "비고" + label.font = EATSSUDesignFontFamily.Pretendard.bold.font(size: 18) + return label + }() + + private let ectLabel: UILabel = { + let label = UILabel() let paragraphStyle = NSMutableParagraphStyle() paragraphStyle.lineSpacing = 10 - let attributedString = NSAttributedString(string: "아시안푸드, 돈까스, 샐러드, 국밥 등\n카페", - attributes: [NSAttributedString.Key.paragraphStyle: paragraphStyle]) - $0.attributedText = attributedString - $0.numberOfLines = 0 - $0.textAlignment = .right - $0.font = .body1 - } + label.attributedText = NSAttributedString( + string: "아시안푸드, 돈까스, 샐러드, 국밥 등\n카페", + attributes: [NSAttributedString.Key.paragraphStyle: paragraphStyle] + ) + label.numberOfLines = 0 + label.textAlignment = .right + label.font = EATSSUDesignFontFamily.Pretendard.medium.font(size: 16) + return label + }() // MARK: - Functions diff --git a/EATSSU/App/Sources/Presentation/Home/View/RestaurantInfoView/TimeDataTableViewCell.swift b/EATSSU/App/Sources/Presentation/Home/View/RestaurantInfoView/TimeDataTableViewCell.swift index 62c1c75e..d6a38605 100644 --- a/EATSSU/App/Sources/Presentation/Home/View/RestaurantInfoView/TimeDataTableViewCell.swift +++ b/EATSSU/App/Sources/Presentation/Home/View/RestaurantInfoView/TimeDataTableViewCell.swift @@ -7,6 +7,8 @@ import UIKit +import SnapKit + final class TimeDataTableViewCell: UITableViewCell { // MARK: - Properties @@ -14,17 +16,21 @@ final class TimeDataTableViewCell: UITableViewCell { // MARK: - UI Components - private var timepartLabel = UILabel().then { - $0.font = .medium(size: 16) - $0.textColor = .primary - $0.textAlignment = .left - } + private var timepartLabel: UILabel = { + let label = UILabel() + label.font = .medium(size: 16) + label.textColor = .primary + label.textAlignment = .left + return label + }() - private var timeLabel = UILabel().then { - $0.font = .medium(size: 16) - $0.numberOfLines = 0 - $0.textAlignment = .right - } + private var timeLabel: UILabel = { + let label = UILabel() + label.font = .medium(size: 16) + label.numberOfLines = 0 + label.textAlignment = .right + return label + }() // MARK: - init @@ -43,8 +49,10 @@ final class TimeDataTableViewCell: UITableViewCell { // MARK: - Functions func configureUI() { - addSubviews(timepartLabel, - timeLabel) + addSubviews( + timepartLabel, + timeLabel + ) } func setLayout() { diff --git a/EATSSU/App/Sources/Presentation/Home/View/RestaurantTableView/RestaurantMenuGroupCell.swift b/EATSSU/App/Sources/Presentation/Home/View/RestaurantTableView/RestaurantMenuGroupCell.swift index 019bf019..fd6780bc 100644 --- a/EATSSU/App/Sources/Presentation/Home/View/RestaurantTableView/RestaurantMenuGroupCell.swift +++ b/EATSSU/App/Sources/Presentation/Home/View/RestaurantTableView/RestaurantMenuGroupCell.swift @@ -7,41 +7,62 @@ import UIKit -import EATSSUDesign - import SnapKit +import EATSSUDesign + +/// 식당의 "오늘의 메뉴" + 메뉴 리스트를 하나의 셀에서 표현하는 커스텀 테이블뷰 셀 final class RestaurantMenuGroupCell: BaseTableViewCell { static let identifier = "RestaurantMenuGroupCell" - private let wrapperView = UIView() + private let wrapperView: UIView = { + let view = UIView() + view.layer.cornerRadius = 12 + view.layer.borderWidth = 1 + view.layer.borderColor = UIColor.gray200.cgColor + view.backgroundColor = .white + return view + }() + private let titleView = RestaurantMenuTitleView() - private let menuStackView = UIStackView() - - private let emptyLabel = UILabel().then { - $0.text = "영업 시간이 아니에요." - $0.font = .semiBold(size: 10) - $0.textColor = .black - $0.textAlignment = .center - $0.numberOfLines = 0 - $0.isHidden = true - } + private let menuStackView: UIStackView = { + let stack = UIStackView() + stack.axis = .vertical + return stack + }() + + private let emptyLabel: UILabel = { + let label = UILabel() + label.text = "영업 시간이 아니에요." + label.font = EATSSUDesignFontFamily.Pretendard.regular.font(size: 10) + label.textColor = .black + label.textAlignment = .center + label.numberOfLines = 0 + label.isHidden = true + return label + }() + + // 메뉴 뷰(View) 재사용을 위한 풀 + // scroll 등으로 셀이 재사용될 때 menuStackView 내부의 뷰들을 재활용하기 위함 + private var itemViewPool: [RestaurantMenuItemView] = [] + + // UI 구성 override func configureUI() { + self.selectionStyle = .none + self.selectedBackgroundView = UIView() contentView.addSubview(wrapperView) wrapperView.addSubviews(titleView, emptyLabel, menuStackView) - wrapperView.layer.cornerRadius = 12 - wrapperView.layer.borderWidth = 1 - wrapperView.layer.borderColor = UIColor.gray200.cgColor - wrapperView.backgroundColor = .white - menuStackView.axis = .vertical - menuStackView.spacing = 0 } + // 오토레이아웃 설정 override func setLayout() { - wrapperView.snp.makeConstraints { $0.edges.equalToSuperview().inset(0) } + wrapperView.snp.makeConstraints { + $0.top.leading.trailing.equalToSuperview() + $0.bottom.equalToSuperview().priority(UILayoutPriority.defaultHigh) + } titleView.snp.makeConstraints { $0.top.horizontalEdges.equalToSuperview() @@ -55,13 +76,40 @@ final class RestaurantMenuGroupCell: BaseTableViewCell { menuStackView.snp.makeConstraints { $0.top.equalTo(titleView.snp.bottom) - $0.horizontalEdges.bottom.equalToSuperview().inset(6) + $0.horizontalEdges.bottom.equalToSuperview() + } + } + + /// 셀이 재사용되기 전에 호출됨 + /// menuStackView에 남아있는 메뉴 뷰들을 제거하고, 재사용 풀에 저장 + override func prepareForReuse() { + super.prepareForReuse() + for view in menuStackView.arrangedSubviews { + view.removeFromSuperview() + if let itemView = view as? RestaurantMenuItemView { + itemViewPool.append(itemView) + } + } + } + + /// 재사용 가능한 뷰가 있다면 꺼내고, 없으면 새로 생성 + private func dequeueReusableItemView() -> RestaurantMenuItemView { + if let reused = itemViewPool.popLast() { + return reused + } else { + return RestaurantMenuItemView() } } - func configure(with menus: [MenuTypeInfo], at indexPath: IndexPath, onMenuTap: @escaping (IndexPath) -> Void) { + /// 메뉴 데이터를 이용해 스택뷰를 구성 + /// - Parameter menus: 메뉴 리스트 (MenuTypeInfo 배열) + /// - Parameter indexPath: 현재 테이블뷰 indexPath (섹션, row) + /// - Parameter onMenuTap: 터치 시 실행할 클로저 (section, index 전달) + func configure(with menus: [MenuTypeInfo], at indexPath: IndexPath, onMenuTap: @escaping (IndexPath, Int) -> Void) { + // 이전 뷰들 제거 (주의: prepareForReuse와 중복 제거됨 → 안정성 보장용) menuStackView.arrangedSubviews.forEach { $0.removeFromSuperview() } + // 메뉴가 없을 경우 → 안내 텍스트 표시 if menus.isEmpty { emptyLabel.isHidden = false menuStackView.isHidden = true @@ -69,12 +117,15 @@ final class RestaurantMenuGroupCell: BaseTableViewCell { emptyLabel.isHidden = true menuStackView.isHidden = false + // 메뉴 개수만큼 뷰 생성 or 재사용하여 추가 for (idx, menu) in menus.enumerated() { - let itemView = RestaurantMenuItemView() - let itemIndexPath = IndexPath(row: idx + 1, section: indexPath.section) - itemView.indexPath = itemIndexPath - itemView.onTap = onMenuTap - itemView.bind(menu) + let itemView = dequeueReusableItemView() + itemView.removeFromSuperview() + itemView.reset() // label 초기화 + itemView.indexPath = indexPath // 어떤 셀인지 기억 + itemView.menuIndex = idx // 어떤 메뉴인지 기억 + itemView.onTap = onMenuTap // 탭 콜백 연결 + itemView.bind(menu) // 데이터 바인딩 menuStackView.addArrangedSubview(itemView) } } diff --git a/EATSSU/App/Sources/Presentation/Home/View/RestaurantTableView/RestaurantMenuItemView.swift b/EATSSU/App/Sources/Presentation/Home/View/RestaurantTableView/RestaurantMenuItemView.swift index 0dade7b8..f34b9ebc 100644 --- a/EATSSU/App/Sources/Presentation/Home/View/RestaurantTableView/RestaurantMenuItemView.swift +++ b/EATSSU/App/Sources/Presentation/Home/View/RestaurantTableView/RestaurantMenuItemView.swift @@ -9,65 +9,88 @@ import UIKit import SnapKit +import EATSSUDesign + +/// 식당 메뉴 아이템 하나를 나타내는 커스텀 뷰 +/// 구성: 메뉴명(name), 가격(price), 평점(rating) final class RestaurantMenuItemView: BaseUIView { + // 이 뷰가 속한 TableView의 위치를 저장 (터치 시 indexPath 전달용) var indexPath: IndexPath? - var onTap: ((IndexPath) -> Void)? - - private let backgroundWrapper = UIView() - private let nameLabel = UILabel().then { - $0.numberOfLines = 0 - $0.font = .body3 - } - - private let priceLabel = UILabel().then { - $0.font = .body3 - $0.textAlignment = .center - } + // 터치 시 실행할 클로저 + var onTap: ((IndexPath, Int) -> Void)? + var menuIndex: Int = 0 - private let ratingLabel = UILabel().then { - $0.font = .body3 - $0.textAlignment = .center - } - - private let contentStackView = UIStackView().then { - $0.axis = .horizontal - $0.alignment = .center - $0.spacing = 24 - } + // 배경 래퍼 뷰: 터치 배경 효과용 + private let backgroundWrapper = UIView() + // 메뉴명 라벨 + private let nameLabel: UILabel = { + let label = UILabel() + label.numberOfLines = 0 + label.font = EATSSUDesignFontFamily.Pretendard.regular.font(size: 14) + label.setContentHuggingPriority(.defaultLow, for: .horizontal) + label.setContentCompressionResistancePriority(.defaultLow, for: .horizontal) + return label + }() + + // 가격 라벨 + private let priceLabel: UILabel = { + let label = UILabel() + label.font = EATSSUDesignFontFamily.Pretendard.regular.font(size: 14) + label.textAlignment = .center + label.setContentHuggingPriority(.required, for: .horizontal) + label.setContentCompressionResistancePriority(.required, for: .horizontal) + return label + }() + + // 평점 라벨 + private let ratingLabel: UILabel = { + let label = UILabel() + label.font = EATSSUDesignFontFamily.Pretendard.regular.font(size: 14) + label.textAlignment = .center + label.setContentHuggingPriority(.required, for: .horizontal) + label.setContentCompressionResistancePriority(.required, for: .horizontal) + return label + }() + + // 콘텐츠 수평 스택 뷰 (이름, 가격, 평점 수평 정렬) + private let contentStackView: UIStackView = { + let stackView = UIStackView() + stackView.axis = .horizontal + stackView.alignment = .top + stackView.spacing = 24 + stackView.distribution = .fill + return stackView + }() + + // UI 구성 요소를 계층 구조에 추가 override func configureUI() { addSubview(backgroundWrapper) backgroundWrapper.addSubview(contentStackView) - backgroundWrapper.layer.cornerRadius = 0 - backgroundWrapper.clipsToBounds = true - - contentStackView.addArrangedSubviews([nameLabel, priceLabel, ratingLabel]) - let tapGesture = UILongPressGestureRecognizer(target: self, action: #selector(handleTap(_:))) - tapGesture.minimumPressDuration = 0 - self.addGestureRecognizer(tapGesture) + // 스택 뷰에 라벨들 추가 + contentStackView.addArrangedSubviews([nameLabel, priceLabel, ratingLabel]) } + // SnapKit을 이용한 오토레이아웃 설정 override func setLayout() { backgroundWrapper.snp.makeConstraints { $0.edges.equalToSuperview() } contentStackView.snp.makeConstraints { - $0.top.equalToSuperview().offset(5) - $0.horizontalEdges.equalToSuperview().inset(8) - $0.bottom.equalToSuperview().inset(5) + $0.edges.equalToSuperview().inset(UIEdgeInsets(top: 8, left: 12, bottom: 8, right: 12)) } - nameLabel.snp.makeConstraints { $0.width.equalTo(210) } priceLabel.snp.makeConstraints { $0.width.equalTo(47) } ratingLabel.snp.makeConstraints { $0.width.equalTo(25) } } + /// 모델을 기반으로 뷰에 데이터를 바인딩하는 함수 func bind(_ model: MenuTypeInfo) { switch model { case let .change(data): - nameLabel.text = data.briefMenus.map(\ .name).joined(separator: "+") + nameLabel.text = data.briefMenus.map(\.name).joined(separator: "+") priceLabel.text = data.price?.formattedWithCommas ?? "" ratingLabel.text = data.rating != nil ? String(format: "%.1f", data.rating!) : "-" case let .fix(data): @@ -77,18 +100,44 @@ final class RestaurantMenuItemView: BaseUIView { } } - @objc private func handleTap(_ gesture: UILongPressGestureRecognizer) { - switch gesture.state { - case .began: - backgroundWrapper.backgroundColor = UIColor.gray300 - case .ended: - backgroundWrapper.backgroundColor = .clear - guard let indexPath else { return } - onTap?(indexPath) - case .cancelled, .failed: - backgroundWrapper.backgroundColor = .clear - default: - break + // 리셋 함수 + func reset() { + nameLabel.text = nil + priceLabel.text = nil + ratingLabel.text = nil + + nameLabel.numberOfLines = 0 + nameLabel.textAlignment = .left + priceLabel.textAlignment = .center + ratingLabel.textAlignment = .center + backgroundWrapper.backgroundColor = .clear + } + + // 터치 시작: 배경 강조 효과 + override func touchesBegan(_ touches: Set, with event: UIEvent?) { + super.touchesBegan(touches, with: event) + backgroundWrapper.backgroundColor = UIColor.gray300 + } + + // 터치 취소: 배경 색상 복원 + override func touchesCancelled(_ touches: Set, with event: UIEvent?) { + super.touchesCancelled(touches, with: event) + backgroundWrapper.backgroundColor = .clear + } + + // 터치 종료 시 실행: 영역 안에 있으면 onTap 클로저 실행 + override func touchesEnded(_ touches: Set, with event: UIEvent?) { + super.touchesEnded(touches, with: event) + + guard let touch = touches.first else { return } + let location = touch.location(in: self) + + if bounds.contains(location), let indexPath = indexPath { + onTap?(indexPath, menuIndex) + } + + DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) { + self.backgroundWrapper.backgroundColor = .clear } } } diff --git a/EATSSU/App/Sources/Presentation/Home/View/RestaurantTableView/RestaurantMenuTitleView.swift b/EATSSU/App/Sources/Presentation/Home/View/RestaurantTableView/RestaurantMenuTitleView.swift index 098426a7..b99752d9 100644 --- a/EATSSU/App/Sources/Presentation/Home/View/RestaurantTableView/RestaurantMenuTitleView.swift +++ b/EATSSU/App/Sources/Presentation/Home/View/RestaurantTableView/RestaurantMenuTitleView.swift @@ -6,40 +6,52 @@ // import UIKit + import SnapKit +import EATSSUDesign + final class RestaurantMenuTitleView: BaseUIView { - private let nameLabel = UILabel().then { - $0.text = TextLiteral.Home.todayMenu - $0.font = .body2 - } + private let nameLabel: UILabel = { + let label = UILabel() + label.text = TextLiteral.Home.todayMenu + label.font = EATSSUDesignFontFamily.Pretendard.medium.font(size: 14) + return label + }() - private let priceLabel = UILabel().then { - $0.text = TextLiteral.Home.price - $0.font = .body2 - $0.textAlignment = .center - } + private let priceLabel: UILabel = { + let label = UILabel() + label.text = TextLiteral.Home.price + label.font = EATSSUDesignFontFamily.Pretendard.medium.font(size: 14) + label.textAlignment = .center + return label + }() - private let ratingLabel = UILabel().then { - $0.text = TextLiteral.Home.rating - $0.font = .body2 - $0.textAlignment = .center - } + private let ratingLabel: UILabel = { + let label = UILabel() + label.text = TextLiteral.Home.rating + label.font = EATSSUDesignFontFamily.Pretendard.medium.font(size: 14) + label.textAlignment = .center + return label + }() - private let lineView = UIView().then { - $0.backgroundColor = .gray200 - } + private lazy var infoTableStackView: UIStackView = { + let stackView = UIStackView(arrangedSubviews: [nameLabel, priceLabel, ratingLabel]) + stackView.axis = .horizontal + stackView.alignment = .center + stackView.spacing = 24 + return stackView + }() - private lazy var infoTableStackView = UIStackView().then { - $0.addArrangedSubviews([nameLabel, priceLabel, ratingLabel]) - $0.axis = .horizontal - $0.alignment = .center - $0.spacing = 24 - } + private let lineView: UIView = { + let view = UIView() + view.backgroundColor = .gray200 + return view + }() override func configureUI() { - self.addSubviews(infoTableStackView, lineView) + addSubviews(infoTableStackView, lineView) } override func setLayout() { @@ -48,16 +60,19 @@ final class RestaurantMenuTitleView: BaseUIView { $0.horizontalEdges.equalToSuperview().inset(12) } - nameLabel.setContentHuggingPriority(.defaultLow, for: .horizontal) - nameLabel.setContentCompressionResistancePriority(.defaultLow, for: .horizontal) - priceLabel.snp.makeConstraints { $0.width.equalTo(47) } - ratingLabel.snp.makeConstraints { $0.width.equalTo(25) } + priceLabel.snp.makeConstraints { + $0.width.equalTo(47) + } + + ratingLabel.snp.makeConstraints { + $0.width.equalTo(25) + } lineView.snp.makeConstraints { $0.top.equalTo(infoTableStackView.snp.bottom).offset(11) $0.horizontalEdges.equalToSuperview().inset(8) - $0.height.equalTo(1) - $0.bottom.equalToSuperview().inset(6) + $0.height.equalTo(1).priority(UILayoutPriority.defaultLow) + $0.bottom.equalToSuperview().inset(6).priority(UILayoutPriority.defaultHigh) } } } diff --git a/EATSSU/App/Sources/Presentation/Home/View/RestaurantTableView/RestaurantTableViewHeader.swift b/EATSSU/App/Sources/Presentation/Home/View/RestaurantTableView/RestaurantTableViewHeader.swift index 0167bd50..0e61c671 100644 --- a/EATSSU/App/Sources/Presentation/Home/View/RestaurantTableView/RestaurantTableViewHeader.swift +++ b/EATSSU/App/Sources/Presentation/Home/View/RestaurantTableView/RestaurantTableViewHeader.swift @@ -7,10 +7,10 @@ import UIKit -import EATSSUDesign - import SnapKit +import EATSSUDesign + class RestaurantTableViewHeader: BaseTableViewHeaderView { static let identifier = "RestaurantTableViewHeader" @@ -31,23 +31,19 @@ class RestaurantTableViewHeader: BaseTableViewHeaderView { } func setViewProperties() { - titleLabel.do { - $0.font = .subtitle1 - $0.text = "기숙사 식당" - } - infoButton.do { - var configuration = UIButton.Configuration.plain() - configuration.baseForegroundColor = EATSSUDesignAsset.Color.GrayScale.gray600.color - configuration.image = EATSSUDesignAsset.Images.icInfo.image - configuration.imagePlacement = .trailing - configuration.imagePadding = 4.0 - $0.configuration = configuration - } - stackView.do { - $0.axis = .horizontal - $0.distribution = .equalSpacing - $0.alignment = .center - } + titleLabel.font = EATSSUDesignFontFamily.Pretendard.bold.font(size: 16) + titleLabel.text = "기숙사 식당" + + var configuration = UIButton.Configuration.plain() + configuration.baseForegroundColor = EATSSUDesignAsset.Color.GrayScale.gray600.color + configuration.image = EATSSUDesignAsset.Images.icInfo.image + configuration.imagePlacement = .trailing + configuration.imagePadding = 4.0 + infoButton.configuration = configuration + + stackView.axis = .horizontal + stackView.distribution = .equalSpacing + stackView.alignment = .center } func configureUI() { diff --git a/EATSSU/App/Sources/Presentation/Home/View/RestaurantTableView/RestaurantTableViewMenuCell.swift b/EATSSU/App/Sources/Presentation/Home/View/RestaurantTableView/RestaurantTableViewMenuCell.swift index 376502b9..809041b5 100644 --- a/EATSSU/App/Sources/Presentation/Home/View/RestaurantTableView/RestaurantTableViewMenuCell.swift +++ b/EATSSU/App/Sources/Presentation/Home/View/RestaurantTableView/RestaurantTableViewMenuCell.swift @@ -9,6 +9,8 @@ import UIKit import SnapKit +import EATSSUDesign + class RestaurantTableViewMenuCell: BaseTableViewCell { // MARK: - Properties @@ -77,24 +79,19 @@ class RestaurantTableViewMenuCell: BaseTableViewCell { extension RestaurantTableViewMenuCell { private func setViewProperties() { - contentStackView.do { - $0.axis = .horizontal - $0.alignment = .center - $0.spacing = 24 - } - nameLabel.do { - $0.font = .body3 - $0.numberOfLines = 0 - $0.lineBreakMode = .byWordWrapping - } - priceLabel.do { - $0.font = .body3 - $0.textAlignment = .center - } - ratingLabel.do { - $0.font = .body3 - $0.textAlignment = .center - } + contentStackView.axis = .horizontal + contentStackView.alignment = .center + contentStackView.spacing = 24 + + nameLabel.font = EATSSUDesignFontFamily.Pretendard.regular.font(size: 14) + nameLabel.numberOfLines = 0 + nameLabel.lineBreakMode = .byWordWrapping + + priceLabel.font = EATSSUDesignFontFamily.Pretendard.regular.font(size: 14) + priceLabel.textAlignment = .center + + ratingLabel.font = EATSSUDesignFontFamily.Pretendard.regular.font(size: 14) + ratingLabel.textAlignment = .center } public func bind(_ model: MenuTypeInfo) { diff --git a/EATSSU/App/Sources/Presentation/Home/View/RestaurantTableView/RestaurantTableViewMenuTitleCell.swift b/EATSSU/App/Sources/Presentation/Home/View/RestaurantTableView/RestaurantTableViewMenuTitleCell.swift index 17a0238d..4b2cfaea 100644 --- a/EATSSU/App/Sources/Presentation/Home/View/RestaurantTableView/RestaurantTableViewMenuTitleCell.swift +++ b/EATSSU/App/Sources/Presentation/Home/View/RestaurantTableView/RestaurantTableViewMenuTitleCell.swift @@ -7,6 +7,10 @@ import UIKit +import SnapKit + +import EATSSUDesign + class RestaurantTableViewMenuTitleCell: BaseTableViewCell { // MARK: - Properties @@ -14,42 +18,48 @@ class RestaurantTableViewMenuTitleCell: BaseTableViewCell { // MARK: - UI Components - private let nameLabel = UILabel().then { - $0.text = TextLiteral.Home.todayMenu - $0.font = .body2 - } + private let nameLabel: UILabel = { + let label = UILabel() + label.text = TextLiteral.Home.todayMenu + label.font = EATSSUDesignFontFamily.Pretendard.medium.font(size: 14) + return label + }() - private let priceLabel = UILabel().then { - $0.text = TextLiteral.Home.price - $0.font = .body2 - $0.textAlignment = .center - } + private let priceLabel: UILabel = { + let label = UILabel() + label.text = TextLiteral.Home.price + label.font = EATSSUDesignFontFamily.Pretendard.medium.font(size: 14) + label.textAlignment = .center + return label + }() - private let ratingLabel = UILabel().then { - $0.text = TextLiteral.Home.rating - $0.font = .body2 - $0.textAlignment = .center - } + private let ratingLabel: UILabel = { + let label = UILabel() + label.text = TextLiteral.Home.rating + label.font = EATSSUDesignFontFamily.Pretendard.medium.font(size: 14) + label.textAlignment = .center + return label + }() - private let lineView = UIView().then { - $0.backgroundColor = .gray200 - } + lazy var infoTableStackView: UIStackView = { + let stackView = UIStackView(arrangedSubviews: [nameLabel, priceLabel, ratingLabel]) + stackView.axis = .horizontal + stackView.alignment = .center + stackView.spacing = 24 + return stackView + }() - lazy var infoTableStackView = UIStackView().then { - $0.addArrangedSubviews([nameLabel, - priceLabel, - ratingLabel]) - $0.axis = .horizontal - $0.alignment = .center - $0.spacing = 24 - } + private let lineView: UIView = { + let view = UIView() + view.backgroundColor = .gray200 + return view + }() // MARK: - Functions override func configureUI() { super.configureUI() - contentView.addSubviews(infoTableStackView, - lineView) + contentView.addSubviews(infoTableStackView, lineView) } override func setLayout() { @@ -57,15 +67,19 @@ class RestaurantTableViewMenuTitleCell: BaseTableViewCell { $0.top.equalToSuperview().offset(18) $0.horizontalEdges.equalToSuperview().inset(12) } + nameLabel.snp.makeConstraints { $0.width.equalTo(210).priority(.high) } + priceLabel.snp.makeConstraints { $0.width.equalTo(47).priority(.high) } + ratingLabel.snp.makeConstraints { $0.width.equalTo(25).priority(.high) } + lineView.snp.makeConstraints { $0.top.equalTo(infoTableStackView.snp.bottom).offset(11) $0.horizontalEdges.equalToSuperview().inset(8) diff --git a/EATSSU/App/Sources/Presentation/Home/ViewController/CustomTimeTabController.swift b/EATSSU/App/Sources/Presentation/Home/ViewController/CustomTimeTabController.swift index ac5cdf5f..7c128dbe 100644 --- a/EATSSU/App/Sources/Presentation/Home/ViewController/CustomTimeTabController.swift +++ b/EATSSU/App/Sources/Presentation/Home/ViewController/CustomTimeTabController.swift @@ -7,10 +7,10 @@ import UIKit -import EATSSUDesign - import SnapKit +import EATSSUDesign + final class CustomTimeTabController: BaseViewController { // MARK: - Properties @@ -21,6 +21,7 @@ final class CustomTimeTabController: BaseViewController { setPage(index: selectedIndex, direction: selectedIndex > oldValue ? .forward : .reverse) } } + var todayDate: Date = .init() private var isProgrammaticScroll = false @@ -46,6 +47,12 @@ final class CustomTimeTabController: BaseViewController { super.viewDidLoad() view.backgroundColor = EATSSUDesignAsset.Color.GrayScale.gray100.color } + + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + + dateFetchData(for: todayDate) + } override func configureUI() { view.backgroundColor = EATSSUDesignAsset.Color.GrayScale.gray100.color @@ -94,7 +101,7 @@ final class CustomTimeTabController: BaseViewController { tabContainerView.snp.makeConstraints { $0.top.leading.trailing.equalToSuperview() - $0.height.equalTo(45) + $0.height.equalTo(52) } tabStackView.snp.makeConstraints { @@ -110,6 +117,13 @@ final class CustomTimeTabController: BaseViewController { setupPageViewController() } + + func dateFetchData(for date: Date) { + morningVC.fetchData(date: date, time: "MORNING") + lunchVC.fetchData(date: date, time: "LUNCH") + dinnerVC.fetchData(date: date, time: "DINNER") + + } private func setupPageViewController() { addChild(pageViewController) @@ -179,6 +193,7 @@ final class CustomTimeTabController: BaseViewController { // MARK: - External API func updateDate(to date: Date) { + todayDate = date morningVC.fetchData(date: date, time: "MORNING") lunchVC.fetchData(date: date, time: "LUNCH") dinnerVC.fetchData(date: date, time: "DINNER") diff --git a/EATSSU/App/Sources/Presentation/Home/ViewController/HomeRestaurantViewController.swift b/EATSSU/App/Sources/Presentation/Home/ViewController/HomeRestaurantViewController.swift index 25a47a39..88082950 100644 --- a/EATSSU/App/Sources/Presentation/Home/ViewController/HomeRestaurantViewController.swift +++ b/EATSSU/App/Sources/Presentation/Home/ViewController/HomeRestaurantViewController.swift @@ -3,18 +3,20 @@ // EatSSU-iOS // // Created by 최지우 on 2023/08/08. -// import UIKit import Moya import SnapKit -import Then +import EATSSUDesign + +// 메뉴 리뷰 정보를 전달하는 델리게이트 프로토콜 protocol ReviewMenuTypeInfoDelegate: AnyObject { func didDelegateReviewMenuTypeInfo(for menuTypeData: ReviewMenuTypeInfo) } +// 식당 정보 버튼 탭 이벤트를 처리하는 델리게이트 프로토콜 protocol RestaurantInfoDelegate: AnyObject { func didTappedRestaurantInfo(restaurantName: String) } @@ -22,40 +24,60 @@ protocol RestaurantInfoDelegate: AnyObject { final class HomeRestaurantViewController: BaseViewController { // MARK: - Properties + // 메뉴 타이틀 셀의 개수 (섹션마다 1개 고정) private let restaurantTableViewMenuTitleCellCount = 1 + + // 테이블뷰 섹션 헤더의 높이 private let headerHeight: CGFloat = 48 + // 식당 정보 탭 시 델리게이트 weak var infoDelegate: RestaurantInfoDelegate? + + // 리뷰 작성 뷰로 데이터 전달할 델리게이트 var delegate: ReviewMenuTypeInfoDelegate? + + // 고정 메뉴 더미 데이터 (주말/방학 대비용) private let fixedDummy = FixedMenuInfoData.Dummy() + + // 섹션 헤더에 들어갈 식당명 문자열 배열 private let sectionHeaderRestaurant = [TextLiteral.dormitoryRestaurant, TextLiteral.dodamRestaurant, TextLiteral.studentRestaurant, TextLiteral.snackCorner] + + // 버튼에 표시되는 타이틀을 백엔드 식당 이름으로 매핑 let restaurantButtonTitleToName = [TextLiteral.dormitoryRestaurant: "DORMITORY", TextLiteral.dodamRestaurant: "DODAM", TextLiteral.studentRestaurant: "HAKSIK", TextLiteral.snackCorner: "SNACK_CORNER"] + + // 현재 보고 있는 식당 (섹션 reload 시 사용) var currentRestaurant = "" + + // 현재 요일이 주말인지 여부 판단 var isWeekend = false + + // 셀 선택 가능 여부 (가격 유무에 따라 다름) var isSelectable = false + // 변경 메뉴 데이터 (식당명: 메뉴 배열) var changeMenuTableViewData: [String: [ChangeMenuTableResponse]] = [:] { didSet { - // 빈 name을 가지지 않은 ChangeMenuTableResponse만 필터링 + // 메뉴 이름이 빈 값이 아닌 데이터만 필터링 changeMenuTableViewData = changeMenuTableViewData.mapValues { menuTableResponses in menuTableResponses.filter { response in !(response.briefMenus.first?.name.isEmpty ?? true) } } - // 필터링된 데이터로 테이블 뷰 섹션을 새로고침 + // 현재 섹션만 reload if let sectionIndex = getSectionIndex(for: currentRestaurant) { restaurantView.restaurantTableView.reloadSections([sectionIndex], with: .automatic) } } } + // 고정 메뉴 데이터 (간식코너) var fixMenuTableViewData: [String: [Menus]] = [:] { didSet { if let sectionIndex = getSectionIndex(for: currentRestaurant) { @@ -64,10 +86,12 @@ final class HomeRestaurantViewController: BaseViewController { } } - let menuProvider = MoyaProvider() + // 메뉴 API 요청을 위한 Moya Provider + let menuProvider = MoyaProvider(plugins: [ESMoyaLoggingPlugin()]) // MARK: - UI Components + // 뷰 전반을 구성하는 restaurantView let restaurantView = HomeRestaurantView() // MARK: - Life Cycles @@ -75,36 +99,41 @@ final class HomeRestaurantViewController: BaseViewController { override func viewDidLoad() { super.viewDidLoad() - setDelegate() - setTableView() + setDelegate() // 테이블뷰 델리게이트 연결 + setTableView() // 테이블뷰 셀 등록 } // MARK: - Functions + // 전체 UI 구성 override func configureUI() { view.addSubviews(restaurantView) } + // SnapKit을 이용한 레이아웃 설정 override func setLayout() { restaurantView.snp.makeConstraints { $0.edges.equalToSuperview() } } + // 테이블뷰 delegate/dataSource 연결 func setDelegate() { restaurantView.restaurantTableView.dataSource = self restaurantView.restaurantTableView.delegate = self } + // 테이블뷰 셀 및 헤더 등록 func setTableView() { - restaurantView.restaurantTableView.register(RestaurantTableViewMenuTitleCell.self, - forCellReuseIdentifier: RestaurantTableViewMenuTitleCell.identifier) - restaurantView.restaurantTableView.register(RestaurantTableViewMenuCell.self, - forCellReuseIdentifier: RestaurantTableViewMenuCell.identifier) restaurantView.restaurantTableView.register(RestaurantTableViewHeader.self, - forHeaderFooterViewReuseIdentifier: RestaurantTableViewHeader.identifier) + forHeaderFooterViewReuseIdentifier: RestaurantTableViewHeader.identifier) + restaurantView.restaurantTableView.register(RestaurantMenuGroupCell.self, + forCellReuseIdentifier: RestaurantMenuGroupCell.identifier) + restaurantView.restaurantTableView.rowHeight = UITableView.automaticDimension + restaurantView.restaurantTableView.estimatedRowHeight = 100 } + // 식당 이름을 통해 섹션 index 반환 func getSectionIndex(for restaurant: String) -> Int? { let restaurantRawValue = [Restaurant.dormitoryRestaurant.identifier, Restaurant.dodamRestaurant.identifier, @@ -113,6 +142,7 @@ final class HomeRestaurantViewController: BaseViewController { return restaurantRawValue.firstIndex(of: restaurant) } + // 섹션 인덱스로 식당 이름 반환 func getSectionKey(for section: Int) -> String { let restaurantRawValue = [Restaurant.dormitoryRestaurant.identifier, Restaurant.dodamRestaurant.identifier, @@ -121,25 +151,32 @@ final class HomeRestaurantViewController: BaseViewController { return restaurantRawValue[section] } + // 날짜와 시간에 따라 메뉴 데이터 fetch func fetchData(date: Date, time: String) { let formatDate = changeDateFormat(date: date) + + // 변경 메뉴 요청 (기숙사/도담/학생식당) getChageMenuData(date: formatDate, restaurant: Restaurant.dormitoryRestaurant.identifier, time: time) {} getChageMenuData(date: formatDate, restaurant: Restaurant.dodamRestaurant.identifier, time: time) {} getChageMenuData(date: formatDate, restaurant: Restaurant.studentRestaurant.identifier, time: time) {} let weekday = Weekday.from(date: date) - isWeekend = weekday.isWeekend + isWeekend = weekday.isWeekend // 주말 여부 판단 if time == TextLiteral.lunchRawValue { + // 학기 중 평일 점심인 경우에만 간식코너 고정 메뉴 요청 if !FirebaseRemoteConfig.shared.isVacationPeriod, !weekday.isWeekend { + isSelectable = true getFixMenuData(restaurant: TextLiteral.snackCornerRawValue) {} } else { + // 방학/주말에는 더미 고정 메뉴 설정 currentRestaurant = Restaurant.snackCorner.identifier - fixMenuTableViewData[Restaurant.snackCorner.identifier] = [Menus(menuId: 0, name: "", price: nil, rating: nil)] + fixMenuTableViewData[Restaurant.snackCorner.identifier] = [] } } } + // 날짜를 yyyyMMdd 포맷 문자열로 변환 func changeDateFormat(date: Date) -> String { let dateFormatter = DateFormatter() dateFormatter.dateFormat = "yyyyMMdd" @@ -150,64 +187,58 @@ final class HomeRestaurantViewController: BaseViewController { // MARK: - UITableViewDataSource extension HomeRestaurantViewController: UITableViewDataSource { + // 섹션 개수 설정 (기숙사, 도담, 학생, 간식) func numberOfSections(in _: UITableView) -> Int { sectionHeaderRestaurant.count } + // 각 섹션마다 보여줄 셀 개수 계산 func tableView(_: UITableView, numberOfRowsInSection section: Int) -> Int { - let sectionKey = getSectionKey(for: section) - - if [0, 1, 2].contains(section) { - return (changeMenuTableViewData[sectionKey]?.count ?? 0) + restaurantTableViewMenuTitleCellCount - } else if [3, 4, 5].contains(section) { - return (fixMenuTableViewData[sectionKey]?.count ?? 0) + restaurantTableViewMenuTitleCellCount - } else { - return 0 - } + return 1 } + + // 셀 구성 func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { - /// Menu Title Cell - if indexPath.row == 0 { - let cell = tableView.dequeueReusableCell(withIdentifier: RestaurantTableViewMenuTitleCell.identifier, for: indexPath) - cell.selectionStyle = .none - return cell + let cell = tableView.dequeueReusableCell(withIdentifier: RestaurantMenuGroupCell.identifier, for: indexPath) as! RestaurantMenuGroupCell + let sectionKey = getSectionKey(for: indexPath.section) + + let menuList: [MenuTypeInfo] + if indexPath.section == 3 { + menuList = fixMenuTableViewData[sectionKey]?.map { .fix($0) } ?? [] + } else { + menuList = changeMenuTableViewData[sectionKey]?.map { .change($0) } ?? [] } - /// Menu Cell - else { - let cell = tableView.dequeueReusableCell(withIdentifier: RestaurantTableViewMenuCell.identifier, for: indexPath) as! RestaurantTableViewMenuCell + cell.configure(with: menuList, at: indexPath) { [weak self] indexPath, menuIndex in + self?.handleMenuTap(section: indexPath.section, menuIndex: menuIndex) + } + return cell + } - // MARK: 섹션지정 + private func handleMenuTap(section: Int, menuIndex: Int) { + let restaurant = getSectionKey(for: section) + var reviewMenuTypeInfo = ReviewMenuTypeInfo(menuType: "", menuID: 0) - if indexPath.section == 0 { - if let data = changeMenuTableViewData[TextLiteral.dormitoryRawValue]?[indexPath.row - restaurantTableViewMenuTitleCellCount] { - cell.model = .change(data) - } - } else if indexPath.section == 1 { - if let data = changeMenuTableViewData[TextLiteral.dodamRawValue]?[indexPath.row - restaurantTableViewMenuTitleCellCount] { - cell.model = .change(data) - } - } else if indexPath.section == 2 { - if let data = changeMenuTableViewData[TextLiteral.studentRestaurantRawValue]?[indexPath.row - restaurantTableViewMenuTitleCellCount] { - cell.model = .change(data) - } - } else if indexPath.section == 3 { - if let data = fixMenuTableViewData[TextLiteral.snackCornerRawValue]?[indexPath.row - restaurantTableViewMenuTitleCellCount] { - if data.price != nil { - isSelectable = true - cell.selectionStyle = .default - } else { - isSelectable = false - cell.selectionStyle = .none - } - cell.model = .fix(data) - } + if [0, 1, 2].contains(section) { + reviewMenuTypeInfo.menuType = "VARIABLE" + reviewMenuTypeInfo.menuID = changeMenuTableViewData[restaurant]?[menuIndex].mealId ?? 100 + if let list = changeMenuTableViewData[restaurant]?[menuIndex].briefMenus { + reviewMenuTypeInfo.changeMenuIDList = list.compactMap(\.menuId) } - return cell + } else if section == 3 { + if !isSelectable { return } + reviewMenuTypeInfo.menuType = "FIXED" + reviewMenuTypeInfo.menuID = fixMenuTableViewData[restaurant]?[menuIndex].menuId ?? 100 } + + let reviewViewController = ReviewViewController() + delegate = reviewViewController + navigationController?.pushViewController(reviewViewController, animated: true) + delegate?.didDelegateReviewMenuTypeInfo(for: reviewMenuTypeInfo) } + // 섹션 헤더 뷰 설정 func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { guard let restaurantTableViewHeader = tableView.dequeueReusableHeaderFooterView(withIdentifier: RestaurantTableViewHeader.identifier) as? RestaurantTableViewHeader else { return nil @@ -216,13 +247,14 @@ extension HomeRestaurantViewController: UITableViewDataSource { let restaurantName = sectionHeaderRestaurant[section] restaurantTableViewHeader.titleLabel.text = restaurantName + // 위치 정보도 함께 표시 if let restaurantInfo = RestaurantInfoData.restaurantInfoData.first(where: { $0.name == restaurantName }) { var titleContainer = AttributeContainer() - titleContainer.font = .caption3 + titleContainer.font = EATSSUDesignFontFamily.Pretendard.medium.font(size: 10) restaurantTableViewHeader.infoButton.configuration?.attributedTitle = AttributedString(restaurantInfo.location, attributes: titleContainer) } - // Action for infoButton + // infoButton 클릭 시 식당 정보 화면 modal present restaurantTableViewHeader.infoButton.addAction(UIAction { [weak self] _ in let restaurantInfoViewController = RestaurantInfoViewController() restaurantInfoViewController.modalPresentationStyle = .pageSheet @@ -242,28 +274,33 @@ extension HomeRestaurantViewController: UITableViewDataSource { // MARK: - UITableViewDelegate extension HomeRestaurantViewController: UITableViewDelegate { + // 헤더 높이 설정 func tableView(_: UITableView, heightForHeaderInSection _: Int) -> CGFloat { headerHeight } + // 셀 선택 시 리뷰 작성 화면으로 이동 func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { tableView.deselectRow(at: indexPath, animated: true) + // 타이틀 셀 선택 시 무시 if indexPath.row == 0 { return } let restaurant = getSectionKey(for: indexPath.section) - /// bind Data var reviewMenuTypeInfo = ReviewMenuTypeInfo(menuType: "", menuID: 0) + // 변경 메뉴인 경우 데이터 구성 if [0, 1, 2].contains(indexPath.section) { reviewMenuTypeInfo.menuType = "VARIABLE" reviewMenuTypeInfo.menuID = changeMenuTableViewData[restaurant]?[indexPath.row - restaurantTableViewMenuTitleCellCount].mealId ?? 100 if let list = changeMenuTableViewData[restaurant]?[indexPath.row - restaurantTableViewMenuTitleCellCount].briefMenus { - reviewMenuTypeInfo.changeMenuIDList = list.compactMap(\.menuId) + reviewMenuTypeInfo.changeMenuIDList = list.compactMap(\ .menuId) } - } else if [3, 4, 5].contains(indexPath.section) { + } + // 고정 메뉴인 경우 + else if [3, 4, 5].contains(indexPath.section) { if !isSelectable { return } @@ -271,11 +308,10 @@ extension HomeRestaurantViewController: UITableViewDelegate { reviewMenuTypeInfo.menuID = fixMenuTableViewData[restaurant]?[indexPath.row - restaurantTableViewMenuTitleCellCount].menuId ?? 100 } - /// push VC + // 리뷰 작성 화면으로 Push let reviewViewController = ReviewViewController() delegate = reviewViewController navigationController?.pushViewController(reviewViewController, animated: true) - delegate?.didDelegateReviewMenuTypeInfo(for: reviewMenuTypeInfo) } } @@ -283,6 +319,7 @@ extension HomeRestaurantViewController: UITableViewDelegate { // MARK: - Network extension HomeRestaurantViewController { + // 변경 메뉴 요청 API 호출 func getChageMenuData(date: String, restaurant: String, time: String, completion: @escaping () -> Void) { menuProvider.request(.getChangeMenuTableResponse(date: date, restaurant: restaurant, time: time)) { response in switch response { @@ -301,6 +338,7 @@ extension HomeRestaurantViewController { } } + // 고정 메뉴 요청 API 호출 func getFixMenuData(restaurant: String, completion: @escaping () -> Void) { menuProvider.request(.getFixedMenuTableResponse(restaurant: restaurant)) { response in switch response { @@ -308,10 +346,10 @@ extension HomeRestaurantViewController { do { self.currentRestaurant = restaurant let responseDetailDto = try responseData.map(BaseResponse.self) - guard let data = responseDetailDto.result else { return } - + guard let responseResult = responseDetailDto.result else { return } + var allMenuInformations = [Menus]() - for categoryMenu in data.categoryMenuListCollection { + for categoryMenu in responseResult.categoryMenuListCollection { allMenuInformations += categoryMenu.menus } self.fixMenuTableViewData[restaurant] = allMenuInformations diff --git a/EATSSU/App/Sources/Presentation/Home/ViewController/HomeTimeTabmanController.swift b/EATSSU/App/Sources/Presentation/Home/ViewController/HomeTimeTabmanController.swift index 7c6cf8c9..8cce37e9 100644 --- a/EATSSU/App/Sources/Presentation/Home/ViewController/HomeTimeTabmanController.swift +++ b/EATSSU/App/Sources/Presentation/Home/ViewController/HomeTimeTabmanController.swift @@ -7,12 +7,12 @@ import UIKit -import EATSSUDesign - import Pageboy import SnapKit import Tabman +import EATSSUDesign + final class HomeTimeTabmanController: TabmanViewController { // MARK: - Properties diff --git a/EATSSU/App/Sources/Presentation/Home/ViewController/HomeViewController.swift b/EATSSU/App/Sources/Presentation/Home/ViewController/HomeViewController.swift index 6634faba..a5340dd8 100644 --- a/EATSSU/App/Sources/Presentation/Home/ViewController/HomeViewController.swift +++ b/EATSSU/App/Sources/Presentation/Home/ViewController/HomeViewController.swift @@ -7,12 +7,12 @@ import UIKit -import EATSSUDesign - import FirebaseAnalytics import Moya import SnapKit +import EATSSUDesign + final class HomeViewController: BaseViewController { // MARK: - Properties @@ -24,7 +24,7 @@ final class HomeViewController: BaseViewController { } } - private let tabmanController = HomeTimeTabmanController() + private let tabmanController = CustomTimeTabController() private let homeCalendarView = HomeCalendarView() // MARK: - Life Cycle diff --git a/EATSSU/App/Sources/Presentation/MyPage/View/CreatorsView.swift b/EATSSU/App/Sources/Presentation/MyPage/View/CreatorsView.swift index 3614ae19..2fbb7828 100644 --- a/EATSSU/App/Sources/Presentation/MyPage/View/CreatorsView.swift +++ b/EATSSU/App/Sources/Presentation/MyPage/View/CreatorsView.swift @@ -7,10 +7,10 @@ import UIKit -import EATSSUDesign - import SnapKit +import EATSSUDesign + /// "만든 사람들"을 담고 있는 View 입니다. class CreatorsView: BaseUIView { // MARK: - UI Components diff --git a/EATSSU/App/Sources/Presentation/MyPage/View/MyPageView/Cell/MyPageTableDefaultCell.swift b/EATSSU/App/Sources/Presentation/MyPage/View/MyPageView/Cell/MyPageTableDefaultCell.swift index c705d798..e291bbe8 100644 --- a/EATSSU/App/Sources/Presentation/MyPage/View/MyPageView/Cell/MyPageTableDefaultCell.swift +++ b/EATSSU/App/Sources/Presentation/MyPage/View/MyPageView/Cell/MyPageTableDefaultCell.swift @@ -7,10 +7,10 @@ import UIKit -import EATSSUDesign - import SnapKit +import EATSSUDesign + final class MyPageTableDefaultCell: UITableViewCell { // MARK: - Properties @@ -18,15 +18,19 @@ final class MyPageTableDefaultCell: UITableViewCell { // MARK: - UI Components - let serviceLabel = UILabel().then { - $0.font = EATSSUDesignFontFamily.Pretendard.medium.font(size: 16) - $0.textColor = .black - } + let serviceLabel: UILabel = { + let label = UILabel() + label.font = EATSSUDesignFontFamily.Pretendard.medium.font(size: 16) + label.textColor = .black + return label + }() - let rigthChevronImage = UIImageView().then { imageView in + let rigthChevronImage: UIImageView = { + let imageView = UIImageView() imageView.image = UIImage(systemName: "chevron.right") imageView.tintColor = EATSSUDesignAsset.Color.GrayScale.gray300.color - } + return imageView + }() // MARK: - Initializer diff --git a/EATSSU/App/Sources/Presentation/MyPage/View/MyPageView/Cell/NotificationSettingTableViewCell.swift b/EATSSU/App/Sources/Presentation/MyPage/View/MyPageView/Cell/NotificationSettingTableViewCell.swift index 61466a11..fe11be9e 100644 --- a/EATSSU/App/Sources/Presentation/MyPage/View/MyPageView/Cell/NotificationSettingTableViewCell.swift +++ b/EATSSU/App/Sources/Presentation/MyPage/View/MyPageView/Cell/NotificationSettingTableViewCell.swift @@ -7,10 +7,10 @@ import UIKit -import EATSSUDesign - import SnapKit +import EATSSUDesign + class NotificationSettingTableViewCell: UITableViewCell { // MARK: - Properties diff --git a/EATSSU/App/Sources/Presentation/MyPage/View/MyPageView/MyPageView.swift b/EATSSU/App/Sources/Presentation/MyPage/View/MyPageView/MyPageView.swift index 74a6bce9..9b9db2db 100644 --- a/EATSSU/App/Sources/Presentation/MyPage/View/MyPageView/MyPageView.swift +++ b/EATSSU/App/Sources/Presentation/MyPage/View/MyPageView/MyPageView.swift @@ -7,10 +7,9 @@ import UIKit -import EATSSUDesign - import SnapKit -import Then + +import EATSSUDesign final class MyPageView: BaseUIView { // MARK: - UI Components @@ -22,67 +21,82 @@ final class MyPageView: BaseUIView { private let contentView = UIView() // 사용자 이미지 - var userImage = UIImageView().then { - $0.image = EATSSUDesignAsset.Images.profile.image - } + var userImage: UIImageView = { + let imageView = UIImageView() + imageView.image = EATSSUDesignAsset.Images.profile.image + return imageView + }() // 닉네임이 들어간 닉네임 변경 버튼 - var userNicknameButton = UIButton().then { - $0.addTitleAttribute( + var userNicknameButton: UIButton = { + let button = UIButton() + button.addTitleAttribute( title: "다시 시도해주세요", titleColor: .black, fontName: EATSSUDesignFontFamily.Pretendard.regular.font(size: 16) ) - } + return button + }() // "연결된 계정" 레이블 - let accountTitleLabel = UILabel().then { - $0.text = TextLiteral.MyPage.linkedAccount - $0.font = EATSSUDesignFontFamily.Pretendard.regular.font(size: 14) - } + let accountTitleLabel: UILabel = { + let label = UILabel() + label.text = TextLiteral.MyPage.linkedAccount + label.font = EATSSUDesignFontFamily.Pretendard.regular.font(size: 14) + return label + }() // 서버에서 계정 정보를 가져오기 전 기본값 - var accountTypeLabel = UILabel().then { - $0.text = "없음" - $0.font = EATSSUDesignFontFamily.Pretendard.regular.font(size: 14) - $0.font = .bold(size: 14) - } + var accountTypeLabel: UILabel = { + let label = UILabel() + label.text = "없음" + label.font = .bold(size: 14) + return label + }() // 소셜 로그인 공급업체 아이콘 var accountTypeImage = UIImageView() - lazy var totalAccountStackView = UIStackView( - arrangedSubviews: [accountTitleLabel, accountStackView]).then { - $0.alignment = .bottom - $0.axis = .horizontal - $0.spacing = 20 - } + lazy var accountStackView: UIStackView = { + let stack = UIStackView(arrangedSubviews: [accountTypeLabel, accountTypeImage]) + stack.axis = .horizontal + stack.alignment = .bottom + stack.spacing = 5 + return stack + }() - lazy var accountStackView = UIStackView( - arrangedSubviews: [accountTypeLabel, accountTypeImage]).then { - $0.alignment = .bottom - $0.axis = .horizontal - $0.spacing = 5 - } + lazy var totalAccountStackView: UIStackView = { + let stack = UIStackView(arrangedSubviews: [accountTitleLabel, accountStackView]) + stack.axis = .horizontal + stack.alignment = .bottom + stack.spacing = 20 + return stack + }() - let myPageTableView = UITableView().then { - $0.separatorStyle = .none - $0.isScrollEnabled = false - } + let myPageTableView: UITableView = { + let tableView = UITableView() + tableView.separatorStyle = .none + tableView.isScrollEnabled = false + return tableView + }() // "앱 버전" 레이블 - private let appVersionStringLabel = UILabel().then { label in + private let appVersionStringLabel: UILabel = { + let label = UILabel() label.text = TextLiteral.MyPage.appVersion label.font = EATSSUDesignFontFamily.Pretendard.regular.font(size: 12) label.textColor = EATSSUDesignAsset.Color.GrayScale.gray400.color - } + return label + }() // 현재 배포된 앱의 버전 - private let appVersionLabel = UILabel().then { label in + private let appVersionLabel: UILabel = { + let label = UILabel() label.text = MyPageRightItemData.version label.font = EATSSUDesignFontFamily.Pretendard.regular.font(size: 12) label.textColor = EATSSUDesignAsset.Color.GrayScale.gray400.color - } + return label + }() /// "탈퇴하기" 레이블과 탈퇴하기 아이콘 let userWithdrawButton: UIButton = { diff --git a/EATSSU/App/Sources/Presentation/MyPage/View/MyReviewView.swift b/EATSSU/App/Sources/Presentation/MyPage/View/MyReviewView.swift index b1e36e47..dba362dc 100644 --- a/EATSSU/App/Sources/Presentation/MyPage/View/MyReviewView.swift +++ b/EATSSU/App/Sources/Presentation/MyPage/View/MyReviewView.swift @@ -8,7 +8,6 @@ import UIKit import SnapKit -import Then final class MyReviewView: BaseUIView { // MARK: - UI Components @@ -29,10 +28,8 @@ final class MyReviewView: BaseUIView { override func configureUI() { addSubview(myReviewTableView) - myReviewTableView.do { - $0.separatorStyle = .none - $0.showsVerticalScrollIndicator = false - } + myReviewTableView.separatorStyle = .none + myReviewTableView.showsVerticalScrollIndicator = false } override func setLayout() { diff --git a/EATSSU/App/Sources/Presentation/MyPage/View/UserWithdrawView.swift b/EATSSU/App/Sources/Presentation/MyPage/View/UserWithdrawView.swift index 345e8da2..139d6133 100644 --- a/EATSSU/App/Sources/Presentation/MyPage/View/UserWithdrawView.swift +++ b/EATSSU/App/Sources/Presentation/MyPage/View/UserWithdrawView.swift @@ -8,7 +8,6 @@ import UIKit import SnapKit -import Then enum ValidationLabelState { case unCorrected @@ -86,44 +85,34 @@ final class UserWithdrawView: BaseUIView { } private func setProperties() { - nickNameLabel.do { - $0.text = TextLiteral.MyPage.confirmWithdrawal - $0.font = .bold(size: 16) - } - - subscription.do { - $0.text = TextLiteral.MyPage.withdrawalNotice - $0.numberOfLines = 2 - $0.font = .medium(size: 12) - $0.textColor = .gray700 - } - - inputNickNameTextField.do { - $0.font = .regular(size: 12) - $0.textColor = .black - $0.setRoundBorder() - $0.addLeftPadding() - $0.clearButtonMode = .whileEditing - } - - nickNameStateGuideLabel.do { - $0.text = TextLiteral.inputNickName - $0.textColor = .gray700 - $0.font = .medium(size: 10) - } - - nickNameInputStackView.do { - $0.axis = .vertical - $0.spacing = 8.0 - } - - completeSignOutButton.do { - $0.addTitleAttribute(title: TextLiteral.MyPage.withdraw, - titleColor: .white, - fontName: .bold(size: 18)) - $0.setRoundBorder(borderColor: .gray300, borderWidth: 0, cornerRadius: 10) - $0.isEnabled = false - } + nickNameLabel.text = TextLiteral.MyPage.confirmWithdrawal + nickNameLabel.font = .bold(size: 16) + + subscription.text = TextLiteral.MyPage.withdrawalNotice + subscription.numberOfLines = 2 + subscription.font = .medium(size: 12) + subscription.textColor = .gray700 + + inputNickNameTextField.font = .regular(size: 12) + inputNickNameTextField.textColor = .black + inputNickNameTextField.setRoundBorder() + inputNickNameTextField.addLeftPadding() + inputNickNameTextField.clearButtonMode = .whileEditing + + nickNameStateGuideLabel.text = TextLiteral.inputNickName + nickNameStateGuideLabel.textColor = .gray700 + nickNameStateGuideLabel.font = .medium(size: 10) + + nickNameInputStackView.axis = .vertical + nickNameInputStackView.spacing = 8.0 + + completeSignOutButton.addTitleAttribute( + title: TextLiteral.MyPage.withdraw, + titleColor: .white, + fontName: .bold(size: 18) + ) + completeSignOutButton.setRoundBorder(borderColor: .gray300, borderWidth: 0, cornerRadius: 10) + completeSignOutButton.isEnabled = false } private func setTextFieldDelegate() { @@ -136,19 +125,17 @@ final class UserWithdrawView: BaseUIView { nickNameStateGuideLabel.text = TextLiteral.MyPage.validInputMessage nickNameStateGuideLabel.textColor = .systemGreen completeSignOutButton.isEnabled = true + case .unCorrected: - nickNameStateGuideLabel.do { - $0.isHidden = false - $0.text = TextLiteral.MyPage.invalidNicknameMessage - $0.textColor = .primary - } + nickNameStateGuideLabel.isHidden = false + nickNameStateGuideLabel.text = TextLiteral.MyPage.invalidNicknameMessage + nickNameStateGuideLabel.textColor = .primary completeSignOutButton.isEnabled = false + case .pleaseEnter: - nickNameStateGuideLabel.do { - $0.isHidden = false - $0.text = TextLiteral.inputNickName - $0.textColor = .gray700 - } + nickNameStateGuideLabel.isHidden = false + nickNameStateGuideLabel.text = TextLiteral.inputNickName + nickNameStateGuideLabel.textColor = .gray700 completeSignOutButton.isEnabled = false } } diff --git a/EATSSU/App/Sources/Presentation/MyPage/ViewController/UserWithdrawViewController.swift b/EATSSU/App/Sources/Presentation/MyPage/ViewController/UserWithdrawViewController.swift index 480bbcb6..21840857 100644 --- a/EATSSU/App/Sources/Presentation/MyPage/ViewController/UserWithdrawViewController.swift +++ b/EATSSU/App/Sources/Presentation/MyPage/ViewController/UserWithdrawViewController.swift @@ -10,7 +10,6 @@ import UIKit import Moya import Realm import SnapKit -import Then final class UserWithdrawViewController: BaseViewController { // MARK: - Properties diff --git a/EATSSU/App/Sources/Presentation/Review/View/ChoiceMenuView/ChoiceMenuTableViewCell.swift b/EATSSU/App/Sources/Presentation/Review/View/ChoiceMenuView/ChoiceMenuTableViewCell.swift index 08250511..884913c3 100644 --- a/EATSSU/App/Sources/Presentation/Review/View/ChoiceMenuView/ChoiceMenuTableViewCell.swift +++ b/EATSSU/App/Sources/Presentation/Review/View/ChoiceMenuView/ChoiceMenuTableViewCell.swift @@ -7,10 +7,9 @@ import UIKit -import EATSSUDesign - import SnapKit -import Then + +import EATSSUDesign final class ChoiceMenuTableViewCell: UITableViewCell { // MARK: - Properties @@ -46,18 +45,16 @@ final class ChoiceMenuTableViewCell: UITableViewCell { // MARK: - Functions private func setUI() { - checkButton.do { - $0.addTarget(self, action: #selector(checkButtonIsTapped), for: .touchUpInside) - } + checkButton.addTarget(self, action: #selector(checkButtonIsTapped), for: .touchUpInside) - menuLabel.do { - $0.font = .body1 - $0.textColor = .black - $0.text = "고구마치즈돈까스" - } + menuLabel.font = EATSSUDesignFontFamily.Pretendard.medium.font(size: 16) + menuLabel.textColor = .black + menuLabel.text = "고구마치즈돈까스" - contentView.addSubviews(checkButton, - menuLabel) + contentView.addSubviews( + checkButton, + menuLabel + ) } private func setLayout() { diff --git a/EATSSU/App/Sources/Presentation/Review/View/RateReview/RateView.swift b/EATSSU/App/Sources/Presentation/Review/View/RateReview/RateView.swift index 65deeb48..011a7a02 100644 --- a/EATSSU/App/Sources/Presentation/Review/View/RateReview/RateView.swift +++ b/EATSSU/App/Sources/Presentation/Review/View/RateReview/RateView.swift @@ -7,10 +7,10 @@ import UIKit -import EATSSUDesign - import SnapKit +import EATSSUDesign + final class RateView: BaseUIView { // MARK: - Properties diff --git a/EATSSU/App/Sources/Presentation/Review/View/RerportView/ReportView.swift b/EATSSU/App/Sources/Presentation/Review/View/RerportView/ReportView.swift index a186987f..7d992b98 100644 --- a/EATSSU/App/Sources/Presentation/Review/View/RerportView/ReportView.swift +++ b/EATSSU/App/Sources/Presentation/Review/View/RerportView/ReportView.swift @@ -7,10 +7,10 @@ import UIKit -import EATSSUDesign - import SnapKit +import EATSSUDesign + final class ReportView: BaseUIView { // MARK: - UI Components diff --git a/EATSSU/App/Sources/Presentation/Review/View/SeeReview/RateNumberView.swift b/EATSSU/App/Sources/Presentation/Review/View/SeeReview/RateNumberView.swift index 7e334061..f8f151fe 100644 --- a/EATSSU/App/Sources/Presentation/Review/View/SeeReview/RateNumberView.swift +++ b/EATSSU/App/Sources/Presentation/Review/View/SeeReview/RateNumberView.swift @@ -7,10 +7,9 @@ import UIKit -import EATSSUDesign - import SnapKit -import Then + +import EATSSUDesign final class RateNumberView: BaseUIView { // MARK: - UI Components @@ -39,21 +38,16 @@ final class RateNumberView: BaseUIView { override func configureUI() { addSubviews(rateNumberStackView) - starImageView.do { - $0.image = EATSSUDesignAsset.Images.icStarYellow.image - } - rateNumberLabel.do { - $0.text = "5" - $0.font = .body2 - $0.textColor = EATSSUDesignAsset.Color.Main.primary.color - } + starImageView.image = EATSSUDesignAsset.Images.icStarYellow.image - rateNumberStackView.do { - $0.axis = .horizontal - $0.spacing = 3 - $0.alignment = .center - } + rateNumberLabel.text = "5" + rateNumberLabel.font = EATSSUDesignFontFamily.Pretendard.medium.font(size: 14) + rateNumberLabel.textColor = EATSSUDesignAsset.Color.Main.primary.color + + rateNumberStackView.axis = .horizontal + rateNumberStackView.spacing = 3 + rateNumberStackView.alignment = .center } override func setLayout() { diff --git a/EATSSU/App/Sources/Presentation/Review/View/SeeReview/ReviewRateViewCell.swift b/EATSSU/App/Sources/Presentation/Review/View/SeeReview/ReviewRateViewCell.swift index 0b00e092..96e6fe18 100644 --- a/EATSSU/App/Sources/Presentation/Review/View/SeeReview/ReviewRateViewCell.swift +++ b/EATSSU/App/Sources/Presentation/Review/View/SeeReview/ReviewRateViewCell.swift @@ -14,10 +14,10 @@ import UIKit -import EATSSUDesign - import SnapKit +import EATSSUDesign + final class ReviewRateViewCell: UITableViewCell { // MARK: - Properties diff --git a/EATSSU/App/Sources/Presentation/Review/View/SeeReview/ReviewTableCell.swift b/EATSSU/App/Sources/Presentation/Review/View/SeeReview/ReviewTableCell.swift index 56ac5912..20fb8c30 100644 --- a/EATSSU/App/Sources/Presentation/Review/View/SeeReview/ReviewTableCell.swift +++ b/EATSSU/App/Sources/Presentation/Review/View/SeeReview/ReviewTableCell.swift @@ -7,10 +7,10 @@ import UIKit -import EATSSUDesign - import SnapKit +import EATSSUDesign + final class ReviewTableCell: UITableViewCell { // MARK: - Properties diff --git a/EATSSU/App/Sources/Presentation/Review/ViewController/ChoiceMenuViewController.swift b/EATSSU/App/Sources/Presentation/Review/ViewController/ChoiceMenuViewController.swift index 47b186a6..dd962533 100644 --- a/EATSSU/App/Sources/Presentation/Review/ViewController/ChoiceMenuViewController.swift +++ b/EATSSU/App/Sources/Presentation/Review/ViewController/ChoiceMenuViewController.swift @@ -7,10 +7,9 @@ import UIKit -import EATSSUDesign - import SnapKit -import Then + +import EATSSUDesign final class ChoiceMenuViewController: BaseViewController { // MARK: - Properties @@ -52,30 +51,24 @@ final class ChoiceMenuViewController: BaseViewController { // MARK: - Functions override func configureUI() { - whichFoodLabel.do { - $0.text = "어떤 음식에 대한 리뷰인가요?" - $0.font = .subtitle1 - $0.textColor = .black - } + whichFoodLabel.text = "어떤 음식에 대한 리뷰인가요?" + whichFoodLabel.font = EATSSUDesignFontFamily.Pretendard.bold.font(size: 16) + whichFoodLabel.textColor = .black - enjoyLabel.do { - $0.text = "식사는 맛있게 하셨나요?" - $0.font = .body1 - $0.textColor = EATSSUDesignAsset.Color.GrayScale.gray600.color - } + enjoyLabel.text = "식사는 맛있게 하셨나요?" + enjoyLabel.font = EATSSUDesignFontFamily.Pretendard.medium.font(size: 16) + enjoyLabel.textColor = EATSSUDesignAsset.Color.GrayScale.gray600.color - choiceMenuTabelView.do { - $0.separatorStyle = .none - } + choiceMenuTabelView.separatorStyle = .none - nextButton.do { - $0.setTitle("다음 단계로", for: .normal) - } + nextButton.setTitle("다음 단계로", for: .normal) - view.addSubviews(enjoyLabel, - whichFoodLabel, - choiceMenuTabelView, - nextButton) + view.addSubviews( + enjoyLabel, + whichFoodLabel, + choiceMenuTabelView, + nextButton + ) } override func setLayout() { diff --git a/EATSSU/App/Sources/Presentation/Review/ViewController/FormerReportViewController.swift b/EATSSU/App/Sources/Presentation/Review/ViewController/FormerReportViewController.swift index 637b9468..91f70f9a 100644 --- a/EATSSU/App/Sources/Presentation/Review/ViewController/FormerReportViewController.swift +++ b/EATSSU/App/Sources/Presentation/Review/ViewController/FormerReportViewController.swift @@ -7,9 +7,10 @@ import UIKit -import Moya import SnapKit -import Then +import Moya + +import EATSSUDesign /// ReportViewController로 대체되었습니다. /// @@ -27,50 +28,29 @@ final class FormerReportViewController: BaseViewController { // MARK: - UI Components - private let alertDeclarationLabel = UILabel().then { - $0.text = "리뷰를 신고하는 이유를 선택해주세요." - $0.font = .bold(size: 16) - } - - private let report1Label = UILabel().then { - $0.text = "메뉴와 관련없는 내용" - } - - private let report2Label = UILabel().then { - $0.text = "음란성, 욕설 등 부적절한 내용" - } - - private let report3Label = UILabel().then { - $0.text = "부적절한 홍보 또는 광고" - } - - private let report4Label = UILabel().then { - $0.text = "리뷰 작성 취지에 맞지 않는 내용 (복사글 등)" - } - - private let report5Label = UILabel().then { - $0.text = "저작권 도용 의심 (사진 등)" - } + private let alertDeclarationLabel: UILabel = { + let label = UILabel() + label.text = "리뷰를 신고하는 이유를 선택해주세요." + label.font = .bold(size: 16) + return label + }() - private let report6Label = UILabel().then { - $0.text = "기타 (하단 내용 작성)" - } + private let report1Label = UILabel() + private let report2Label = UILabel() + private let report3Label = UILabel() + private let report4Label = UILabel() + private let report5Label = UILabel() + private let report6Label = UILabel() private var report1Button = UIButton() - private var report2Button = UIButton() - private var report3Button = UIButton() - private var report4Button = UIButton() - private var report5Button = UIButton() - private var report6Button = UIButton() lazy var report1StackView: UIStackView = { - let stackView = UIStackView(arrangedSubviews: [report1Button, - report1Label]) + let stackView = UIStackView(arrangedSubviews: [report1Button, report1Label]) stackView.axis = .horizontal stackView.spacing = 7 stackView.alignment = .center @@ -78,8 +58,7 @@ final class FormerReportViewController: BaseViewController { }() lazy var report2StackView: UIStackView = { - let stackView = UIStackView(arrangedSubviews: [report2Button, - report2Label]) + let stackView = UIStackView(arrangedSubviews: [report2Button, report2Label]) stackView.axis = .horizontal stackView.spacing = 7 stackView.alignment = .center @@ -87,8 +66,7 @@ final class FormerReportViewController: BaseViewController { }() lazy var report3StackView: UIStackView = { - let stackView = UIStackView(arrangedSubviews: [report3Button, - report3Label]) + let stackView = UIStackView(arrangedSubviews: [report3Button, report3Label]) stackView.axis = .horizontal stackView.spacing = 7 stackView.alignment = .center @@ -96,8 +74,7 @@ final class FormerReportViewController: BaseViewController { }() lazy var report4StackView: UIStackView = { - let stackView = UIStackView(arrangedSubviews: [report4Button, - report4Label]) + let stackView = UIStackView(arrangedSubviews: [report4Button, report4Label]) stackView.axis = .horizontal stackView.spacing = 7 stackView.alignment = .center @@ -105,8 +82,7 @@ final class FormerReportViewController: BaseViewController { }() lazy var report5StackView: UIStackView = { - let stackView = UIStackView(arrangedSubviews: [report5Button, - report5Label]) + let stackView = UIStackView(arrangedSubviews: [report5Button, report5Label]) stackView.axis = .horizontal stackView.spacing = 7 stackView.alignment = .center @@ -114,8 +90,7 @@ final class FormerReportViewController: BaseViewController { }() lazy var report6StackView: UIStackView = { - let stackView = UIStackView(arrangedSubviews: [report6Button, - report6Label]) + let stackView = UIStackView(arrangedSubviews: [report6Button, report6Label]) stackView.axis = .horizontal stackView.spacing = 7 stackView.alignment = .center @@ -123,12 +98,7 @@ final class FormerReportViewController: BaseViewController { }() lazy var reportStackView: UIStackView = { - let stackView = UIStackView(arrangedSubviews: [report1StackView, - report2StackView, - report3StackView, - report4StackView, - report5StackView, - report6StackView]) + let stackView = UIStackView(arrangedSubviews: [report1StackView, report2StackView, report3StackView, report4StackView, report5StackView, report6StackView]) stackView.axis = .vertical stackView.spacing = 16 stackView.alignment = .leading @@ -147,15 +117,20 @@ final class FormerReportViewController: BaseViewController { return textView }() - private let textLimitLabel = UILabel().then { - $0.text = "0 / 150" - $0.font = .medium(size: 12) - $0.textColor = .gray700 - } + private let textLimitLabel: UILabel = { + let label = UILabel() + label.text = "0 / 150" + label.font = .medium(size: 12) + label.textColor = .gray700 + return label + }() + + private let sendButton: MainButton = { + let button = MainButton() + button.title = "EAT SSU에게 보내기" + return button + }() - private let sendButton = MainButton().then { - $0.title = "EAT SSU에게 보내기" - } // MARK: - Life Cycles diff --git a/EATSSU/App/Sources/Presentation/Review/ViewController/ReportViewController.swift b/EATSSU/App/Sources/Presentation/Review/ViewController/ReportViewController.swift index b2f39447..f2120118 100644 --- a/EATSSU/App/Sources/Presentation/Review/ViewController/ReportViewController.swift +++ b/EATSSU/App/Sources/Presentation/Review/ViewController/ReportViewController.swift @@ -7,11 +7,11 @@ import UIKit -import EATSSUDesign - import Moya import SnapKit +import EATSSUDesign + final class ReportViewController: BaseViewController { // MARK: - Properties diff --git a/EATSSU/App/Sources/Presentation/Review/ViewController/SetRateViewController.swift b/EATSSU/App/Sources/Presentation/Review/ViewController/SetRateViewController.swift index 335cbf7a..91f11feb 100644 --- a/EATSSU/App/Sources/Presentation/Review/ViewController/SetRateViewController.swift +++ b/EATSSU/App/Sources/Presentation/Review/ViewController/SetRateViewController.swift @@ -7,11 +7,10 @@ import UIKit -import EATSSUDesign - -import Moya import SnapKit -import Then +import Moya + +import EATSSUDesign final class SetRateViewController: BaseViewController { // MARK: - Properties @@ -31,9 +30,6 @@ final class SetRateViewController: BaseViewController { private var reviewList: [(BeforeSelectedImageDTO, UIImage?)] = [] private var selectedIDList: [Int] = [] private var selectedList: [String] = [] - - /// [리뷰 수정하기]에 필요한 reviewID - /// 해당 값이 존재하지 않으면, 리뷰 작성하기 기능을 수행 중인 것이다 private var reviewId: Int? // MARK: - UI Components @@ -52,7 +48,6 @@ final class SetRateViewController: BaseViewController { private let scrollView: UIScrollView = { let scrollView = UIScrollView() scrollView.translatesAutoresizingMaskIntoConstraints = false - return scrollView }() @@ -94,17 +89,21 @@ final class SetRateViewController: BaseViewController { return label }() - lazy var tasteStackView = UIStackView().then { - $0.axis = .horizontal - $0.spacing = 16.adjusted - $0.alignment = .center - } + private lazy var tasteStackView: UIStackView = { + let stackView = UIStackView() + stackView.axis = .horizontal + stackView.spacing = 16.adjusted + stackView.alignment = .center + return stackView + }() - lazy var quantityStackView = UIStackView().then { - $0.axis = .horizontal - $0.spacing = 16.adjusted - $0.alignment = .center - } + private lazy var quantityStackView: UIStackView = { + let stackView = UIStackView() + stackView.axis = .horizontal + stackView.spacing = 16.adjusted + stackView.alignment = .center + return stackView + }() private let userReviewTextView: UITextView = { let textView = UITextView() @@ -113,58 +112,61 @@ final class SetRateViewController: BaseViewController { textView.backgroundColor = EATSSUDesignAsset.Color.GrayScale.gray100.color textView.layer.borderWidth = 1.adjusted textView.layer.borderColor = EATSSUDesignAsset.Color.GrayScale.gray300.color.cgColor - textView.textContainerInset = UIEdgeInsets(top: 16.0.adjusted, - left: 16.0.adjusted, - bottom: 16.0.adjusted, - right: 16.0.adjusted) + textView.textContainerInset = UIEdgeInsets(top: 16.0.adjusted, left: 16.0.adjusted, bottom: 16.0.adjusted, right: 16.0.adjusted) textView.text = "3글자 이상 작성해주세요!" textView.textColor = .gray500 return textView }() - private lazy var userReviewImageView = UIImageView().then { - $0.layer.cornerRadius = 10 // 원하는 둥근 모서리의 크기 - $0.clipsToBounds = true // 이 속성을 true로 설정해야 둥근 모서리가 보입니다. - + private lazy var userReviewImageView: UIImageView = { + let imageView = UIImageView() + imageView.layer.cornerRadius = 10 + imageView.clipsToBounds = true + imageView.isUserInteractionEnabled = true let tapGesture = UITapGestureRecognizer(target: self, action: #selector(didTappedimageView)) - $0.isUserInteractionEnabled = true // 사용자 상호작용을 가능하게 설정 - $0.addGestureRecognizer(tapGesture) - } + imageView.addGestureRecognizer(tapGesture) + return imageView + }() - private lazy var imageContainer = UIView().then { - $0.addSubview(selectImageButton) - $0.addSubview(imageCountLabel) - } + private lazy var imageContainer: UIView = { + let view = UIView() + view.addSubview(selectImageButton) + view.addSubview(imageCountLabel) + return view + }() - private lazy var selectImageButton = UIButton().then { + private lazy var selectImageButton: UIButton = { + let button = UIButton() var config = UIButton.Configuration.plain() config.image = EATSSUDesignAsset.Images.addImageButton.image config.contentInsets = NSDirectionalEdgeInsets(top: -5, leading: 0, bottom: 5, trailing: 0) + button.configuration = config + button.addTarget(self, action: #selector(didSelectedImage), for: .touchUpInside) + button.layer.borderWidth = 1 + button.layer.borderColor = EATSSUDesignAsset.Color.GrayScale.gray500.color.cgColor + button.layer.cornerRadius = 8 + button.clipsToBounds = true + button.contentVerticalAlignment = .center + button.contentHorizontalAlignment = .center + return button + }() - $0.configuration = config - $0.addTarget(self, action: #selector(didSelectedImage), for: .touchUpInside) - - $0.layer.borderWidth = 1 - $0.layer.borderColor = EATSSUDesignAsset.Color.GrayScale.gray500.color.cgColor - $0.layer.cornerRadius = 8 - $0.clipsToBounds = true - - $0.contentVerticalAlignment = .center - $0.contentHorizontalAlignment = .center - } - - private let imageCountLabel = UILabel().then { - $0.text = "사진 0/1" - $0.font = .caption3 - $0.textColor = EATSSUDesignAsset.Color.GrayScale.gray500.color - $0.textAlignment = .center - } + private let imageCountLabel: UILabel = { + let label = UILabel() + label.text = "사진 0/1" + label.font = .caption3 + label.textColor = EATSSUDesignAsset.Color.GrayScale.gray500.color + label.textAlignment = .center + return label + }() - private let deleteMethodLabel = UILabel().then { - $0.text = "사진 클릭 시, 삭제됩니다" - $0.font = .caption3 - $0.textColor = EATSSUDesignAsset.Color.GrayScale.gray500.color - } + private let deleteMethodLabel: UILabel = { + let label = UILabel() + label.text = "사진 클릭 시, 삭제됩니다" + label.font = .caption3 + label.textColor = EATSSUDesignAsset.Color.GrayScale.gray500.color + return label + }() private let maximumWordLabel: UILabel = { let label = UILabel() @@ -174,9 +176,13 @@ final class SetRateViewController: BaseViewController { return label }() - private var nextButton = MainButton().then { - $0.title = "다음 단계로" - } + private var nextButton: MainButton = { + let button = MainButton() + button.title = "다음 단계로" + return button + }() + + // MARK: - Life Cycles override func viewDidLoad() { super.viewDidLoad() @@ -191,6 +197,7 @@ final class SetRateViewController: BaseViewController { removeKeyboardNotifications() } + // MARK: - Functions override func configureUI() { diff --git a/EATSSU/App/Sources/Presentation/Splash/NoticeSplashViewController.swift b/EATSSU/App/Sources/Presentation/Splash/NoticeSplashViewController.swift index 0cec82bb..13b3dfb4 100644 --- a/EATSSU/App/Sources/Presentation/Splash/NoticeSplashViewController.swift +++ b/EATSSU/App/Sources/Presentation/Splash/NoticeSplashViewController.swift @@ -7,34 +7,40 @@ import UIKit -import EATSSUDesign - import SnapKit -import Then + +import EATSSUDesign /// 점검 혹은 공지가 필요할 때 사용하는 스플래시 뷰 class NoticeSplashViewController: BaseViewController { // MARK: - UI Components - private let iconImageView = UIImageView().then { - $0.image = EATSSUDesignAsset.Images.alertCircle.image - $0.contentMode = .scaleAspectFit - } - - private let logoImageView = UIImageView().then { - $0.image = EATSSUDesignAsset.Images.authLogo.image - $0.contentMode = .scaleAspectFit - } - - private let titleLabel = UILabel().then { - $0.text = "긴급 서버 점검 안내" - $0.font = EATSSUDesignFontFamily.Pretendard.bold.font(size: 16) - $0.textColor = EATSSUDesignAsset.Color.Main.primary.color - $0.textAlignment = .center - } - - private let messageLabel = UILabel().then { + private let iconImageView: UIImageView = { + let imageView = UIImageView() + imageView.image = EATSSUDesignAsset.Images.alertCircle.image + imageView.contentMode = .scaleAspectFit + return imageView + }() + + private let logoImageView: UIImageView = { + let imageView = UIImageView() + imageView.image = EATSSUDesignAsset.Images.authLogo.image + imageView.contentMode = .scaleAspectFit + return imageView + }() + + private let titleLabel: UILabel = { + let label = UILabel() + label.text = "긴급 서버 점검 안내" + label.font = EATSSUDesignFontFamily.Pretendard.bold.font(size: 16) + label.textColor = EATSSUDesignAsset.Color.Main.primary.color + label.textAlignment = .center + return label + }() + + private let messageLabel: UILabel = { + let label = UILabel() let text = """ 3월 29일(토) 오후 11시부터 3월 30일(일) 오전 1시까지 서버 점검으로 인해 앱 이용이 일시 중단됩니다. @@ -51,9 +57,10 @@ class NoticeSplashViewController: BaseViewController { .paragraphStyle: paragraphStyle ] - $0.attributedText = NSAttributedString(string: text, attributes: attributes) - $0.numberOfLines = 0 - } + label.attributedText = NSAttributedString(string: text, attributes: attributes) + label.numberOfLines = 0 + return label + }() // MARK: - Lifecycle override func viewDidLoad() { diff --git a/EATSSU/App/Sources/Presentation/Splash/SplashViewController.swift b/EATSSU/App/Sources/Presentation/Splash/SplashViewController.swift index 898f87da..41ab633e 100644 --- a/EATSSU/App/Sources/Presentation/Splash/SplashViewController.swift +++ b/EATSSU/App/Sources/Presentation/Splash/SplashViewController.swift @@ -5,27 +5,21 @@ // Created by 황상환 on 3/25/25. // -// -// SplashViewController.swift -// EATSSU-DEV -// -// Created by 황상환 on 3/25/25. -// - import UIKit import EATSSUDesign import SnapKit -import Then /// 기본 스플래시 뷰 class SplashViewController: BaseViewController { // MARK: - UI Components - private let logoImageView = UIImageView().then { - $0.image = EATSSUDesignAsset.Images.splashLogo.image - $0.contentMode = .scaleAspectFit - } + private let logoImageView: UIImageView = { + let imageView = UIImageView() + imageView.image = EATSSUDesignAsset.Images.splashLogo.image + imageView.contentMode = .scaleAspectFit + return imageView + }() // MARK: - Lifecycle override func viewDidLoad() { diff --git a/EATSSU/App/Sources/Utility/Base/PostUIButton.swift b/EATSSU/App/Sources/Utility/Base/PostUIButton.swift index e1da21cc..4fa06a27 100644 --- a/EATSSU/App/Sources/Utility/Base/PostUIButton.swift +++ b/EATSSU/App/Sources/Utility/Base/PostUIButton.swift @@ -7,10 +7,10 @@ import UIKit -import EATSSUDesign - import SnapKit +import EATSSUDesign + class PostUIButton: UIButton { override var isEnabled: Bool { didSet { diff --git a/EATSSU/App/Sources/Utility/UIComponent/MainButton.swift b/EATSSU/App/Sources/Utility/UIComponent/MainButton.swift index a90b2066..00122579 100644 --- a/EATSSU/App/Sources/Utility/UIComponent/MainButton.swift +++ b/EATSSU/App/Sources/Utility/UIComponent/MainButton.swift @@ -7,10 +7,9 @@ import UIKit -import EATSSUDesign - import SnapKit -import Then + +import EATSSUDesign class MainButton: UIButton { private enum Size { @@ -41,7 +40,7 @@ class MainButton: UIButton { // MARK: - Function func configureUI() { - titleLabel?.font = .button1 + titleLabel?.font = EATSSUDesignFontFamily.Pretendard.bold.font(size: 18) titleLabel?.textColor = .white backgroundColor = EATSSUDesignAsset.Color.Main.primary.color layer.cornerRadius = 10 diff --git a/EATSSU/App/Sources/Utility/UIComponent/MainTextField.swift b/EATSSU/App/Sources/Utility/UIComponent/MainTextField.swift index bb27f78d..5c6440fd 100644 --- a/EATSSU/App/Sources/Utility/UIComponent/MainTextField.swift +++ b/EATSSU/App/Sources/Utility/UIComponent/MainTextField.swift @@ -8,7 +8,6 @@ import UIKit import SnapKit -import Then class MainTextField: UITextField { private enum Size { diff --git a/EATSSU/Project.swift b/EATSSU/Project.swift index 02aaf9a5..192f874a 100644 --- a/EATSSU/Project.swift +++ b/EATSSU/Project.swift @@ -87,7 +87,6 @@ let project = Project( .external(name: "SnapKit"), .external(name: "Tabman"), .external(name: "Moya"), - .external(name: "Then"), .external(name: "FSCalendar"), .external(name: "Kingfisher"), .external(name: "GoogleAppMeasurement"), @@ -123,7 +122,6 @@ let project = Project( .external(name: "SnapKit"), .external(name: "Tabman"), .external(name: "Moya"), - .external(name: "Then"), .external(name: "FSCalendar"), .external(name: "Kingfisher"), .external(name: "GoogleAppMeasurement"), diff --git a/EATSSUDesign/EATSSUDesign/Sources/DesignSystem/Button/ESButton.swift b/EATSSUDesign/EATSSUDesign/Sources/DesignSystem/Button/ESButton.swift index ff61a9df..90b59da7 100644 --- a/EATSSUDesign/EATSSUDesign/Sources/DesignSystem/Button/ESButton.swift +++ b/EATSSUDesign/EATSSUDesign/Sources/DesignSystem/Button/ESButton.swift @@ -90,9 +90,9 @@ public final class ESButton: UIButton { switch size { case .big: - titleLabel?.font = .button1 + titleLabel?.font = EATSSUDesignFontFamily.Pretendard.bold.font(size: 18) case .small: - titleLabel?.font = .button2 + titleLabel?.font = EATSSUDesignFontFamily.Pretendard.bold.font(size: 14) } } diff --git a/Tuist/Package.resolved b/Tuist/Package.resolved index 4d9a0bae..7ceaadd8 100644 --- a/Tuist/Package.resolved +++ b/Tuist/Package.resolved @@ -1,5 +1,5 @@ { - "originHash" : "070bb517176d84479759d3c2fe4d26c7a48cdd324d100afcc31ca3f91686214b", + "originHash" : "86c28210c9f80f904576c16e2ec3d535e73b521baf7974cd5ea3fca1e60e6190", "pins" : [ { "identity" : "abseil-cpp-binary", @@ -225,15 +225,6 @@ "revision" : "3b2213290eb93e55bb50b49d1a179033005c11ab", "version" : "3.2.0" } - }, - { - "identity" : "then", - "kind" : "remoteSourceControl", - "location" : "https://github.com/devxoul/Then", - "state" : { - "revision" : "d41ef523faef0f911369f79c0b96815d9dbb6d7a", - "version" : "3.0.0" - } } ], "version" : 3 diff --git a/Tuist/Package.swift b/Tuist/Package.swift index bbf4f0e0..83137b14 100644 --- a/Tuist/Package.swift +++ b/Tuist/Package.swift @@ -14,7 +14,6 @@ import PackageDescription "SnapKit": .framework, "Tabman": .framework, "Pageboy": .framework, - "Then": .framework, "FSCalendar": .framework, "Kingfisher": .framework, @@ -45,7 +44,6 @@ let package = Package( .package(url: "https://github.com/uias/Tabman", from: "3.2.0"), .package(url: "https://github.com/uias/Pageboy", from: "4.2.0"), .package(url: "https://github.com/Moya/Moya", from: "15.0.0"), - .package(url: "https://github.com/devxoul/Then", from: "3.0.0"), .package(url: "https://github.com/WenchaoD/FSCalendar", from: "2.8.3"), .package(url: "https://github.com/kakao/kakao-ios-sdk", from: "2.22.5"), .package(url: "https://github.com/onevcat/Kingfisher", from: "7.12.0"),