Skip to content

Commit

Permalink
Merge pull request #64 from L-j-h-c/feature/#60
Browse files Browse the repository at this point in the history
[Feat] #60 - 상세페이지 화면전환 및 팬제스쳐 기능 구현
  • Loading branch information
L-j-h-c authored Jul 14, 2022
2 parents cef5af6 + 8e087e8 commit 3832f3e
Show file tree
Hide file tree
Showing 39 changed files with 341 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ struct MainMapCategory {
let menuName: String
let menuIcon: UIImage

static let categorySample: [MainMapCategory] = [MainMapCategory(menuName: "샐러드", menuIcon: ImageLiterals.Map.scrapIcon!), MainMapCategory(menuName: "포케", menuIcon: ImageLiterals.Map.scrapIcon!), MainMapCategory(menuName: "샌드위치", menuIcon: ImageLiterals.Map.scrapIcon!), MainMapCategory(menuName: "샤브샤브", menuIcon: ImageLiterals.Map.scrapIcon!), MainMapCategory(menuName: "보쌈", menuIcon: ImageLiterals.Map.scrapIcon!), MainMapCategory(menuName: "고깃집", menuIcon: ImageLiterals.Map.scrapIcon!), MainMapCategory(menuName: "덮밥", menuIcon: ImageLiterals.Map.scrapIcon!), MainMapCategory(menuName: "키토김밥", menuIcon: ImageLiterals.Map.scrapIcon!)]
static let categorySample: [MainMapCategory] = [MainMapCategory(menuName: "샐러드", menuIcon: ImageLiterals.Map.saladIcon!), MainMapCategory(menuName: "포케", menuIcon: ImageLiterals.Map.pokeIcon!), MainMapCategory(menuName: "키토김밥", menuIcon: ImageLiterals.Map.kimbapIcon!), MainMapCategory(menuName: "샌드위치", menuIcon: ImageLiterals.Map.sandwichIcon!), MainMapCategory(menuName: "샤브샤브", menuIcon: ImageLiterals.Map.shabushabuIcon!), MainMapCategory(menuName: "보쌈", menuIcon: ImageLiterals.Map.bossamIcon!), MainMapCategory(menuName: "고깃집", menuIcon: ImageLiterals.Map.meatIcon!), MainMapCategory(menuName: "덮밥", menuIcon: ImageLiterals.Map.dupbapIcon!)]
}
11 changes: 10 additions & 1 deletion HealthFoodMe/HealthFoodMe/Global/Literals/ImageLiterals.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,16 @@ struct ImageLiterals {
static let mappinIcon_diet = UIImage(named: "icn_mappin_diet")
static let mappinIcon_normal = UIImage(named: "icn_mappin_normal")
static let menuIcon = UIImage(named: "icn_menu")
static let mylocationIcon = UIImage(named: "icn_myLocation")
static let mylocationIcon = UIImage(named: "icn_mylocation")

static let bossamIcon = UIImage(named: "icn_bossam")
static let dupbapIcon = UIImage(named: "icn_dupbap")
static let kimbapIcon = UIImage(named: "icn_kimbap")
static let meatIcon = UIImage(named: "icn_meat")
static let pokeIcon = UIImage(named: "icn_poke")
static let saladIcon = UIImage(named: "icn_salad")
static let sandwichIcon = UIImage(named: "icn_sandwich")
static let shabushabuIcon = UIImage(named: "icn_shabushabu")
}

