Skip to content

Commit

Permalink
[#1] ~7/29 작업상황: 게시글 tableview, location filter button tap action
Browse files Browse the repository at this point in the history
  • Loading branch information
hamgui-2022 committed Jul 30, 2023
1 parent 9422299 commit db98868
Show file tree
Hide file tree
Showing 12 changed files with 972 additions and 8 deletions.
Binary file modified .DS_Store
Binary file not shown.
31 changes: 28 additions & 3 deletions MOGAK.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
objects = {

/* Begin PBXBuildFile section */
652C05DA2A73AB34004CE9C4 /* LocationFilterTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 652C05D92A73AB34004CE9C4 /* LocationFilterTableViewCell.swift */; };
652C05DC2A7404B4004CE9C4 /* Data.swift in Sources */ = {isa = PBXBuildFile; fileRef = 652C05DB2A7404B4004CE9C4 /* Data.swift */; };
652C05DE2A740667004CE9C4 /* LocationFilterSheetView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 652C05DD2A740667004CE9C4 /* LocationFilterSheetView.swift */; };
656A53E02A74F06B00A527A1 /* CategoryFilterCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 656A53DF2A74F06B00A527A1 /* CategoryFilterCollectionViewCell.swift */; };
6582BDE72A6A786200C87FDE /* NetworkingFeedTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6582BDE62A6A786200C87FDE /* NetworkingFeedTableViewCell.swift */; };
9C2EF7E52A63CE0600E8C8F4 /* ListTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9C2EF7E42A63CE0600E8C8F4 /* ListTableViewCell.swift */; };
9C638AAE2A46C6AA002AB791 /* NetworkService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9C638AAD2A46C6AA002AB791 /* NetworkService.swift */; };
9C638AB02A46DC75002AB791 /* KeyChainService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9C638AAF2A46DC75002AB791 /* KeyChainService.swift */; };
Expand Down Expand Up @@ -52,6 +57,11 @@
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
652C05D92A73AB34004CE9C4 /* LocationFilterTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocationFilterTableViewCell.swift; sourceTree = "<group>"; };
652C05DB2A7404B4004CE9C4 /* Data.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Data.swift; sourceTree = "<group>"; };
652C05DD2A740667004CE9C4 /* LocationFilterSheetView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocationFilterSheetView.swift; sourceTree = "<group>"; };
656A53DF2A74F06B00A527A1 /* CategoryFilterCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CategoryFilterCollectionViewCell.swift; sourceTree = "<group>"; };
6582BDE62A6A786200C87FDE /* NetworkingFeedTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkingFeedTableViewCell.swift; sourceTree = "<group>"; };
98EE4B11BFA59DE1943DE4F3 /* Pods-MOGAK.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MOGAK.release.xcconfig"; path = "Target Support Files/Pods-MOGAK/Pods-MOGAK.release.xcconfig"; sourceTree = "<group>"; };
9C2EF7E42A63CE0600E8C8F4 /* ListTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListTableViewCell.swift; sourceTree = "<group>"; };
9C638AAD2A46C6AA002AB791 /* NetworkService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkService.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -143,6 +153,11 @@
isa = PBXGroup;
children = (
9CFA7D232A45915B003E80A7 /* NetworkingViewController.swift */,
6582BDE62A6A786200C87FDE /* NetworkingFeedTableViewCell.swift */,
652C05D92A73AB34004CE9C4 /* LocationFilterTableViewCell.swift */,
652C05DB2A7404B4004CE9C4 /* Data.swift */,
652C05DD2A740667004CE9C4 /* LocationFilterSheetView.swift */,
656A53DF2A74F06B00A527A1 /* CategoryFilterCollectionViewCell.swift */,
);
path = Networking;
sourceTree = "<group>";
Expand Down Expand Up @@ -447,8 +462,10 @@
9CFA7D222A4590F9003E80A7 /* ScheduleListViewController.swift in Sources */,
9CE426FA2A5FE50F001629DC /* UITextField+Ext.swift in Sources */,
9CFA7D092A458109003E80A7 /* ScheduleStartViewController.swift in Sources */,
652C05DE2A740667004CE9C4 /* LocationFilterSheetView.swift in Sources */,
9CFA7D1C2A458CCC003E80A7 /* UIColor+Ext.swift in Sources */,
9CE426C52A59573F001629DC /* UserDefaults+Ext.swift in Sources */,
652C05DC2A7404B4004CE9C4 /* Data.swift in Sources */,
9CFA7D262A4591AB003E80A7 /* ScheduleReportViewController.swift in Sources */,
9CE426C32A594C47001629DC /* LoginViewController.swift in Sources */,
9CE426EC2A5AA9B0001629DC /* MOGAKAPI.swift in Sources */,
Expand All @@ -457,8 +474,11 @@
9CFA7D052A458109003E80A7 /* AppDelegate.swift in Sources */,
9CFA7D202A458E89003E80A7 /* TabBarViewController.swift in Sources */,
9CE426F62A5EA04F001629DC /* NameCell.swift in Sources */,
652C05DA2A73AB34004CE9C4 /* LocationFilterTableViewCell.swift in Sources */,
6582BDE72A6A786200C87FDE /* NetworkingFeedTableViewCell.swift in Sources */,
9CE426DA2A59C559001629DC /* AppGuideViewController.swift in Sources */,
9C638AB82A46E66A002AB791 /* AccountRequest.swift in Sources */,
656A53E02A74F06B00A527A1 /* CategoryFilterCollectionViewCell.swift in Sources */,
9C2EF7E52A63CE0600E8C8F4 /* ListTableViewCell.swift in Sources */,
9C638ABA2A46E686002AB791 /* AccountResponse.swift in Sources */,
9CE426E92A5A3A58001629DC /* ViewController3.swift in Sources */,
Expand Down Expand Up @@ -608,9 +628,12 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = MOGAK/MOGAK.entitlements;
CODE_SIGN_STYLE = Automatic;
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = YL7ZX6U88Y;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = YL7ZX6U88Y;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = MOGAK/Info.plist;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
Expand All @@ -625,6 +648,8 @@
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.kanghyun.MOGAK;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = MOgak_Development;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
Expand All @@ -643,7 +668,7 @@
CODE_SIGN_ENTITLEMENTS = MOGAK/MOGAK.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = YL7ZX6U88Y;
DEVELOPMENT_TEAM = L597NTA7LF;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = MOGAK/Info.plist;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
Expand Down
21 changes: 21 additions & 0 deletions MOGAK/Assets.xcassets/MOGAK_button.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "MOGAK_icon.svg",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
11 changes: 11 additions & 0 deletions MOGAK/Assets.xcassets/MOGAK_button.imageset/MOGAK_icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions MOGAK/Assets.xcassets/MOGAK_button_filled.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "MOGAK_button_filled.svg",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"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.
44 changes: 44 additions & 0 deletions MOGAK/Scene/Networking/CategoryFilterCollectionViewCell.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
//
// CategoryFilterCollectionViewCell.swift
// MOGAK
//
// Created by 이재혁 on 2023/07/29.
//

