Skip to content

Commit

Permalink
✨ Feat: #11 - 메인 로그인 화면 UI구성
Browse files Browse the repository at this point in the history
  • Loading branch information
usa4060 committed Oct 25, 2023
1 parent b5a378c commit b32155d
Show file tree
Hide file tree
Showing 21 changed files with 358 additions and 27 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"images" : [
{
"filename" : "appstore.png",
"filename" : "1024.png",
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
Expand Down
Binary file not shown.
Binary file modified CMC/Resources/Assets.xcassets/Splash.imageset/Splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified CMC/Resources/Assets.xcassets/Splash.imageset/[email protected]
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.
23 changes: 23 additions & 0 deletions CMC/Resources/Assets.xcassets/SplashLogo.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "Group 38564.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Group [email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Group [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.
23 changes: 23 additions & 0 deletions CMC/Resources/Assets.xcassets/SplashTitle.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "SplashTitle.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.
51 changes: 27 additions & 24 deletions CMC/Resources/Launch Screen.storyboard
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13142" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="22155" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<device id="retina6_12" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12042"/>
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22131"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
Expand All @@ -12,37 +13,39 @@
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Copyright © 2023 com.centralMakeusChallenge. All rights reserved." textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="obG-Y5-kRd">
<rect key="frame" x="0.0" y="626.5" width="375" height="20.5"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="CMC" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="GJd-Yh-RWb">
<rect key="frame" x="0.0" y="202" width="375" height="43"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="36"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="Splash" translatesAutoresizingMaskIntoConstraints="NO" id="2Zr-nJ-231">
<rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
</imageView>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="SplashLogo" translatesAutoresizingMaskIntoConstraints="NO" id="DqD-Xk-OQH">
<rect key="frame" x="142.66666666666666" y="372" width="108" height="108"/>
<constraints>
<constraint firstAttribute="width" constant="108" id="hUM-cl-a1T"/>
<constraint firstAttribute="height" constant="108" id="uvH-u2-lZc"/>
</constraints>
</imageView>
</subviews>
<viewLayoutGuide key="safeArea" id="Bcu-3y-fUS"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="Bcu-3y-fUS" firstAttribute="centerX" secondItem="obG-Y5-kRd" secondAttribute="centerX" id="5cz-MP-9tL"/>
<constraint firstItem="Bcu-3y-fUS" firstAttribute="centerX" secondItem="GJd-Yh-RWb" secondAttribute="centerX" id="Q3B-4B-g5h"/>
<constraint firstItem="obG-Y5-kRd" firstAttribute="leading" secondItem="Bcu-3y-fUS" secondAttribute="leading" constant="20" symbolic="YES" id="SfN-ll-jLj"/>
<constraint firstAttribute="bottom" secondItem="obG-Y5-kRd" secondAttribute="bottom" constant="20" id="Y44-ml-fuU"/>
<constraint firstItem="GJd-Yh-RWb" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="bottom" multiplier="1/3" constant="1" id="moa-c2-u7t"/>
<constraint firstItem="GJd-Yh-RWb" firstAttribute="leading" secondItem="Bcu-3y-fUS" secondAttribute="leading" constant="20" symbolic="YES" id="x7j-FC-K8j"/>
<constraint firstItem="Bcu-3y-fUS" firstAttribute="trailing" secondItem="2Zr-nJ-231" secondAttribute="trailing" id="4e5-gJ-tka"/>
<constraint firstItem="DqD-Xk-OQH" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="centerY" id="57i-Cu-fXs"/>
<constraint firstAttribute="bottom" secondItem="2Zr-nJ-231" secondAttribute="bottom" id="E9e-Z0-jqD"/>
<constraint firstItem="DqD-Xk-OQH" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="LKW-BF-YGD"/>
<constraint firstItem="2Zr-nJ-231" firstAttribute="leading" secondItem="Bcu-3y-fUS" secondAttribute="leading" id="a8m-hc-0Pe"/>
<constraint firstItem="2Zr-nJ-231" firstAttribute="top" secondItem="Ze5-6b-2t3" secondAttribute="top" id="sME-ry-0yf"/>
</constraints>
<viewLayoutGuide key="safeArea" id="Bcu-3y-fUS"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
</scene>
</scenes>
<resources>
<image name="Splash" width="375" height="812"/>
<image name="SplashLogo" width="115.66666412353516" height="119.66666412353516"/>
</resources>
</document>
7 changes: 6 additions & 1 deletion CMC/Sources/App/AppCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@ class AppCoordinator: CoordinatorType {
guard let self = self else {return}
switch state{
case .auth:
print("🍎 여기 들어가면, 메인 로그인 화면으로~ 🍎")
let authCoordinator = AuthCoordinator(
navigationController: self.navigationController
)
authCoordinator.delegate = self
authCoordinator.start()
self.childCoordinators.append(authCoordinator)
case .tabBar:
print("🍎 여기 들어가면, 메인 탭 화면으로~ 🍎")
}
Expand Down
13 changes: 13 additions & 0 deletions CMC/Sources/App/Splash/SplashViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ class SplashViewController: BaseViewController {
return imageView
}()

private lazy var splashLogoImageView: UIImageView = {
let imageView = UIImageView()
imageView.image = CMCAsset.splashLogo.image
imageView.contentMode = .scaleAspectFill
return imageView
}()

private let viewModel: SplashViewModel

init(
Expand All @@ -30,12 +37,18 @@ class SplashViewController: BaseViewController {

override func setAddSubView() {
view.addSubview(splashImageView)
view.addSubview(splashLogoImageView)
}

override func setConstraint() {
splashImageView.snp.makeConstraints { make in
make.edges.equalToSuperview()
}

splashLogoImageView.snp.makeConstraints { make in
make.centerX.centerY.equalToSuperview()
make.width.height.equalTo(108)
}
}

override func bind() {
Expand Down
95 changes: 95 additions & 0 deletions CMC/Sources/Presenter/Auth/Coordinators/AuthCoordinator.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
//
// AuthCoordinator.swift
// CMC
//
// Created by Siri on 10/25/23.
// Copyright © 2023 com.centralMakeusChallenge. All rights reserved.
//

import RxCocoa
import RxSwift
import UIKit

class AuthCoordinator: CoordinatorType {
// MARK: - Navigation DEPTH 1 -
enum AuthCoordinatorChild{
case main
case emailSignUp
case emailSignIn
/// SignIn이 AuthHome의 역할
}

// MARK: - Need To Initializing
var disposeBag: DisposeBag
var navigationController: UINavigationController

// MARK: - Don't Need To Initializing
var childCoordinators: [CoordinatorType] = []
var delegate: CoordinatorDelegate?
var userActionState: PublishRelay<AuthCoordinatorChild> = PublishRelay()
/// init에서만 호출하고, stream을 유지하기위해 BehaviorSubject 사용

init(
navigationController: UINavigationController
){
self.navigationController = navigationController
self.disposeBag = DisposeBag()
self.setState()
}

func setState() {
self.userActionState
.subscribe(onNext: { [weak self] state in
guard let self = self else {return}
switch state{
case .main:
let mainAuthViewController = MainAuthViewController(
viewModel: MainAuthViewModel(
coordinator: self
)
)
if self.navigationController.viewControllers.contains(where: {$0 is MainAuthViewController}) {
self.navigationController.popViewController(animated: true)
}else {
self.pushViewController(viewController: mainAuthViewController)
}
case .emailSignUp:
CMCToastManager.shared.addToast(message: "🍎 여기는 아직이지롱~ 😀")
// let emailSignUpViewController = EmailSignUpViewController(
// viewModel: EmailSignUpViewModel(
// coordinator: self,
// userSignUpUsecase: DefaultUserSignUpUsecase(
// userRepository: DefaultUserRepository()
// )
// )
// )
// if self.navigationController.viewControllers.contains(where: {$0 is EmailSignUpViewController}) {
// self.navigationController.popViewController(animated: true)
// }else {
// self.pushViewController(viewController: emailSignUpViewController)
// }
case .emailSignIn:
CMCToastManager.shared.addToast(message: "🍎 여기도 아직이지롱~ 😀")
// let emailSignInViewController = EmailSignInViewController(
// viewModel: EmailSignInViewModel(
// coordinator: self,
// userEmailSignInUsecase: DefaultUserEmailSignInUsecase(
// userRepository: DefaultUserRepository()
// )
// )
// )
// if self.navigationController.viewControllers.contains(where: {$0 is EmailSignInViewController}) {
// self.navigationController.popViewController(animated: true)
// }else {
// self.pushViewController(viewController: emailSignInViewController)
// }
}

}).disposed(by: disposeBag)
}

func start() {
self.userActionState.accept(.main)
}

}
119 changes: 119 additions & 0 deletions CMC/Sources/Presenter/Auth/MainAuthViewController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
//
// MainAuthViewController.swift
// CMC
//
// Created by Siri on 10/25/23.
// Copyright © 2023 com.centralMakeusChallenge. All rights reserved.
//

import Foundation

import RxCocoa
import RxSwift

import DesignSystem
import SnapKit

import UIKit

class MainAuthViewController: BaseViewController {

// MARK: - UI

private lazy var backgroundImageView: UIImageView = {
let imageView = UIImageView()
imageView.image = CMCAsset.splash.image
return imageView
}()

private lazy var mainTitle: UIImageView = {
let label = UIImageView()
label.image = CMCAsset.splashTitle.image
return label
}()

private lazy var mainLogo: UIImageView = {
let imageView = UIImageView()
imageView.image = CMCAsset.splashLogo.image
return imageView
}()

private lazy var signInButton: CMCButton = {
let button = CMCButton(
isRound: false,
type: .login(.inactive),
title: "로그인"
)
return button
}()

private lazy var signUpButton: CMCButton = {
let button = CMCButton(
isRound: false,
type: .login(.clear),
title: "회원가입"
)
return button
}()

// MARK: - Properties
private let viewModel: MainAuthViewModel

// MARK: - Initializers
init(
viewModel: MainAuthViewModel
) {
self.viewModel = viewModel
super.init()
}

// MARK: - LifeCycle
override func viewDidLoad() {
super.viewDidLoad()
}

// MARK: - Methods

override func setAddSubView() {
self.view.addSubview(backgroundImageView)
backgroundImageView.addSubview(mainTitle)
backgroundImageView.addSubview(mainLogo)
backgroundImageView.addSubview(signInButton)
backgroundImageView.addSubview(signUpButton)
}

override func setConstraint() {
backgroundImageView.snp.makeConstraints { make in
make.edges.equalToSuperview()
}

mainTitle.snp.makeConstraints { make in
make.leading.equalToSuperview().offset(44)
make.trailing.equalToSuperview().offset(-44)
make.top.equalToSuperview().offset(180)
}

mainLogo.snp.makeConstraints { make in
make.centerX.equalToSuperview()
make.top.equalTo(mainTitle.snp.bottom).offset(60)
make.width.height.equalTo(108)
}

signInButton.snp.makeConstraints { make in
make.leading.equalToSuperview().offset(24)
make.trailing.equalToSuperview().offset(-24)
make.height.equalTo(56)
make.top.equalTo(mainLogo.snp.bottom).offset(84)
}

signUpButton.snp.makeConstraints { make in
make.leading.trailing.equalTo(signInButton)
make.height.equalTo(56)
make.top.equalTo(signInButton.snp.bottom).offset(28)
}

}

override func bind() {
}
}
Loading

0 comments on commit b32155d

Please sign in to comment.