diff --git a/DE/DE/Sources/Core/CommonUI/View/CustomTextFieldView.swift b/DE/DE/Sources/Core/CommonUI/View/CustomTextFieldView.swift index 27cca5a9..3666e49e 100644 --- a/DE/DE/Sources/Core/CommonUI/View/CustomTextFieldView.swift +++ b/DE/DE/Sources/Core/CommonUI/View/CustomTextFieldView.swift @@ -47,9 +47,7 @@ public class CustomTextFieldView: UIView, UITextFieldDelegate { textFieldPlaceholder: String, validationText: String) { // 설명 라벨 설정 - descriptionLabel.text = descriptionLabelText - descriptionLabel.textColor = AppColor.black - descriptionLabel.font = UIFont.pretendard(.semiBold, size: 18) + AppTextStyle.KR.subtitle1.apply(to: descriptionLabel, text: descriptionLabelText, color: AppColor.black) // 텍스트 필드 설정 textField.placeholder = textFieldPlaceholder @@ -85,16 +83,18 @@ public class CustomTextFieldView: UIView, UITextFieldDelegate { descriptionLabel.snp.makeConstraints { make in make.top.equalToSuperview() - make.leading.equalToSuperview().offset(8) + make.leading.equalToSuperview() } + textField.snp.makeConstraints { make in - make.top.equalTo(descriptionLabel.snp.bottom).offset(10) + make.top.equalTo(descriptionLabel.snp.bottom).offset(20) make.leading.trailing.bottom.equalToSuperview() make.height.equalTo(DynamicPadding.dynamicValue(48.0)) } + validationLabel.snp.makeConstraints { make in make.top.equalTo(textField.snp.bottom).offset(5) - make.leading.equalToSuperview().inset(8) + make.leading.equalToSuperview().inset(4) } } diff --git a/DE/DE/Sources/Features/Setting/Models/MyWineViewModel.swift b/DE/DE/Sources/Features/Setting/Models/MyWineViewModel.swift index b56e06eb..baad440f 100644 --- a/DE/DE/Sources/Features/Setting/Models/MyWineViewModel.swift +++ b/DE/DE/Sources/Features/Setting/Models/MyWineViewModel.swift @@ -58,4 +58,16 @@ public struct MyWineViewModel { let components = Calendar.current.dateComponents([.year, .month, .day], from: date) return components } + + public func getVintage() -> Int? { + return vintage + } + + public func getDisplayedName() -> String { + if let vintage = vintage { + return "\(wineName) \(vintage)" + } else { + return wineName + } + } } diff --git a/DE/DE/Sources/Features/Setting/ViewControllers/MyWine/ChangeMyOwnedWineViewController.swift b/DE/DE/Sources/Features/Setting/ViewControllers/MyWine/ChangeMyOwnedWineViewController.swift index c3a2c1eb..d0498858 100644 --- a/DE/DE/Sources/Features/Setting/ViewControllers/MyWine/ChangeMyOwnedWineViewController.swift +++ b/DE/DE/Sources/Features/Setting/ViewControllers/MyWine/ChangeMyOwnedWineViewController.swift @@ -8,13 +8,13 @@ import SnapKit import Then // 보유와인 정보 수정 -class ChangeMyOwnedWineViewController: UIViewController, FirebaseTrackable { +final class ChangeMyOwnedWineViewController: UIViewController, FirebaseTrackable { var screenName: String = Tracking.VC.updateMyWineVC weak var delegate: ChildViewControllerDelegate? let navigationBarManager = NavigationBarManager() - lazy var editInfoView = ChangeMyOwnedWineView() + lazy var editInfoView = ChangeMyWineView() let networkService = MyWineService() private let errorHandler = NetworkErrorHandler() @@ -34,6 +34,8 @@ class ChangeMyOwnedWineViewController: UIViewController, FirebaseTrackable { super.viewWillAppear(animated) self.view.addSubview(indicator) self.navigationController?.setNavigationBarHidden(false, animated: animated) + + setData() } public override func viewWillDisappear(_ animated: Bool) { @@ -55,26 +57,57 @@ class ChangeMyOwnedWineViewController: UIViewController, FirebaseTrackable { logScreenView(fileName: #file) } - func setupActions() { + private func setupActions() { configureCalendarSelection() editInfoView.priceTextField.textField.addTarget(self, action: #selector(checkEmpty), for: .allEditingEvents) editInfoView.nextButton.addTarget(self, action: #selector(completeEdit), for: .touchUpInside) + + editInfoView.yearPicker.onLabelTapped = { [weak self] in + guard let self else { return } + + let modal = YearPickerModalViewController( + minYear: self.editInfoView.yearPicker.minYear, + maxYear: self.editInfoView.yearPicker.maxYear, + selectedYear: self.editInfoView.yearPicker.selectedYear + ) + + modal.onYearConfirmed = { [weak self] selectedYear in + self?.editInfoView.yearPicker.setSelectedYear(selectedYear) + self?.editInfoView.yearPicker.updatePickerView(isModalOpen: false) + } + + modal.modalPresentationStyle = .pageSheet + if let sheet = modal.sheetPresentationController { + sheet.detents = [.medium()] + sheet.prefersGrabberVisible = true + sheet.prefersScrollingExpandsWhenScrolledToEdge = false + sheet.delegate = self + } + + self.editInfoView.yearPicker.updatePickerView(isModalOpen: true) + self.present(modal, animated: true) + } } - func setupUI() { - guard let wine = registerWine else {return} + private func setData() { + guard let wine = registerWine else { return } + editInfoView.setTopSection(name: wine.wineName) editInfoView.setWinePrice(wine.purchasePrice) - + editInfoView.yearPicker.setInitialYear(wine.getVintage()) + } + + private func setupUI() { view.addSubview(editInfoView) editInfoView.snp.makeConstraints { make in - make.top.equalTo(view.safeAreaLayoutGuide).offset(DynamicPadding.dynamicValue(40)) - make.leading.trailing.equalToSuperview().inset(DynamicPadding.dynamicValue(24)) + make.top.equalTo(view.safeAreaLayoutGuide) + + make.leading.trailing.equalToSuperview() make.bottom.equalToSuperview() } } - func setupNavigationBar() { + private func setupNavigationBar() { navigationBarManager.addBackButton( to: navigationItem, target: self, @@ -111,10 +144,11 @@ class ChangeMyOwnedWineViewController: UIViewController, FirebaseTrackable { @objc private func deleteNewWine() { guard let currentWine = self.registerWine else { return } + guard let vintage = currentWine.getVintage() else { return } let alert = UIAlertController( title: "이 와인을 삭제하시겠습니까?", - message: "\(currentWine.wineName)", + message: "\(currentWine.wineName) \(vintage)", preferredStyle: .alert ) @@ -136,12 +170,25 @@ class ChangeMyOwnedWineViewController: UIViewController, FirebaseTrackable { @objc private func completeEdit() { logButtonClick(screenName: screenName, buttonName: Tracking.ButtonEvent.updatemyWineBtnTapped, fileName: #file) + guard let wine = registerWine else { return } - callUpdateAPI(wineId: wine.myWineId, price: checkPrice(), buyDate: checkDate()) - DispatchQueue.main.async { - self.view.hideBlockingView() - self.navigationController?.popViewController(animated: true) + guard let selectedVintage = editInfoView.yearPicker.selectedYear else { + showToastMessage(message: "빈티지가 선택되지 않았습니다.", yPosition: view.frame.height * 0.5) + return + } + + callUpdateAPI( + wineId: wine.myWineId, + price: checkPrice(), + vintage: selectedVintage, + buyDate: checkDate() + ) + + DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) { [weak self] in + self?.view.hideBlockingView() + self?.navigationController?.popViewController(animated: true) } + } @objc func checkEmpty() { @@ -193,8 +240,13 @@ class ChangeMyOwnedWineViewController: UIViewController, FirebaseTrackable { } } - private func callUpdateAPI(wineId: Int, price: Int?, buyDate: String?) { - let data = networkService.makeUpdateDTO(buyDate: buyDate, buyPrice: price) + private func callUpdateAPI(wineId: Int, price: Int?, vintage: Int?, buyDate: String?) { + let data = networkService.makeUpdateDTO( + buyDate: buyDate, + vintage: vintage, + buyPrice: price + ) + self.view.showBlockingView() Task { do { @@ -243,3 +295,9 @@ extension ChangeMyOwnedWineViewController: UICalendarViewDelegate { return nil } } + +extension ChangeMyOwnedWineViewController: UIAdaptivePresentationControllerDelegate, UISheetPresentationControllerDelegate { + public func presentationControllerDidDismiss(_ presentationController: UIPresentationController) { + editInfoView.yearPicker.updatePickerView(isModalOpen: false) + } +} diff --git a/DE/DE/Sources/Features/Setting/ViewControllers/MyWine/MyOwnedWineInfoViewController.swift b/DE/DE/Sources/Features/Setting/ViewControllers/MyWine/MyOwnedWineInfoViewController.swift index 6df5ef13..d42d6f8a 100644 --- a/DE/DE/Sources/Features/Setting/ViewControllers/MyWine/MyOwnedWineInfoViewController.swift +++ b/DE/DE/Sources/Features/Setting/ViewControllers/MyWine/MyOwnedWineInfoViewController.swift @@ -27,6 +27,7 @@ public class MyOwnedWineInfoViewController: UIViewController, ChildViewControlle public override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) + fetchMyWineAPI() self.view.addSubview(indicator) self.hidesBottomBarWhenPushed = true self.navigationController?.setNavigationBarHidden(false, animated: animated) @@ -41,32 +42,30 @@ public class MyOwnedWineInfoViewController: UIViewController, ChildViewControlle super.viewDidLoad() setupUI() setupNavigationBar() - setWineData() + setActions() wineDetailView.setEditButton(showEditButton: true) } public override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) logScreenView(fileName: #file) - fetchMyWineAPI() } + private func setActions() { + wineDetailView.editButton.addTarget(self, action: #selector(editButtonTapped), for: .touchUpInside) + deleteButton.addTarget(self, action: #selector(deleteButtonTapped), for: .touchUpInside) + } + + @MainActor private func setWineData() { guard let currentWine = self.registerWine else { return } - var displayName = currentWine.wineName - if let vintage = currentWine.vintage { - displayName += " \(vintage)" - } - - header.setWineName(displayName) + header.setWineName(currentWine.getDisplayedName()) header.infoView.image.sd_setImage(with: URL(string: currentWine.wineImageUrl), placeholderImage: UIImage(named: "placeholder")) header.infoView.typeContents.text = "\(currentWine.wineCountry), \(currentWine.wineRegion)" header.infoView.countryContents.text = currentWine.wineVariety header.infoView.kindContents.text = currentWine.wineSort self.setWineDetailInfo(currentWine) - wineDetailView.editButton.addTarget(self, action: #selector(editButtonTapped), for: .touchUpInside) - deleteButton.addTarget(self, action: #selector(deleteButtonTapped), for: .touchUpInside) } // MARK: - Setup Methods @@ -177,28 +176,34 @@ public class MyOwnedWineInfoViewController: UIViewController, ChildViewControlle Task { do { let data = try await networkService.fetchMyWine(myWineId: registerWine!.myWineId) - DispatchQueue.main.async { [self] in - self.registerWine = MyWineViewModel( - myWineId: data.myWineId, - wineId: data.wineId, - wineName: data.wineName, - vintage: data.vintageYear, - wineSort: data.wineSort, - wineCountry: data.wineCountry, - wineRegion: data.wineRegion, - wineVariety: data.wineVariety, - wineImageUrl: data.wineImageUrl, - purchaseDate: data.purchaseDate, - purchasePrice: data.purchasePrice, - period: data.period - ) + + registerWine = MyWineViewModel( + myWineId: data.myWineId, + wineId: data.wineId, + wineName: data.wineName, + vintage: data.vintageYear, + wineSort: data.wineSort, + wineCountry: data.wineCountry, + wineRegion: data.wineRegion, + wineVariety: data.wineVariety, + wineImageUrl: data.wineImageUrl, + purchaseDate: data.purchaseDate, + purchasePrice: data.purchasePrice, + period: data.period + ) + + DispatchQueue.main.async { [weak self] in + guard let self = self else { return } self.setWineData() -// self.needUpdate = false + self.view.hideBlockingView() } } catch { - self.view.hideBlockingView() - errorHandler.handleNetworkError(error, in: self) + DispatchQueue.main.async { [weak self] in + guard let self = self else { return } + self.view.hideBlockingView() + errorHandler.handleNetworkError(error, in: self) + } } } } diff --git a/DE/DE/Sources/Features/Setting/Views/MyWine/ChangeMyOwnedWineView.swift b/DE/DE/Sources/Features/Setting/Views/MyWine/ChangeMyOwnedWineView.swift deleted file mode 100644 index ca8f171d..00000000 --- a/DE/DE/Sources/Features/Setting/Views/MyWine/ChangeMyOwnedWineView.swift +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright © 2024 DRINKIG. All rights reserved - -import UIKit -import SnapKit -import Then - -import CoreModule -import DesignSystem -// 기기대응 완료 -// TODO : 현재 빈티지 수정 UI 디자인 가이드 없음(추후 논의 필요) - -class ChangeMyOwnedWineView: UIView { - - public let priceTextField = CustomTextFieldView( - descriptionLabelText: "구매 가격", - textFieldPlaceholder: "가격을 입력해주세요", - validationText: "" - ).then { t in - t.textField.keyboardType = .numberPad - } - - public lazy var dateTitle = UILabel().then { - $0.text = "구매 일자" - $0.textColor = AppColor.black - $0.font = UIFont.pretendard(.semiBold, size: 18) - $0.numberOfLines = 1 - } - - lazy var calendarContainer = UIView().then { - $0.backgroundColor = AppColor.white - $0.layer.cornerRadius = 10 - - // 그림자 설정 - $0.layer.shadowColor = UIColor.black.cgColor // 그림자 색상 - $0.layer.shadowOpacity = 0.1 // 그림자 투명도 (0.0 ~ 1.0) - $0.layer.shadowOffset = CGSize(width: 0, height: 2) // 그림자 위치 (x, y) - $0.layer.shadowRadius = 4 // 그림자 흐림 정도 - $0.layer.masksToBounds = false // 그림자 잘리지 않게 설정 - } - - public lazy var calender = UICalendarView().then { - $0.timeZone = .current - $0.backgroundColor = .clear - $0.calendar = .current - $0.locale = Locale(identifier: "ko_KR") - $0.fontDesign = .rounded - $0.wantsDateDecorations = true - $0.tintColor = AppColor.purple100 - } - - public lazy var nextButton = CustomButton(title: "수정 완료", isEnabled: true) - - override init(frame: CGRect) { - super.init(frame: frame) - setupUI() - setConstraints() - } - - required init?(coder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - - func setWinePrice(_ price: Int) { - self.priceTextField.textField.text = "\(price)" - } - - func setupUI() { - backgroundColor = AppColor.background - calendarContainer.addSubview(calender) - [priceTextField, dateTitle, calendarContainer, nextButton].forEach{ addSubview($0) } - - } - - func setConstraints() { - priceTextField.snp.makeConstraints { make in - make.top.equalToSuperview() - make.leading.trailing.equalToSuperview() - } - - dateTitle.snp.makeConstraints { make in - make.top.equalTo(priceTextField.snp.bottom).offset(DynamicPadding.dynamicValue(45)) - make.leading.trailing.equalToSuperview() - } - - calender.snp.makeConstraints { - $0.verticalEdges.equalToSuperview() - $0.horizontalEdges.equalToSuperview().inset(DynamicPadding.dynamicValue(16)) - } - - calendarContainer.snp.makeConstraints { make in - make.top.equalTo(dateTitle.snp.bottom).offset(DynamicPadding.dynamicValue(10)) - make.leading.trailing.equalToSuperview() - make.height.equalTo(calendarContainer.snp.width).multipliedBy(1.15) - } - - nextButton.snp.makeConstraints { make in - make.bottom.equalToSuperview().inset(DynamicPadding.dynamicValue(40)) // 동적 기기 대응 - make.leading.trailing.equalToSuperview() - } - } - -} diff --git a/DE/DE/Sources/Features/Setting/Views/MyWine/ChangeMyWineView.swift b/DE/DE/Sources/Features/Setting/Views/MyWine/ChangeMyWineView.swift new file mode 100644 index 00000000..f25a7fbe --- /dev/null +++ b/DE/DE/Sources/Features/Setting/Views/MyWine/ChangeMyWineView.swift @@ -0,0 +1,154 @@ +// Copyright © 2025 DRINKIG. All rights reserved + +import UIKit +import SnapKit +import Then + +import CoreModule +import DesignSystem + +final class ChangeMyWineView: UIView { + let decsText = "빈티지" + let dateTitle = "구매 일자" + + let scrollView = UIScrollView() + let containerView = UIView() + + public lazy var topView = NoCountDateTopView() + public lazy var yearPicker = YearPickerView() + let thinDivider1 = DividerFactory.make() + let thinDivider2 = DividerFactory.make() + + public let priceTextField = CustomTextFieldView( + descriptionLabelText: "구매 가격", + textFieldPlaceholder: "가격을 입력해주세요", + validationText: "" + ).then { t in + t.textField.keyboardType = .numberPad + } + + public lazy var dateTitleLabel = UILabel().then { + $0.numberOfLines = 1 + } + + lazy var calendarContainer = UIView().then { + $0.backgroundColor = AppColor.white + $0.layer.cornerRadius = 10 + + // 그림자 설정 + $0.layer.shadowColor = UIColor.black.cgColor + $0.layer.shadowOpacity = 0.04 + $0.layer.shadowOffset = CGSize(width: 0, height: 2) + $0.layer.shadowRadius = 4 + $0.layer.masksToBounds = false + } + + public lazy var calender = UICalendarView().then { + $0.timeZone = .current + $0.backgroundColor = .clear + $0.calendar = .current + $0.locale = Locale(identifier: "ko_KR") + $0.fontDesign = .rounded + $0.wantsDateDecorations = true + $0.tintColor = AppColor.purple100 + } + + public lazy var nextButton = CustomButton(title: "저장하기", isEnabled: true) + + override init(frame: CGRect) { + super.init(frame: frame) + setupUI() + setConstraints() + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + func setWinePrice(_ price: Int) { + self.priceTextField.textField.text = "\(price)" + } + + func setupUI() { + backgroundColor = AppColor.background + AppTextStyle.KR.subtitle1.apply(to: dateTitleLabel, text: dateTitle, color: AppColor.black) + scrollView.showsHorizontalScrollIndicator = false + scrollView.showsVerticalScrollIndicator = false + + addSubviews(scrollView, nextButton) + calendarContainer.addSubview(calender) + + scrollView.addSubview(containerView) + containerView.addSubviews(topView, yearPicker, thinDivider1, priceTextField, thinDivider2, dateTitleLabel, calendarContainer) + } + + public func setTopSection(name: String) { + topView.setTitleLabel(title: name, + titleStyle: AppTextStyle.KR.body1, + titleColor: AppColor.purple100, + description: decsText, + descriptionStyle: AppTextStyle.KR.subtitle1, + descriptionColor: AppColor.black) + } + + func setConstraints() { + nextButton.snp.makeConstraints { + $0.bottom.equalToSuperview().inset(42) + $0.leading.trailing.equalToSuperview().inset(24) + } + + scrollView.snp.makeConstraints { + $0.top.equalToSuperview().inset(24) + $0.leading.trailing.equalToSuperview().inset(24) + $0.bottom.equalTo(nextButton.snp.top).inset(-24) + } + + containerView.snp.makeConstraints { + $0.edges.equalToSuperview() + $0.width.equalToSuperview() + } + + topView.snp.makeConstraints { + $0.top.leading.trailing.equalToSuperview() + } + + yearPicker.snp.makeConstraints { + $0.leading.trailing.equalToSuperview() + $0.top.equalTo(topView.snp.bottom).offset(20) + } + + thinDivider1.snp.makeConstraints { + $0.top.equalTo(yearPicker.snp.bottom).offset(24) + $0.height.equalTo(1) + $0.leading.trailing.equalToSuperview() + } + + priceTextField.snp.makeConstraints { + $0.top.equalTo(thinDivider1.snp.bottom).offset(24) + $0.leading.trailing.equalToSuperview() + } + + thinDivider2.snp.makeConstraints { + $0.top.equalTo(priceTextField.snp.bottom).offset(24) + $0.height.equalTo(1) + $0.leading.trailing.equalToSuperview() + } + + dateTitleLabel.snp.makeConstraints { + $0.top.equalTo(thinDivider2.snp.bottom).offset(24) + $0.leading.trailing.equalToSuperview() + } + + calender.snp.makeConstraints { + $0.verticalEdges.equalToSuperview() + $0.horizontalEdges.equalToSuperview().inset(16) + } + + calendarContainer.snp.makeConstraints { + $0.top.equalTo(dateTitleLabel.snp.bottom).offset(20) + $0.leading.trailing.equalToSuperview().inset(4) + $0.height.equalTo(calendarContainer.snp.width).multipliedBy(1.15) + $0.bottom.equalToSuperview().inset(24) + } + } +} diff --git a/DE/DE/Sources/Features/Setting/Views/MyWine/NoCountDateTopView.swift b/DE/DE/Sources/Features/Setting/Views/MyWine/NoCountDateTopView.swift index 6236ba41..a65f54c4 100644 --- a/DE/DE/Sources/Features/Setting/Views/MyWine/NoCountDateTopView.swift +++ b/DE/DE/Sources/Features/Setting/Views/MyWine/NoCountDateTopView.swift @@ -9,19 +9,6 @@ import SnapKit // 기기대응 완료 /// 날짜 있는 쪽에만 쓰는 빅타이틀 class NoCountDateTopView: UIView { - -// public lazy var title = UILabel().then { -// $0.textColor = AppColor.purple100 -// $0.font = UIFont.ptdSemiBoldFont(ofSize: 24) -// $0.numberOfLines = 0 -// } -// -// public lazy var desp = UILabel().then { -// $0.textColor = AppColor.black -// $0.font = UIFont.ptdSemiBoldFont(ofSize: 24) -// $0.numberOfLines = 1 -// } - public lazy var titleLabel = UILabel().then { $0.numberOfLines = 0 } @@ -76,24 +63,13 @@ class NoCountDateTopView: UIView { } private func addComponents() { - [titleLabel].forEach{ self.addSubview($0) } + addSubview(titleLabel) } private func constraints() { titleLabel.snp.makeConstraints { $0.top.bottom.leading.trailing.equalToSuperview() } - -// title.snp.makeConstraints { -// $0.top.equalToSuperview() -// $0.leading.trailing.equalToSuperview() -// } -// -// desp.snp.makeConstraints { -// $0.top.equalTo(title.snp.bottom).offset(1) -// $0.leading.trailing.equalToSuperview() -// $0.bottom.equalToSuperview() -// } } } diff --git a/DE/DE/Sources/Features/TastingNote/Views/ViewComponents/Common/MyNoteTopView.swift b/DE/DE/Sources/Features/TastingNote/Views/ViewComponents/Common/MyNoteTopView.swift index 8a95792c..26c40b79 100644 --- a/DE/DE/Sources/Features/TastingNote/Views/ViewComponents/Common/MyNoteTopView.swift +++ b/DE/DE/Sources/Features/TastingNote/Views/ViewComponents/Common/MyNoteTopView.swift @@ -8,8 +8,6 @@ import Then class MyNoteTopView: UIView { public lazy var header = UILabel().then { - $0.textColor = AppColor.black - $0.font = UIFont.pretendard(.semiBold, size: 24) $0.numberOfLines = 0 } @@ -32,7 +30,7 @@ class MyNoteTopView: UIView { } public func setWineName(_ name: String) { - self.header.text = name + AppTextStyle.KR.head.apply(to: header, text: name, color: AppColor.black) } private func setConstraints() { diff --git a/DE/DE/Sources/Features/Vintage/ReusableVintageSelectionViewController.swift b/DE/DE/Sources/Features/Vintage/ReusableVintageSelectionViewController.swift index b51d3fbf..e81fd587 100644 --- a/DE/DE/Sources/Features/Vintage/ReusableVintageSelectionViewController.swift +++ b/DE/DE/Sources/Features/Vintage/ReusableVintageSelectionViewController.swift @@ -85,8 +85,8 @@ final class ReusableVintageSelectionViewController: UIViewController { sheet.detents = [.medium()] sheet.prefersGrabberVisible = true sheet.prefersScrollingExpandsWhenScrolledToEdge = false + sheet.delegate = self } - modal.presentationController?.delegate = self vintageView.yearPicker.updatePickerView(isModalOpen: true) self.present(modal, animated: true) @@ -125,7 +125,7 @@ final class ReusableVintageSelectionViewController: UIViewController { } -extension ReusableVintageSelectionViewController: UIAdaptivePresentationControllerDelegate { +extension ReusableVintageSelectionViewController: UIAdaptivePresentationControllerDelegate, UISheetPresentationControllerDelegate { func presentationControllerDidDismiss(_ presentationController: UIPresentationController) { vintageView.yearPicker.updatePickerView(isModalOpen: false) } diff --git a/DE/DE/Sources/Features/Vintage/YearPickerView.swift b/DE/DE/Sources/Features/Vintage/YearPickerView.swift index e968c9d4..32392dc8 100644 --- a/DE/DE/Sources/Features/Vintage/YearPickerView.swift +++ b/DE/DE/Sources/Features/Vintage/YearPickerView.swift @@ -50,6 +50,10 @@ final class YearPickerView: UIView { super.init(coder: coder) setupUI() } + + public func setInitialYear(_ year: Int?) { + self.selectedYear = year + } private func setupUI() { containerView.do {