struct ReviewWrite {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "icn_bossam.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "icn_bossam@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "icn_bossam@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "icn_dupbap.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "icn_dupbap@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "icn_dupbap@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "icn_kimbap.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "icn_kimbap@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "icn_kimbap@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "icn_meat.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "icn_meat@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "icn_meat@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "icn_poke.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "icn_poke@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "icn_poke@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "icn_salad.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "icn_salad@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "icn_salad@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "icn_sandwich.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "icn_sandwich@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "icn_sandwich@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "icn_shabushabu.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "icn_shabushabu@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "icn_shabushabu@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ final class DetailTabTVC: UITableViewCell, UITableViewRegisterable {
cv.showsHorizontalScrollIndicator = false
cv.isPagingEnabled = true
cv.backgroundColor = .white
cv.bounces = false

return cv
}()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ class MainDetailVC: UIViewController {
// MARK: - Properties

private let disposeBag = DisposeBag()
var viewModel: MainDetailViewModel!
private var mainInfoTVC = MainInfoTVC()
private var detailTabTVC = DetailTabTVC()
private var detailTabTitleHeader = DetailTabTitleHeader()
private var childVC = ModuleFactory.resolve().makeMenuTabVC()
var viewModel: MainDetailViewModel!
var translationClosure: (() -> Void)?

// MARK: - UI Components

Expand All @@ -30,6 +32,7 @@ class MainDetailVC: UIViewController {
tv.clipsToBounds = true
tv.sectionFooterHeight = 0
tv.allowsSelection = false
tv.bounces = false
if #available(iOS 15, *) {
tv.sectionHeaderTopPadding = 0
}
Expand All @@ -50,6 +53,11 @@ class MainDetailVC: UIViewController {
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
}

override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
setPanGesture()
}
}

// MARK: - Methods
Expand All @@ -66,7 +74,9 @@ extension MainDetailVC {
backButton.setImage(ImageLiterals.MainDetail.beforeIcon, for: .normal)
backButton.tintColor = .helfmeBlack
backButton.addAction(UIAction(handler: { _ in
self.navigationController?.popViewController(animated: true)
self.dismiss(animated: false) {
self.translationClosure?()
}
}), for: .touchUpInside)

let scrapButton = UIButton()
Expand Down Expand Up @@ -104,6 +114,39 @@ extension MainDetailVC {
let input = MainDetailViewModel.Input()
let output = self.viewModel.transform(from: input, disposeBag: self.disposeBag)
}

private func setPanGesture() {
let panGesture = UIPanGestureRecognizer()
mainInfoTVC.addGestureRecognizer(panGesture)
panGesture.rx.event.asDriver { _ in .never() }
.drive(onNext: { [weak self] sender in
let windowTranslation = sender.translation(in: self?.view)
print(windowTranslation)
switch sender.state {
case .changed:
self?.view.backgroundColor = .clear
UIView.animate(withDuration: 0.1) {
self?.view.transform = CGAffineTransform(translationX: 0, y: windowTranslation.y)
}
case .ended:
if windowTranslation.y > 130 {
self?.dismiss(animated: false) {
self?.translationClosure?()
}
} else {
self?.view.snp.updateConstraints { make in
make.edges.equalToSuperview()
}
UIView.animate(withDuration: 0.2, delay: 0, options: .curveEaseIn) {
self?.view.transform = CGAffineTransform(translationX: 0, y: 0)
self?.view.layoutIfNeeded()
}
}
default:
break
}
}).disposed(by: disposeBag)
}
}

// MARK: TableViewDelegate
Expand Down Expand Up @@ -175,6 +218,7 @@ extension MainDetailVC: UITableViewDataSource {
.drive { phoneNumber in
URLSchemeManager.shared.loadTelephoneApp(phoneNumber: phoneNumber)
}.disposed(by: disposeBag)
mainInfoTVC = cell
return cell
} else {
guard let cell = tableView.dequeueReusableCell(withIdentifier: DetailTabTVC.className, for: indexPath) as? DetailTabTVC else { return UITableViewCell() }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ final class MenuTabVC: UIViewController {
let cv = UICollectionView(frame: .zero, collectionViewLayout: layout)
cv.showsVerticalScrollIndicator = false
cv.backgroundColor = .helfmeWhite
cv.bounces = false
return cv
}()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ extension MenuCategoryCVC {
menuImageView.snp.makeConstraints { make in
make.centerY.equalToSuperview()
make.width.height.equalTo(24)
make.leading.equalToSuperview().inset(4)
make.leading.equalToSuperview().inset(8)
}

menuNameLabel.snp.makeConstraints { make in
make.centerY.equalTo(menuImageView.snp.centerY)
make.leading.equalTo(menuImageView.snp.trailing).offset(8)
make.leading.equalTo(menuImageView.snp.trailing).offset(5)
make.trailing.equalToSuperview().inset(12)
}
}
Expand Down
Loading

0 comments on commit 3832f3e

Please sign in to comment.