Skip to content

Commit

Permalink
#171: 필터링 View 컴포넌트 생성
Browse files Browse the repository at this point in the history
  • Loading branch information
dev-muuu committed Feb 9, 2023
1 parent a0b41eb commit bd66001
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 7 deletions.
4 changes: 4 additions & 0 deletions Zatch.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@
EE642C5D298FAE2C00E15869 /* ZatchRegisterFirstViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE642C5C298FAE2C00E15869 /* ZatchRegisterFirstViewModel.swift */; };
EE7C9FF6298A72CE00D2F238 /* ChattingRoomView.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE7C9FF5298A72CE00D2F238 /* ChattingRoomView.swift */; };
EE7C9FF8298A72F600D2F238 /* ChattingRoomHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE7C9FF7298A72F600D2F238 /* ChattingRoomHeaderView.swift */; };
EE9B053529953A1200068503 /* FilterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE9B053429953A1200068503 /* FilterView.swift */; };
EEB13B6D297F969E001A8DD9 /* AppKey.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = EEB13B6C297F969E001A8DD9 /* AppKey.xcconfig */; };
EEB13B72297F9A12001A8DD9 /* TabBarItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEB13B71297F9A12001A8DD9 /* TabBarItem.swift */; };
EEB13B87297FB81B001A8DD9 /* MainViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEB13B86297FB81B001A8DD9 /* MainViewModel.swift */; };
Expand Down Expand Up @@ -646,6 +647,7 @@
EE642C5C298FAE2C00E15869 /* ZatchRegisterFirstViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ZatchRegisterFirstViewModel.swift; sourceTree = "<group>"; };
EE7C9FF5298A72CE00D2F238 /* ChattingRoomView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChattingRoomView.swift; sourceTree = "<group>"; };
EE7C9FF7298A72F600D2F238 /* ChattingRoomHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChattingRoomHeaderView.swift; sourceTree = "<group>"; };
EE9B053429953A1200068503 /* FilterView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FilterView.swift; sourceTree = "<group>"; };
EEB13B6C297F969E001A8DD9 /* AppKey.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = AppKey.xcconfig; sourceTree = "<group>"; };
EEB13B71297F9A12001A8DD9 /* TabBarItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabBarItem.swift; sourceTree = "<group>"; };
EEB13B86297FB81B001A8DD9 /* MainViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainViewModel.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1926,6 +1928,7 @@
children = (
EE33D21D2993E1120020866E /* ZatchComponent.swift */,
EE33D21B2993BF710020866E /* LettersAndArrowView.swift */,
EE9B053429953A1200068503 /* FilterView.swift */,
);
path = Component;
sourceTree = "<group>";
Expand Down Expand Up @@ -2400,6 +2403,7 @@
579F5E58281E574200D3F0D5 /* FindSearchViewController.swift in Sources */,
57E75EC528E3C4CE00AC24B2 /* ShareDetailTableViewCell.swift in Sources */,
576B376A28D846CB00EF36E6 /* SettingBorderLineTableViewCell.swift in Sources */,
EE9B053529953A1200068503 /* FilterView.swift in Sources */,
57FFEDC128DD28090041719B /* CheckShareRegisterView.swift in Sources */,
23A86A5928C7321C00B073CB /* MainBannerTableViewCell.swift in Sources */,
571DADC2297BA41B0079CCD3 /* BaseHeaderView.swift in Sources */,
Expand Down
60 changes: 60 additions & 0 deletions Zatch/Global/Source/Component/FilterView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
//
// FilterView.swift
// Zatch
//
// Created by 박소윤 on 2023/02/09.
//

import Foundation


extension ZatchComponent{

class FilterView: BaseView{

var isActivate = false {
didSet{
isActivate ? setActivateState() : setNormalState()
}
}

private let stackView = UIStackView().then{
$0.spacing = 4
$0.axis = .horizontal
}
private let filterImage = UIImageView()
private let filterLabel = UILabel().then{
$0.text = "검색 필터"
$0.setTypoStyleWithSingleLine(typoStyle: .medium12)
}

override func style() {
setNormalState()
}

override func hierarchy() {
self.addSubview(stackView)
stackView.addArrangedSubview(filterImage)
stackView.addArrangedSubview(filterLabel)
}

override func layout() {
stackView.snp.makeConstraints{
$0.top.leading.trailing.bottom.equalToSuperview()
}
filterImage.snp.makeConstraints{
$0.width.height.equalTo(20)
}
}

private func setActivateState(){
filterImage.image = Image.searchFilter.withTintColor(.zatchPurple)
filterLabel.textColor = .zatchPurple
}

private func setNormalState(){
filterImage.image = Image.searchFilter.withTintColor(.black85)
filterLabel.textColor = .black85
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ extension CheckRegisterViewController: UICollectionViewDelegate, UICollectionVie
}

func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell{
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: ImageRegisterCollectionViewCell.cellIdentifier, for: indexPath)
let cell = collectionView.dequeueReusableCell(for: indexPath, cellType: ImageRegisterCollectionViewCell.self)
return cell
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ class DeleteImageDetailViewController: BaseViewController<EtcButtonHeaderView, I
var completion: (() -> Void)!

init(){
super.init(headerView: EtcButtonHeaderView(title: "삭제"), mainView: ImageDetailView())
super.init(headerView: EtcButtonHeaderView(title: "삭제"),
mainView: ImageDetailView())
}

required init?(coder: NSCoder) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,8 @@ extension ZatchRegisterFirstViewController: UITableViewDelegate, UITableViewData
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if(section == 0){
return 3
}else{
return isOpen ? 2 : 1
}
return isOpen ? 2 : 1
}

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
Expand All @@ -126,7 +125,7 @@ extension ZatchRegisterFirstViewController: UITableViewDelegate, UITableViewData
cell.navigationController = self.navigationController
return cell
default:
fatalError("index error")
return BaseTableViewCell()
}
}else{
switch indexPath.row {
Expand All @@ -138,10 +137,9 @@ extension ZatchRegisterFirstViewController: UITableViewDelegate, UITableViewData
case 1:
let cell = tableView.dequeueReusableCell(for: indexPath, cellType: FirstProductInfoTableView.self)
cell.viewController = self

return cell
default:
fatalError("index error")
return BaseTableViewCell()
}
}
}
Expand Down

0 comments on commit bd66001

Please sign in to comment.