Skip to content

Commit

Permalink
Merge pull request #164 from OMZigak/feat/157-group-create-ui
Browse files Browse the repository at this point in the history
[feat] 모임 추가 뷰 구현
  • Loading branch information
youz2me authored Jul 12, 2024
2 parents 623b0e5 + 1dc3f8b commit 48eb8d6
Show file tree
Hide file tree
Showing 19 changed files with 1,003 additions and 29 deletions.
188 changes: 188 additions & 0 deletions KkuMulKum.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "img_create_group.svg",
"idiom" : "universal"
}
],
"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.
35 changes: 35 additions & 0 deletions KkuMulKum/Resource/Base/BaseViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ class BaseViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()

view.backgroundColor = .white

setupView()
setupAction()
setupDelegate()
Expand All @@ -26,3 +28,36 @@ class BaseViewController: UIViewController {
/// RootView 또는 ViewController 자체로부터 Delegate, DateSource 등 설정
func setupDelegate() {}
}

extension BaseViewController {
/// 네비게이션 바 타이틀 설정
final func setupNavigationBarTitle(with string: String) {
title = string

navigationController?.navigationBar.titleTextAttributes = [
.foregroundColor: UIColor.gray8,
.font: UIFont.pretendard(.body03)
]
}

/// 네비게이션 바 BackButton 구성
final func setupNavigationBarBackButton() {
let backButton = UIBarButtonItem(
image: .iconBack,
style: .plain,
target: self,
action: #selector(backButtonDidTap)
).then {
$0.tintColor = .black
}

navigationItem.leftBarButtonItem = backButton
}
}

