Skip to content

Commit

Permalink
Merge pull request #226 from PLUB2022/feat/130-MyPage/Setting
Browse files Browse the repository at this point in the history
[FEAT] 설정 UI 작업
  • Loading branch information
soobin-k authored Mar 19, 2023
2 parents 557eae2 + 1b5d446 commit 932a81a
Show file tree
Hide file tree
Showing 9 changed files with 328 additions and 0 deletions.
31 changes: 31 additions & 0 deletions PLUB.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,9 @@
C346B4AA29B1079900884E4F /* FirebaseCrashlytics in Frameworks */ = {isa = PBXBuildFile; productRef = C346B4A929B1079900884E4F /* FirebaseCrashlytics */; };
C346B4AC29B1079900884E4F /* FirebaseMessaging in Frameworks */ = {isa = PBXBuildFile; productRef = C346B4AB29B1079900884E4F /* FirebaseMessaging */; };
C34C097029773860001AFF16 /* DateBottomSheetViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C34C096F29773860001AFF16 /* DateBottomSheetViewController.swift */; };
C34F047E29C7049400E5B67E /* SettingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C34F047D29C7049400E5B67E /* SettingViewController.swift */; };
C34F048129C70FB900E5B67E /* SettingDetailSubView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C34F048029C70FB900E5B67E /* SettingDetailSubView.swift */; };
C34F048429C715A800E5B67E /* SettingSubview.swift in Sources */ = {isa = PBXBuildFile; fileRef = C34F048329C715A800E5B67E /* SettingSubview.swift */; };
C34F048829C7203600E5B67E /* MeetingCreateSuccessViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C34F048729C7203500E5B67E /* MeetingCreateSuccessViewController.swift */; };
C34F07F3297DAFD900C91E90 /* AddQuestionTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = C34F07F2297DAFD900C91E90 /* AddQuestionTableViewCell.swift */; };
C34F07F5297DB1DC00C91E90 /* AddQuestionControl.swift in Sources */ = {isa = PBXBuildFile; fileRef = C34F07F4297DB1DC00C91E90 /* AddQuestionControl.swift */; };
Expand Down Expand Up @@ -535,6 +538,9 @@
C344E53E2986B938009F73A9 /* MeetingCategoryViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MeetingCategoryViewController.swift; sourceTree = "<group>"; };
C344E5402986B9D7009F73A9 /* MeetingCategoryViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MeetingCategoryViewModel.swift; sourceTree = "<group>"; };
C34C096F29773860001AFF16 /* DateBottomSheetViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DateBottomSheetViewController.swift; sourceTree = "<group>"; };
C34F047D29C7049400E5B67E /* SettingViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingViewController.swift; sourceTree = "<group>"; };
C34F048029C70FB900E5B67E /* SettingDetailSubView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingDetailSubView.swift; sourceTree = "<group>"; };
C34F048329C715A800E5B67E /* SettingSubview.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingSubview.swift; sourceTree = "<group>"; };
C34F048729C7203500E5B67E /* MeetingCreateSuccessViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MeetingCreateSuccessViewController.swift; sourceTree = "<group>"; };
C34F07F2297DAFD900C91E90 /* AddQuestionTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddQuestionTableViewCell.swift; sourceTree = "<group>"; };
C34F07F4297DB1DC00C91E90 /* AddQuestionControl.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddQuestionControl.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1324,6 +1330,10 @@
C3100CB529BD8A46005FCCAD /* MyPage */ = {
isa = PBXGroup;
children = (
C3100CBD29BD94DC005FCCAD /* Cell */,
C3100CBA29BD8A96005FCCAD /* Component */,
C34F047C29C7045100E5B67E /* Setting */,
C3100CB629BD8A5B005FCCAD /* MyPageViewController.swift */,
C3100CB829BD8A7E005FCCAD /* MyPageViewModel.swift */,
C3100CB629BD8A5B005FCCAD /* MyPageViewController.swift */,
C3100CBD29BD94DC005FCCAD /* Cell */,
Expand Down Expand Up @@ -1401,6 +1411,24 @@
path = ViewController;
sourceTree = "<group>";
};
C34F047C29C7045100E5B67E /* Setting */ = {
isa = PBXGroup;
children = (
C34F047D29C7049400E5B67E /* SettingViewController.swift */,
C34F047F29C70F7200E5B67E /* Component */,
);
path = Setting;
sourceTree = "<group>";
};
C34F047F29C70F7200E5B67E /* Component */ = {
isa = PBXGroup;
children = (
C34F048029C70FB900E5B67E /* SettingDetailSubView.swift */,
C34F048329C715A800E5B67E /* SettingSubview.swift */,
);
path = Component;
sourceTree = "<group>";
};
C34F71BF29798C11003DB376 /* Cell */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -1987,6 +2015,7 @@
70197B812955A68C000503F6 /* CategoryInfoListView.swift in Sources */,
70BD5F2C2963204D002CBA89 /* DetailRecruitmentViewController.swift in Sources */,
BAE0AC7629B5D67D00F46F3D /* BoardDetailViewController.swift in Sources */,
C34F048429C715A800E5B67E /* SettingSubview.swift in Sources */,
BA46CC9F28EC9B05004953B1 /* Ex+UIColor.swift in Sources */,
C39E09B629C604DE00ECAD11 /* RecruitingFooterView.swift in Sources */,
BA340E1629782207002BAF2C /* IntroduceTagCollectionViewCell.swift in Sources */,
Expand Down Expand Up @@ -2137,6 +2166,7 @@
C38D65622987F0990052013F /* CategoryHeaderView.swift in Sources */,
C3EB29CB29A91CC600615B6B /* MeetingScheduleViewModel.swift in Sources */,
70A420BE29914B690026E9F9 /* RecruitmentQuestionResponse.swift in Sources */,
C34F048129C70FB900E5B67E /* SettingDetailSubView.swift in Sources */,
C39E09B429C5F3C100ECAD11 /* MyPageNoneView.swift in Sources */,
BAE0AC7129B5D61800F46F3D /* BoardDetailCollectionViewCell.swift in Sources */,
705F81C329AFAA3B00830C4F /* BoardViewController.swift in Sources */,
Expand Down Expand Up @@ -2170,6 +2200,7 @@
C3AD265F296AD3C100C57370 /* InputTextView.swift in Sources */,
70A420A5298D01680026E9F9 /* SearchOutputHeaderView.swift in Sources */,
70A420832982F0360026E9F9 /* SearchInputViewController.swift in Sources */,
C34F047E29C7049400E5B67E /* SettingViewController.swift in Sources */,
BAE1AD972944C16600CE36B9 /* PolicyHeaderTableViewCell.swift in Sources */,
C3AB743D296B2181003DD5E2 /* MeetingPeopleNumberViewController.swift in Sources */,
C36CE39A297305E100E3A68C /* CreateMeetingTitleView.swift in Sources */,
Expand Down
23 changes: 23 additions & 0 deletions PLUB/Assets.xcassets/MyPage/arrowRightGray.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "arrowRightGray.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"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.
3 changes: 3 additions & 0 deletions PLUB/Sources/Views/MyPage/MyPageViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ extension MyPageViewController {

@objc
private func didTappedSettingButton() {
let vc = SettingViewController()
vc.hidesBottomBarWhenPushed = true
navigationController?.pushViewController(vc, animated: true)
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
//
// SettingDetailSubView.swift
// PLUB
//
// Created by 김수빈 on 2023/03/19.
//

import UIKit

import SnapKit
import RxCocoa
import RxSwift

final class SettingDetailSubView: UIView {
private let label = UILabel().then {
$0.font = .body1
$0.textColor = .black
}

private let arrowImageView = UIImageView().then {
$0.image = UIImage(named: "arrowRightGray")
}

private let lineView = UIView().then {
$0.backgroundColor = .lightGray
}

init(_ title: String, isLast: Bool = false) {
label.text = title
super.init(frame: .zero)
setupLayouts(isLast: isLast)
setupConstraints(isLast: isLast)
}

required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

private func setupLayouts(isLast: Bool) {
[label, arrowImageView].forEach {
addSubview($0)
}

if !isLast {
addSubview(lineView)
}
}

private func setupConstraints(isLast: Bool) {
label.snp.makeConstraints {
$0.leading.equalToSuperview().inset(12)
$0.centerY.equalToSuperview()
$0.height.equalTo(21)
$0.top.bottom.equalToSuperview().inset(8)
}

arrowImageView.snp.makeConstraints {
$0.trailing.equalToSuperview().inset(12)
$0.centerY.equalToSuperview()
$0.size.equalTo(20)
}

if !isLast {
lineView.snp.makeConstraints {
$0.leading.trailing.equalToSuperview().inset(10)
$0.bottom.equalToSuperview()
$0.height.equalTo(1)
}
}
}
}
44 changes: 44 additions & 0 deletions PLUB/Sources/Views/MyPage/Setting/Component/SettingSubview.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
//
// SettingSubview.swift
// PLUB
//
// Created by 김수빈 on 2023/03/19.
//

import UIKit

import SnapKit
import RxCocoa
import RxSwift

final class SettingSubview: UIView {
private let label = UILabel().then {
$0.font = .appFont(family: .pretendard(option: .bold), size: 18)
$0.textColor = .black
}

init(_ title: String) {
label.text = title
super.init(frame: .zero)
setupLayouts()
setupConstraints()
}

required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

private func setupLayouts() {
addSubview(label)
}

private func setupConstraints() {
label.snp.makeConstraints {
$0.leading.equalToSuperview().inset(12)
$0.centerY.equalToSuperview()
$0.height.equalTo(21)
$0.top.equalToSuperview().inset(19)
$0.bottom.equalToSuperview().inset(10)
}
}
}
156 changes: 156 additions & 0 deletions PLUB/Sources/Views/MyPage/Setting/SettingViewController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
//
// SettingViewController.swift
// PLUB
//
// Created by 김수빈 on 2023/03/19.
//

import UIKit

import RxSwift
import RxCocoa

enum SettingType: String, CaseIterable {
case use = "PLUB 이용"
case account = "계정"
case version = "버전"
}

enum SettingUseType: String, CaseIterable {
case notice = "공지사항"
case email = "이메일로 문의하기"
case qna = "Q&A"
case alarm = "알림 설정"
}

enum SettingAccountType: String, CaseIterable {
case logout = "로그아웃"
case inactive = "비활성화"
case withdraw = "탈퇴"
}

enum SettingVersionType: String, CaseIterable {
case termsOfService = "서비스 이용 약관"
case privacyPolicy = "개인정보 처리 방침"
}

final class SettingViewController: BaseViewController {

private let scrollView = UIScrollView().then {
$0.bounces = false
$0.showsVerticalScrollIndicator = false
}

private let contentStackView = UIStackView().then {
$0.axis = .vertical
$0.spacing = 16
$0.isLayoutMarginsRelativeArrangement = true
$0.layoutMargins = .init(top: 15, left: 0, bottom: 15, right: 0)
}

private let titleLabel = UILabel().then {
$0.text = "설정"
$0.font = .h2
}

override func viewDidLoad() {
super.viewDidLoad()
}

override func setupLayouts() {
super.setupLayouts()
[scrollView].forEach {
view.addSubview($0)
}
scrollView.addSubview(contentStackView)

contentStackView.addArrangedSubview(titleLabel)

SettingType.allCases.forEach {
let subStackView = UIStackView().then {
$0.axis = .vertical
$0.spacing = 0
$0.layer.cornerRadius = 10
$0.backgroundColor = .white
}
contentStackView.addArrangedSubview(subStackView)

let subView = SettingSubview($0.rawValue)
subStackView.addArrangedSubview(subView)
subView.snp.makeConstraints {
$0.height.equalTo(50)
}

addSubViews(stackView: subStackView, type: $0)
}
}

override func setupConstraints() {
super.setupConstraints()

scrollView.snp.makeConstraints {
$0.leading.trailing.equalToSuperview().inset(16)
$0.top.equalToSuperview()
$0.bottom.equalTo(view.safeAreaLayoutGuide)
}

contentStackView.snp.makeConstraints {
$0.directionalEdges.equalToSuperview()
$0.width.equalTo(scrollView.snp.width)
}

titleLabel.snp.makeConstraints {
$0.height.equalTo(33)
}

contentStackView.setCustomSpacing(32, after: titleLabel)
}

override func setupStyles() {
super.setupStyles()
setupNavigationBar()
}

private func addSubViews(stackView: UIStackView, type: SettingType) {
switch type {
case .use:
SettingUseType.allCases.forEach {
let detailSubview = SettingDetailSubView($0.rawValue)
stackView.addArrangedSubview(detailSubview)
detailSubview.snp.makeConstraints {
$0.height.equalTo(52)
}
}
case .account:
SettingAccountType.allCases.forEach {
let detailSubview = SettingDetailSubView($0.rawValue)
stackView.addArrangedSubview(detailSubview)
detailSubview.snp.makeConstraints {
$0.height.equalTo(52)
}
}
case .version:
SettingVersionType.allCases.forEach {
let detailSubview = SettingDetailSubView($0.rawValue)
stackView.addArrangedSubview(detailSubview)
detailSubview.snp.makeConstraints {
$0.height.equalTo(52)
}
}
}
}

private func setupNavigationBar() {
navigationItem.leftBarButtonItem = UIBarButtonItem(
image: UIImage(named: "backButton"),
style: .plain,
target: self,
action: #selector(didTappedBackButton)
)
}

@objc
private func didTappedBackButton() {
navigationController?.popViewController(animated: true)
}
}

0 comments on commit 932a81a

Please sign in to comment.