Skip to content

Commit

Permalink
feat/#154- 프로필 등록 UI 등록
Browse files Browse the repository at this point in the history
프로필 UI 구현 완료
각 버튼 깡통버튼인 상태
default 프로필 png 등록시 이미지가 깨지길래 svg로 삽입
  • Loading branch information
hooni0918 committed Jul 10, 2024
1 parent 32d50bd commit 31a3ed0
Show file tree
Hide file tree
Showing 14 changed files with 96 additions and 40 deletions.
8 changes: 4 additions & 4 deletions KkuMulKum.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
/* Begin PBXBuildFile section */
782B406F2C3DBF93008B0CA7 /* ProfileViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 782B406E2C3DBF93008B0CA7 /* ProfileViewController.swift */; };
782B40722C3DBFA3008B0CA7 /* ProfileViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 782B40712C3DBFA3008B0CA7 /* ProfileViewModel.swift */; };
782B40752C3DBFBA008B0CA7 /* ProfileVIew.swift in Sources */ = {isa = PBXBuildFile; fileRef = 782B40742C3DBFBA008B0CA7 /* ProfileVIew.swift */; };
782B40752C3DBFBA008B0CA7 /* ProfileView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 782B40742C3DBFBA008B0CA7 /* ProfileView.swift */; };
782B407B2C3E395A008B0CA7 /* WelcomeVIew.swift in Sources */ = {isa = PBXBuildFile; fileRef = 782B407A2C3E395A008B0CA7 /* WelcomeVIew.swift */; };
782B407D2C3E3984008B0CA7 /* WelcomeViewcontroller.swift in Sources */ = {isa = PBXBuildFile; fileRef = 782B407C2C3E3984008B0CA7 /* WelcomeViewcontroller.swift */; };
782B407F2C3E44B7008B0CA7 /* WelcomeVIewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 782B407E2C3E44B7008B0CA7 /* WelcomeVIewModel.swift */; };
Expand Down Expand Up @@ -131,7 +131,7 @@
/* Begin PBXFileReference section */
782B406E2C3DBF93008B0CA7 /* ProfileViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileViewController.swift; sourceTree = "<group>"; };
782B40712C3DBFA3008B0CA7 /* ProfileViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileViewModel.swift; sourceTree = "<group>"; };
782B40742C3DBFBA008B0CA7 /* ProfileVIew.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileVIew.swift; sourceTree = "<group>"; };
782B40742C3DBFBA008B0CA7 /* ProfileView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileView.swift; sourceTree = "<group>"; };
782B407A2C3E395A008B0CA7 /* WelcomeVIew.swift */ = {isa = PBXFileReference; indentWidth = 5; lastKnownFileType = sourcecode.swift; path = WelcomeVIew.swift; sourceTree = "<group>"; };
782B407C2C3E3984008B0CA7 /* WelcomeViewcontroller.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WelcomeViewcontroller.swift; sourceTree = "<group>"; };
782B407E2C3E44B7008B0CA7 /* WelcomeVIewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WelcomeVIewModel.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -293,7 +293,7 @@
782B40732C3DBFA8008B0CA7 /* View */ = {
isa = PBXGroup;
children = (
782B40742C3DBFBA008B0CA7 /* ProfileVIew.swift */,
782B40742C3DBFBA008B0CA7 /* ProfileView.swift */,
);
path = View;
sourceTree = "<group>";
Expand Down Expand Up @@ -906,7 +906,7 @@
DD3072282C3C104D00416D9F /* ArrivalCompletionResponseModel.swift in Sources */,
DD3072242C3C0EB200416D9F /* MyPromiseReadyInfoRequestModel.swift in Sources */,
789873332C3D1A7B00435E96 /* LoginViewModel.swift in Sources */,
782B40752C3DBFBA008B0CA7 /* ProfileVIew.swift in Sources */,
782B40752C3DBFBA008B0CA7 /* ProfileView.swift in Sources */,
DED5DBEE2C34529A006ECE7E /* BaseView.swift in Sources */,
DE9E18802C3BA4AA00DB76B4 /* CustomButton.swift in Sources */,
DE254AB02C31195B00A4015E /* NSAttributedString+.swift in Sources */,
Expand Down
2 changes: 1 addition & 1 deletion KkuMulKum/Application/SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
) {
guard let windowScene = (scene as? UIWindowScene) else { return }
self.window = UIWindow(windowScene: windowScene)
self.window?.rootViewController = NicknameViewController()
self.window?.rootViewController = ProfileSetupViewController()
self.window?.makeKeyAndVisible()
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"images" : [
{
"filename" : "profileBasic.png",
"filename" : "Mask group.svg",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"filename" : "Mask group 1.svg",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"filename" : "Mask group 2.svg",
"idiom" : "universal",
"scale" : "3x"
}
Expand Down
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.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class NicknameViewController: BaseViewController, UITextFieldDelegate {
self?.nicknameView.characterCountLabel.text = count
}
}

private func setupActions() {
nicknameView.nicknameTextField.addTarget(self, action: #selector(textFieldDidChange(_:)), for: .editingChanged)
nicknameView.nextButton.addTarget(self, action: #selector(nextButtonTapped), for: .touchUpInside)
Expand All @@ -73,7 +73,9 @@ class NicknameViewController: BaseViewController, UITextFieldDelegate {
}

@objc private func nextButtonTapped() {
print("Next button tapped with nickname: \(viewModel.nickname.value)")
let name = viewModel.enteredName.value
let welcomeVC = WelcomeViewController(name: name)
present(welcomeVC, animated: true, completion: nil)
}

@objc private func dismissKeyboard() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,15 @@ class NicknameViewModel {
let errorMessage = ObservablePattern<String?>("")
let isNextButtonEnabled = ObservablePattern<Bool>(false)
let characterCount = ObservablePattern<String>("0/5")
let enteredName = ObservablePattern<String>("") //데이터 전송


private let nicknameRegex = "^[가-힣a-zA-Z0-9]{1,5}$"

func validateNickname(_ name: String) {
nickname.value = name
characterCount.value = "\(name.count)/5"
enteredName.value = name

if name.isEmpty {
nicknameState.value = .empty
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class ProfileSetupViewController: BaseViewController {
}

override func setupView() {
// 추가적인 UI 설정이 필요하다면 여기에 구현

}

override func setupAction() {
Expand All @@ -24,18 +24,19 @@ class ProfileSetupViewController: BaseViewController {
}

override func setupDelegate() {
// Delegate 설정이 필요하다면 여기에 구현

}

@objc private func confirmButtonTapped() {
// 확인 버튼 탭 시 동작 구현

}

@objc private func skipButtonTapped() {
// 건너뛰기 버튼 탭 시 동작 구현

}

@objc private func cameraButtonTapped() {
// 카메라 버튼 탭 시 동작 구현

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,40 +14,43 @@ class ProfileSetupView: BaseView {

let titleLabel = UILabel().then {
$0.text = "프로필 설정"
$0.font = .systemFont(ofSize: 18, weight: .medium)
$0.font = UIFont.pretendard(.body03)
$0.textAlignment = .center
}

let subtitleLabel = UILabel().then {
$0.text = "프로필을 설정해 주세요"
$0.font = .systemFont(ofSize: 16)
$0.font = UIFont.pretendard(.head01)
$0.textColor = .gray8
$0.textAlignment = .center
}

let profileImageView = UIImageView().then {
$0.image = UIImage(named: "defaultProfile")
$0.image = UIImage.imgProfile
$0.contentMode = .scaleAspectFit
$0.layer.cornerRadius = 50
$0.clipsToBounds = true
}

let cameraButton = UIButton().then {
$0.setImage(UIImage(systemName: "camera.fill"), for: .normal)
$0.setImage(UIImage.iconCamera, for: .normal)
$0.tintColor = .white
$0.backgroundColor = .lightGray
$0.layer.cornerRadius = 15
}

let skipButton = UIButton().then {
$0.setTitle("지금은 넘어가기", for: .normal)
$0.setTitleColor(.gray, for: .normal)
$0.titleLabel?.font = .systemFont(ofSize: 14)
$0.setTitleColor(.gray5, for: .normal)
$0.titleLabel?.font = UIFont.pretendard(.body05)

}

let confirmButton = UIButton().then {
$0.setTitle("확인", for: .normal)
$0.backgroundColor = .maincolor
$0.layer.cornerRadius = 8
$0.titleLabel?.font = UIFont.pretendard(.body03)

}

override func setupView() {
Expand All @@ -63,17 +66,18 @@ class ProfileSetupView: BaseView {

subtitleLabel.snp.makeConstraints {
$0.top.equalTo(titleLabel.snp.bottom).offset(20)
$0.centerX.equalToSuperview()
$0.leading.equalToSuperview().inset(20)
}

profileImageView.snp.makeConstraints {
$0.center.equalToSuperview()
$0.size.equalTo(100)
$0.top.equalTo(subtitleLabel.snp.bottom).offset(120)
$0.centerX.equalToSuperview()
$0.size.equalTo(150)
}

cameraButton.snp.makeConstraints {
$0.bottom.trailing.equalTo(profileImageView)
$0.size.equalTo(30)
$0.size.equalTo(42)
}

skipButton.snp.makeConstraints {
Expand All @@ -83,7 +87,7 @@ class ProfileSetupView: BaseView {

confirmButton.snp.makeConstraints {
$0.bottom.equalTo(safeAreaLayoutGuide).offset(-20)
$0.left.right.equalToSuperview().inset(20)
$0.leading.trailing.equalToSuperview().inset(20)
$0.height.equalTo(50)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,42 @@
import UIKit

class WelcomeViewController: BaseViewController {

private let welcomeView = WelcomeView()

init(name: String) {
super.init(nibName: nil, bundle: nil)
welcomeView.welcomeLabel.text = "\(name)님 반가워요!"
modalPresentationStyle = .overFullScreen
modalTransitionStyle = .crossDissolve
}

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

override func loadView() {
view = welcomeView
}

override func viewDidLoad() {
super.viewDidLoad()
setupView()
setupAction()
setupDelegate()
setupActions()
}

override func setupView() {
// 배경색상 설정
view.backgroundColor = .green2
welcomeView.backgroundColor = .green1
}

override func setupAction() {
welcomeView.confirmButton.addTarget(self,
action: #selector(confirmButtonTapped), for: .touchUpInside)
}

override func setupDelegate() {

private func setupActions() {
welcomeView.confirmButton.addTarget(self, action: #selector(confirmButtonTapped), for: .touchUpInside)
}

@objc private func confirmButtonTapped() {
print("확인 버튼이 탭되었습니다.")

// TODO: main화면으로 넘기기

print("Confirm button tapped")
}
}

0 comments on commit 31a3ed0

Please sign in to comment.