private extension BaseViewController {
@objc
func backButtonDidTap() {
navigationController?.popViewController(animated: true)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
//
// CheckInviteCodeView.swift
// KkuMulKum
//
// Created by YOUJIM on 7/11/24.
//

import UIKit

class CheckInviteCodeView: BaseView {
private let checkInviteLabel: UILabel = UILabel().then {
$0.setText("친구에게 받은\n모임 초대 코드가 있으신가요?", style: .head01, color: .gray8)
}

let enterInviteCodeView: JoinButtonView = JoinButtonView().then {
$0.setJoinButtonViewStatus(isReceived: true)
}

let createGroupView: JoinButtonView = JoinButtonView().then {
$0.setJoinButtonViewStatus(isReceived: false)
}

override func setupView() {
self.addSubviews(
checkInviteLabel,
enterInviteCodeView,
createGroupView
)
}

override func setupAutoLayout() {
let safeArea = safeAreaLayoutGuide

checkInviteLabel.snp.makeConstraints {
$0.top.equalTo(safeArea).offset(32)
$0.leading.equalToSuperview().offset(20)
}

enterInviteCodeView.snp.makeConstraints {
$0.top.equalTo(checkInviteLabel.snp.bottom).offset(24)
$0.leading.trailing.equalToSuperview().inset(20)
}

createGroupView.snp.makeConstraints {
$0.top.equalTo(enterInviteCodeView.snp.bottom).offset(12)
$0.leading.trailing.equalToSuperview().inset(20)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
//
// JoinButtonView.swift
// KkuMulKum
//
// Created by YOUJIM on 7/11/24.
//

import UIKit

class JoinButtonView: BaseView {
private let subTitleLabel: UILabel = UILabel().then {
$0.setText("subTitleLabel", style: .caption02, color: .gray5)
}

private let mainTitleLabel: UILabel = UILabel().then {
$0.setText("mainTitleLabel", style: .body03, color: .gray8)
}

private let chevronImageView: UIImageView = UIImageView().then {
$0.image = .iconRight.withTintColor(.gray3)
$0.contentMode = .scaleAspectFit
}

override func setupView() {
self.backgroundColor = .green1

self.addSubviews(
subTitleLabel,
mainTitleLabel,
chevronImageView
)
}

override func setupAutoLayout() {
subTitleLabel.snp.makeConstraints {
$0.top.equalToSuperview().offset(18)
$0.leading.equalToSuperview().offset(20)
}

mainTitleLabel.snp.makeConstraints {
$0.bottom.equalToSuperview().inset(18)
$0.leading.equalToSuperview().offset(20)
$0.top.equalTo(subTitleLabel.snp.bottom).offset(8)
}

chevronImageView.snp.makeConstraints {
$0.trailing.equalToSuperview().inset(17)
$0.centerY.equalToSuperview()
$0.height.equalTo(Screen.height(24))
$0.width.equalTo(chevronImageView.snp.height)
}
}

func setJoinButtonViewStatus(isReceived: Bool) {
if isReceived {
subTitleLabel.setText("초대 코드를 받았다면", style: .caption02, color: .gray5)
mainTitleLabel.setText("초대 코드 입력하기", style: .body03, color: .gray8)
}
else {
subTitleLabel.setText("초대 코드가 없다면", style: .caption02, color: .gray5)
mainTitleLabel.setText("직접 모임 추가하기", style: .body03, color: .gray8)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
//
// CheckInviteCodeViewController.swift
// KkuMulKum
//
// Created by YOUJIM on 7/11/24.
//

import UIKit

class CheckInviteCodeViewController: BaseViewController {
private let checkInviteCodeView: CheckInviteCodeView = CheckInviteCodeView()

override func loadView() {
view = checkInviteCodeView
}

override func setupView() {
view.backgroundColor = .white
self.tabBarController?.tabBar.isHidden = true

setupNavigationBarTitle(with: "내 모임 추가하기")
setupNavigationBarBackButton()
}

override func setupAction() {
checkInviteCodeView.enterInviteCodeView.addGestureRecognizer(UITapGestureRecognizer(
target: self,
action: #selector(inviteCodeViewDidTap)
))
checkInviteCodeView.createGroupView.addGestureRecognizer(UITapGestureRecognizer(
target: self,
action: #selector(createGroupViewDidTap)
))
}

@objc private func inviteCodeViewDidTap() {
let inviteCodeViewController = InviteCodeViewController()

inviteCodeViewController.modalTransitionStyle = .crossDissolve
inviteCodeViewController.modalPresentationStyle = .fullScreen

navigationController?.pushViewController(inviteCodeViewController, animated: true)
}

@objc private func createGroupViewDidTap() {
let createGroupViewController = CreateGroupViewController()

createGroupViewController.modalTransitionStyle = .crossDissolve
createGroupViewController.modalPresentationStyle = .fullScreen

navigationController?.pushViewController(createGroupViewController, animated: true)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// CreateGroupService.swift
// KkuMulKum
//
// Created by YOUJIM on 7/13/24.
//

import Foundation

protocol CreateGroupServiceType {

}

final class CreateGroupService: CreateGroupServiceType {

}

Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
//
// CreateGroupView.swift
// KkuMulKum
//
// Created by YOUJIM on 7/12/24.
//

import UIKit

class CreateGroupView: BaseView {
private let mainTitleLabel: UILabel = UILabel().then {
$0.setText("모임 이름을\n입력해 주세요", style: .head01)
}

let nameTextField: CustomTextField = CustomTextField(
placeHolder: "모임 이름을 입력해 주세요"
)

let characterLabel: UILabel = UILabel().then {
$0.setText("0/10", style: .body06, color: .gray3)
}

let presentButton: CustomButton = CustomButton(
title: "다음",
isEnabled: false
)

override func setupView() {
addSubviews(
mainTitleLabel,
nameTextField,
characterLabel,
presentButton
)
}

override func setupAutoLayout() {
mainTitleLabel.snp.makeConstraints {
$0.top.equalTo(safeAreaLayoutGuide).offset(32)
$0.leading.equalToSuperview().offset(20)
}

nameTextField.snp.makeConstraints {
$0.top.equalTo(mainTitleLabel.snp.bottom).offset(24)
$0.width.equalTo(CustomTextField.defaultWidth)
$0.height.equalTo(CustomTextField.defaultHeight)
$0.leading.equalTo(mainTitleLabel)
}

characterLabel.snp.makeConstraints {
$0.centerY.equalTo(nameTextField)
$0.trailing.equalTo(nameTextField.snp.trailing).inset(12)
}

presentButton.snp.makeConstraints {
$0.bottom.equalToSuperview().inset(50)
$0.horizontalEdges.equalToSuperview().inset(14)
$0.height.equalTo(Screen.height(50))
}
}
}
Loading

0 comments on commit 48eb8d6

Please sign in to comment.