import UIKit

class CategoryFilterCollectionViewCell: UICollectionViewCell {

let categoryButton: UIButton = {
let button = UIButton()
// 버튼의 스타일과 다른 설정들을 지정합니다.
// ...
return button
}()

override init(frame: CGRect) {
super.init(frame: frame)
//setupButtonConstraints()
}

required init?(coder: NSCoder) {
super.init(coder: coder)
//setupButtonConstraints()
}

private lazy var locationFilterButton: UIButton = {
let button = UIButton()
button.titleLabel?.font = UIFont.pretendard(.semiBold, size: 14)
button.setTitle("", for: .normal)
button.setTitleColor(UIColor(hex: "24252E"), for: .normal)
//button.tintColor = UIColor(hex: "F1F3FA")
button.backgroundColor = UIColor(hex: "F1F3FA")
button.layer.cornerRadius = 20
button.contentEdgeInsets = UIEdgeInsets(top: 8, left: 20, bottom: 8, right: 20)

//button.addTarget(self, action: #selector(showLocationFilterSheetView(_:)), for: .touchUpInside)

return button
}()

}
57 changes: 57 additions & 0 deletions MOGAK/Scene/Networking/Data.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
//
// Locations.swift
// MOGAK
//
// Created by 이재혁 on 2023/07/28.
//

