Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feat] 설정 뷰 만들기 #73

Merged
merged 3 commits into from
Jul 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions HealthFoodMe/HealthFoodMe.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@
EBF66B082872AF5B00DE0ED1 /* SampleEntity.swift in Sources */ = {isa = PBXBuildFile; fileRef = EBF66B072872AF5B00DE0ED1 /* SampleEntity.swift */; };
EBF66B0A2872B21F00DE0ED1 /* StringLiterals.swift in Sources */ = {isa = PBXBuildFile; fileRef = EBF66B092872B21F00DE0ED1 /* StringLiterals.swift */; };
EBF66B0C2872B4FE00DE0ED1 /* StoryboardLiterals.swift in Sources */ = {isa = PBXBuildFile; fileRef = EBF66B0B2872B4FE00DE0ED1 /* StoryboardLiterals.swift */; };
FD39FAD62880C63E00A01CDA /* Setting.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = FD39FAD52880C63E00A01CDA /* Setting.storyboard */; };
FD39FAD82880C69400A01CDA /* SettingVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD39FAD72880C69400A01CDA /* SettingVC.swift */; };
FD58291A287DC39A00CE62E8 /* mapContainerViewDelegateProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD582917287DC39A00CE62E8 /* mapContainerViewDelegateProxy.swift */; };
FD58291B287DC39A00CE62E8 /* mapContainerView + Reactive.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD582918287DC39A00CE62E8 /* mapContainerView + Reactive.swift */; };
FD58291C287DC39A00CE62E8 /* mapContainerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD582919287DC39A00CE62E8 /* mapContainerView.swift */; };
Expand Down Expand Up @@ -313,6 +315,8 @@
EBF66B092872B21F00DE0ED1 /* StringLiterals.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StringLiterals.swift; sourceTree = "<group>"; };
EBF66B0B2872B4FE00DE0ED1 /* StoryboardLiterals.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StoryboardLiterals.swift; sourceTree = "<group>"; };
F3FFC8B608A27EA9662A18AB /* Pods-HealthFoodMe.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-HealthFoodMe.release.xcconfig"; path = "Target Support Files/Pods-HealthFoodMe/Pods-HealthFoodMe.release.xcconfig"; sourceTree = "<group>"; };
FD39FAD52880C63E00A01CDA /* Setting.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Setting.storyboard; sourceTree = "<group>"; };
FD39FAD72880C69400A01CDA /* SettingVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingVC.swift; sourceTree = "<group>"; };
FD582917287DC39A00CE62E8 /* mapContainerViewDelegateProxy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = mapContainerViewDelegateProxy.swift; sourceTree = "<group>"; };
FD582918287DC39A00CE62E8 /* mapContainerView + Reactive.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "mapContainerView + Reactive.swift"; sourceTree = "<group>"; };
FD582919287DC39A00CE62E8 /* mapContainerView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = mapContainerView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1169,6 +1173,7 @@
EBF66A90287227F500DE0ED1 /* Presentation */ = {
isa = PBXGroup;
children = (
FD39FAD22880C62600A01CDA /* Setting */,
A93252AE287F2AD7001EDF50 /* Scrap */,
A9325272287D24CD001EDF50 /* Search */,
3BCC441A28745FA900661A12 /* Auth */,
Expand Down Expand Up @@ -1270,6 +1275,31 @@
path = Entity;
sourceTree = "<group>";
};
FD39FAD22880C62600A01CDA /* Setting */ = {
isa = PBXGroup;
children = (
FD39FAD42880C63100A01CDA /* VC */,
FD39FAD32880C62E00A01CDA /* Views */,
);
path = Setting;
sourceTree = "<group>";
};
FD39FAD32880C62E00A01CDA /* Views */ = {
isa = PBXGroup;
children = (
FD39FAD52880C63E00A01CDA /* Setting.storyboard */,
);
path = Views;
sourceTree = "<group>";
};
FD39FAD42880C63100A01CDA /* VC */ = {
isa = PBXGroup;
children = (
FD39FAD72880C69400A01CDA /* SettingVC.swift */,
);
path = VC;
sourceTree = "<group>";
};
FD924374288007E00034876B /* Views */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -1425,6 +1455,7 @@
695758B9287D7C0B00E36789 /* MenuTab.storyboard in Resources */,
3B0B25542876BBE400950539 /* NotoSansCJKkr-Regular.otf in Resources */,
3B089C4B287D877F00DA80B9 /* GodoB.otf in Resources */,
FD39FAD62880C63E00A01CDA /* Setting.storyboard in Resources */,
A938BB90287D222800B8DE07 /* MainDetail.storyboard in Resources */,
695758BD287DA4CD00E36789 /* ReviewWrite.storyboard in Resources */,
3BCC442028745FE500661A12 /* SocialLogin.storyboard in Resources */,
Expand Down Expand Up @@ -1579,6 +1610,7 @@
3BC01F84287EAE48006C2181 /* BlogReviewCVC.swift in Sources */,
EBF66ABD287227F500DE0ED1 /* UIDevice+.swift in Sources */,
EBF66AE1287227F500DE0ED1 /* BaseService.swift in Sources */,
FD39FAD82880C69400A01CDA /* SettingVC.swift in Sources */,
EBF66AE2287227F500DE0ED1 /* BaseRouter.swift in Sources */,
EBF66AE3287227F500DE0ED1 /* NetworkResult.swift in Sources */,
EB6A45262875C3A000749582 /* TabContainerCVC.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ protocol ModuleFactoryProtocol {

// MARK: - Scrap
func makeScrapVC() -> ScrapVC

// MARK: - Setting
func makeSettingVC() -> SettingVC
}

class ModuleFactory: ModuleFactoryProtocol {
Expand Down Expand Up @@ -99,6 +102,12 @@ class ModuleFactory: ModuleFactoryProtocol {

return vc
}

// MARK: - Setting
func makeSettingVC() -> SettingVC {
return SettingVC.controllerFromStoryboard(.setting)
}


// MARK: - Plan

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
}

guard let windowScene = (scene as? UIWindowScene) else { return }
let rootViewController = ModuleFactory.resolve().makeNicknameChangeVC()
let rootViewController = ModuleFactory.resolve().makeSettingVC()
let navigation = UINavigationController(rootViewController: rootViewController)
let window = UIWindow(windowScene: windowScene)
window.rootViewController = navigation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ enum Storyboards: String {
case hamburgerBar = "HamburgerBar"
case blogReviewTab = "BlogReviewTab"
case nicknameChange = "NicknameChange"
case setting = "Setting"
}

extension UIStoryboard {
Expand Down
10 changes: 10 additions & 0 deletions HealthFoodMe/HealthFoodMe/Global/Literals/StringLiterals.swift
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,14 @@ struct I18N {
static let dietStore = "다이어터도 즐길 수 있는 식당"
static let goScrap = "스크랩하러 가기"
}

struct Setting {
static let customerServiceTitle = "고객지원"
static let askButtonTitle = "문의하기"
static let userWithdrawalTitle = "회원탈퇴"
static let termsTitle = "약관 및 정책"
static let openSourceButtonTitle = "오픈 소스 정보"
static let naverMapTerms = "네이버 지도 법적 공지"
static let naverMapLicense = "네이버 지도 오픈 소스 라이선스"
}
}
212 changes: 212 additions & 0 deletions HealthFoodMe/HealthFoodMe/Presentation/Setting/VC/SettingVC.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,212 @@
//
// SettingVC.swift
// HealthFoodMe
//
// Created by 송지훈 on 2022/07/15.
//

import UIKit

class SettingVC: UIViewController {

// MARK: - Properties

// MARK: - UI Components

private var topTitleLabel: UILabel = {
let label = UILabel()
label.font = .NotoBold(size: 16)
label.text = I18N.Auth.ChangeNickname.headerTitle
label.textColor = UIColor.helfmeBlack
return label
}()

private lazy var backButton: UIButton = {
let button = UIButton()
button.setBackgroundImage(ImageLiterals.MainDetail.beforeIcon, for: .normal)
button.press { self.navigationController?.popViewController(animated: true) }
return button
}()

private lazy var headerDividerView: UIView = {
let dividerView = UIView()
dividerView.backgroundColor = UIColor.helfmeLineGray
return dividerView
}()

private lazy var customerServiceTitle: UILabel = {
let label = UILabel()
label.text = I18N.Setting.customerServiceTitle
label.font = .NotoRegular(size: 14)
label.textColor = UIColor.helfmeGray2
return label
}()

private lazy var askButton: UIButton = {
let button = UIButton()
button.setTitle(I18N.Setting.askButtonTitle, for: .normal)
button.setTitleColor(UIColor.helfmeBlack, for: .normal)
button.titleLabel?.font = .NotoRegular(size: 16)
button.contentHorizontalAlignment = .left
return button
}()

private lazy var withdrawalButton: UIButton = {
let button = UIButton()
button.setTitle(I18N.Setting.userWithdrawalTitle, for: .normal)
button.setTitleColor(UIColor.helfmeBlack, for: .normal)
button.titleLabel?.font = .NotoRegular(size: 16)
button.contentHorizontalAlignment = .left
return button
}()

private lazy var termsTitle: UILabel = {
let label = UILabel()
label.text = I18N.Setting.termsTitle
label.font = .NotoRegular(size: 14)
label.textColor = UIColor.helfmeGray2
return label
}()

private lazy var openSourceButton: UIButton = {
let button = UIButton()
button.setTitle(I18N.Setting.openSourceButtonTitle, for: .normal)
button.setTitleColor(UIColor.helfmeBlack, for: .normal)
button.titleLabel?.font = .NotoRegular(size: 16)
button.contentHorizontalAlignment = .left
return button
}()

private lazy var naverMapTermsButton: UIButton = {
let button = UIButton()
button.setTitle(I18N.Setting.naverMapTerms, for: .normal)
button.setTitleColor(UIColor.helfmeBlack, for: .normal)
button.titleLabel?.font = .NotoRegular(size: 16)
button.contentHorizontalAlignment = .left
return button
}()

private lazy var naverMapLicenseButton: UIButton = {
let button = UIButton()
button.setTitle(I18N.Setting.naverMapLicense, for: .normal)
button.setTitleColor(UIColor.helfmeBlack, for: .normal)
button.titleLabel?.font = .NotoRegular(size: 16)
button.contentHorizontalAlignment = .left
return button
}()


// MARK: - View Life Cycle

override func viewDidLoad() {
super.viewDidLoad()
setUI()
setLayout()
addButtonAction()
}
}

// MARK: - Methods

extension SettingVC {
private func setLayout() {
view.addSubviews(topTitleLabel, backButton, headerDividerView,
customerServiceTitle, askButton, withdrawalButton,
termsTitle, openSourceButton, naverMapTermsButton, naverMapLicenseButton)

topTitleLabel.snp.makeConstraints { make in
make.top.equalTo(view.safeAreaLayoutGuide).offset(14)
make.centerX.equalToSuperview()
make.height.equalTo(20)
}

backButton.snp.makeConstraints { make in
make.height.width.equalTo(24)
make.top.equalTo(view.safeAreaLayoutGuide).offset(12)
make.leading.equalToSuperview().offset(20)
}

headerDividerView.snp.makeConstraints { make in
make.top.equalTo(topTitleLabel.snp.bottom).offset(13)
make.leading.trailing.equalToSuperview()
make.height.equalTo(1)
}

customerServiceTitle.snp.makeConstraints { make in
make.top.equalTo(headerDividerView.snp.bottom).offset(32)
make.leading.equalToSuperview().offset(20)
make.height.equalTo(20)
}

askButton.snp.makeConstraints { make in
make.top.equalTo(customerServiceTitle.snp.bottom).offset(24)
make.leading.equalToSuperview().offset(20)
make.trailing.equalToSuperview().offset(-20)
make.height.equalTo(16)
}

withdrawalButton.snp.makeConstraints { make in
make.top.equalTo(askButton.snp.bottom).offset(36)
make.leading.equalToSuperview().offset(20)
make.trailing.equalToSuperview().offset(-20)
make.height.equalTo(16)
}

termsTitle.snp.makeConstraints { make in
make.top.equalTo(withdrawalButton.snp.bottom).offset(54)
make.leading.equalToSuperview().offset(20)
make.height.equalTo(20)
}

openSourceButton.snp.makeConstraints { make in
make.top.equalTo(termsTitle.snp.bottom).offset(24)
make.leading.equalToSuperview().offset(20)
make.trailing.equalToSuperview().offset(-20)
make.height.equalTo(16)
}

naverMapTermsButton.snp.makeConstraints { make in
make.top.equalTo(openSourceButton.snp.bottom).offset(36)
make.leading.equalToSuperview().offset(20)
make.trailing.equalToSuperview().offset(-20)
make.height.equalTo(16)
}

naverMapLicenseButton.snp.makeConstraints { make in
make.top.equalTo(naverMapTermsButton.snp.bottom).offset(36)
make.leading.equalToSuperview().offset(20)
make.trailing.equalToSuperview().offset(-20)
make.height.equalTo(16)
}
}

private func setUI() {
self.navigationController?.navigationBar.isHidden = true
}
}

// MARK: - Methods

extension SettingVC {
private func addButtonAction() {
askButton.press(animated: false) {
print("문의하기")
}

withdrawalButton.press(animated: false) {
print("회원탈퇴")
}

openSourceButton.press(animated: false) {
print("오픈 소스 정보")
}

naverMapTermsButton.press(animated: false) {
print("네이버 지도 법적 공지")
}

naverMapLicenseButton.press(animated: false) {
print("네이버 지도 라이선스")
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="20037" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="20020"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--SettingVC-->
<scene sceneID="s0d-6b-0kx">
<objects>
<viewController storyboardIdentifier="SettingVC" id="Y6W-OH-hqX" customClass="SettingVC" customModule="HealthFoodMe" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="5EZ-qb-Rvc">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<viewLayoutGuide key="safeArea" id="vDu-zF-Fre"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="Ief-a0-LHa" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-16" y="85"/>
</scene>
</scenes>
<resources>
<systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
</resources>
</document>
6 changes: 4 additions & 2 deletions HealthFoodMe/HealthFoodMe/Utils/buttonPress.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@ extension UIButton {
iOS13까지는 NSObject형태로 등록해서 처리하는 방식으로 분기처리합니다.
*/

func press(vibrate: Bool = false, for controlEvents: UIControl.Event = .touchUpInside, _ closure: @escaping() -> Void) {
func press(vibrate: Bool = false,
animated: Bool = true,
for controlEvents: UIControl.Event = .touchUpInside, _ closure: @escaping() -> Void) {
if #available(iOS 14.0, *) {
self.addAction(UIAction { _ in closure()
self.clickedAnimation(vibrate: vibrate)
if animated { self.clickedAnimation(vibrate: vibrate) }
}, for: controlEvents)
} else {
@objc class ClosureSleeve: NSObject {
Expand Down