import Foundation

struct Locations {
var location: String
}

struct Categories {
var category: String
}

extension Locations {
static var data = [
Locations(location: "서울특별시"),
Locations(location: "경기도"),
Locations(location: "세종특별자치시"),
Locations(location: "대전광역시"),
Locations(location: "광주광역시"),
Locations(location: "대구광역시"),
Locations(location: "부산광역시"),
Locations(location: "울산광역시"),
Locations(location: "경상남도"),
Locations(location: "경상북도"),
Locations(location: "전라남도"),
Locations(location: "전라북도"),
Locations(location: "충청남도"),
Locations(location: "충청북도"),
Locations(location: "강원도"),
Locations(location: "제주도"),
Locations(location: "독도/울릉도")

]
}

extension Categories {
static var data = [
Categories(category: "전체"),
Categories(category: "자격증"),
Categories(category: "대외활동"),
Categories(category: "운동"),
Categories(category: "인사이트"),
Categories(category: "공모전"),
Categories(category: "직무공부"),
Categories(category: "산업분석"),
Categories(category: "강연/강의"),
Categories(category: "어학"),
Categories(category: "프로젝트"),
Categories(category: "스터디"),
Categories(category: "기타"),
]
}
96 changes: 96 additions & 0 deletions MOGAK/Scene/Networking/LocationFilterSheetView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
//
// LocationFilterSheetView.swift
// MOGAK
//
// Created by 이재혁 on 2023/07/28.
//

import UIKit
import SnapKit

class LocationFilterSheetView: UIViewController, UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
dataSource.count
}

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
//let cell = tableView.dequeueReusableCell(withIdentifier: "LocationFilterTableViewCell", for: indexPath) as! LocationFilterTableViewCell
guard let cell = tableView.dequeueReusableCell(withIdentifier: "LocationFilterTableViewCell") as? LocationFilterTableViewCell else {return UITableViewCell()}

let target = dataSource[indexPath.row]

cell.locationLabel.text = "\(target.location)"

return cell
}

func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 45
}

// cell 클릭 시 이벤트(콘솔 출력)
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let target = dataSource[indexPath.row]
print("\(target.location)")
}

lazy var tableView: UITableView = {
let view = UITableView()
view.register(LocationFilterTableViewCell.self, forCellReuseIdentifier: "LocationFilterTableViewCell")
view.delegate = self
view.dataSource = self

return view
}()

var dataSource = Locations.data

override func viewDidLoad() {
super.viewDidLoad()

view.backgroundColor = .systemBackground

//tableView.register(UINib(nibName: "LocationFilterTableViewCell", bundle: nil), forCellReuseIdentifier: "LocationFilterTableViewCell")

setupSheet()

view.addSubview(tableView)
tableView.translatesAutoresizingMaskIntoConstraints = false
tableView.snp.makeConstraints({
$0.top.equalTo(view.snp.top).offset(80)
$0.leading.trailing.equalTo(view).inset(20)
$0.bottom.equalTo(view.snp.bottom).offset(14)
})


}

private func setupSheet() {
//isModalInPresentation = true : sheet가 dismiss되지 않음!!! default는 false

if let sheet = sheetPresentationController {
/// 드래그 멈추면 그 위치에 멈추는 지점: default는 large()
//sheet.detents = [.medium(), .large()]
if #available(iOS 16.0, *) {
sheet.detents = [.custom { context in
return context.maximumDetentValue * 0.8
}
]
} else {
// Fallback on earlier versions
}
/// 초기화 드래그 위치
sheet.selectedDetentIdentifier = .medium
/// sheet
//sheet.largestUndimmedDetentIdentifier = .medium -> 이게 배경색 흐려지게 하는거였다.. 왜그런진 모르겠다
///
sheet.prefersGrabberVisible = true
///
sheet.delegate = self
///
sheet.presentingViewController.navigationController?.setNavigationBarHidden(true, animated: false)

}
}
}

Loading

0 comments on commit db98868

Please sign in to comment.