Skip to content

Commit

Permalink
✨[FEAT] LoginVC UI 구현(#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
heerucan committed Oct 6, 2021
1 parent 478c534 commit 30ac352
Show file tree
Hide file tree
Showing 6 changed files with 161 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@
/* Begin PBXBuildFile section */
5B2B4621270B6CC90074B585 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B2B4620270B6CC90074B585 /* AppDelegate.swift */; };
5B2B4623270B6CC90074B585 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B2B4622270B6CC90074B585 /* SceneDelegate.swift */; };
5B2B4625270B6CC90074B585 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B2B4624270B6CC90074B585 /* ViewController.swift */; };
5B2B4625270B6CC90074B585 /* LoginVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B2B4624270B6CC90074B585 /* LoginVC.swift */; };
5B2B462A270B6CCC0074B585 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 5B2B4629270B6CCC0074B585 /* Assets.xcassets */; };
5B2B462D270B6CCC0074B585 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5B2B462B270B6CCC0074B585 /* LaunchScreen.storyboard */; };
5B2B463B270B744E0074B585 /* UIView + Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B2B463A270B744E0074B585 /* UIView + Extension.swift */; };
5B324483270E183700CD52D6 /* UITextField + Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B324482270E183700CD52D6 /* UITextField + Extension.swift */; };
5B324485270E1EDC00CD52D6 /* UIColor + Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B324484270E1EDC00CD52D6 /* UIColor + Extension.swift */; };
A1DB3182B180D8A44F60F25F /* Pods_Sopt29th_Assignment.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5F1FA1544DF3043971FE0FA5 /* Pods_Sopt29th_Assignment.framework */; };
/* End PBXBuildFile section */

Expand All @@ -22,12 +23,13 @@
5B2B461D270B6CC90074B585 /* Sopt29th-Assignment.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Sopt29th-Assignment.app"; sourceTree = BUILT_PRODUCTS_DIR; };
5B2B4620270B6CC90074B585 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
5B2B4622270B6CC90074B585 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
5B2B4624270B6CC90074B585 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
5B2B4624270B6CC90074B585 /* LoginVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginVC.swift; sourceTree = "<group>"; };
5B2B4629270B6CCC0074B585 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
5B2B462C270B6CCC0074B585 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
5B2B462E270B6CCC0074B585 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
5B2B463A270B744E0074B585 /* UIView + Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIView + Extension.swift"; sourceTree = "<group>"; };
5B324482270E183700CD52D6 /* UITextField + Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UITextField + Extension.swift"; sourceTree = "<group>"; };
5B324484270E1EDC00CD52D6 /* UIColor + Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIColor + Extension.swift"; sourceTree = "<group>"; };
5F1FA1544DF3043971FE0FA5 /* Pods_Sopt29th_Assignment.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Sopt29th_Assignment.framework; sourceTree = BUILT_PRODUCTS_DIR; };
CF5F82FDB012770AC2B155F7 /* Pods-Sopt29th-Assignment.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Sopt29th-Assignment.release.xcconfig"; path = "Target Support Files/Pods-Sopt29th-Assignment/Pods-Sopt29th-Assignment.release.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */
Expand Down Expand Up @@ -120,7 +122,7 @@
5B2B4638270B6D490074B585 /* View Controller */ = {
isa = PBXGroup;
children = (
5B2B4624270B6CC90074B585 /* ViewController.swift */,
5B2B4624270B6CC90074B585 /* LoginVC.swift */,
);
path = "View Controller";
sourceTree = "<group>";
Expand All @@ -130,6 +132,7 @@
children = (
5B2B463A270B744E0074B585 /* UIView + Extension.swift */,
5B324482270E183700CD52D6 /* UITextField + Extension.swift */,
5B324484270E1EDC00CD52D6 /* UIColor + Extension.swift */,
);
path = Extension;
sourceTree = "<group>";
Expand Down Expand Up @@ -258,7 +261,8 @@
files = (
5B2B463B270B744E0074B585 /* UIView + Extension.swift in Sources */,
5B324483270E183700CD52D6 /* UITextField + Extension.swift in Sources */,
5B2B4625270B6CC90074B585 /* ViewController.swift in Sources */,
5B2B4625270B6CC90074B585 /* LoginVC.swift in Sources */,
5B324485270E1EDC00CD52D6 /* UIColor + Extension.swift in Sources */,
5B2B4621270B6CC90074B585 /* AppDelegate.swift in Sources */,
5B2B4623270B6CC90074B585 /* SceneDelegate.swift in Sources */,
);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// UIColor + Extension.swift
// Sopt29th-Assignment
//
// Created by Thisisme Hi on 2021/10/07.
//

import UIKit

extension UIColor {
@nonobjc class var mainBlue: UIColor {
return UIColor(red: 66.0 / 255.0, green: 133.0 / 255.0, blue: 244.0 / 255.0, alpha: 1.0)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ extension UITextField {
self.font = .boldSystemFont(ofSize: 15)
self.backgroundColor = .white
self.borderStyle = .line
self.layer.borderWidth = 0.5
self.layer.borderWidth = 2
self.layer.borderColor = UIColor.lightGray.cgColor
self.layer.cornerRadius = 7
self.clipsToBounds = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
guard let windowScene = (scene as? UIWindowScene) else { return }
window = UIWindow(frame: windowScene.coordinateSpace.bounds)
window?.windowScene = windowScene
window?.rootViewController = ViewController()
window?.rootViewController = LoginVC()
window?.makeKeyAndVisible()
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
//
// LoginVC.swift
// Sopt29th-Assignment
//
// Created by Thisisme Hi on 2021/10/05.
//

import UIKit
import SnapKit
import Then

class LoginVC: UIViewController {
// MARK: - Properties
let logoLabel = UILabel().then {
$0.font = .boldSystemFont(ofSize: 50)
$0.textColor = .mainBlue
$0.text = "Google"
}

let loginLabel = UILabel().then {
$0.font = .boldSystemFont(ofSize: 35)
$0.textColor = .black
$0.text = "로그인"
}

let explainLabel = UILabel().then {
$0.font = .boldSystemFont(ofSize: 16)
$0.textColor = .lightGray
$0.numberOfLines = 0
$0.textAlignment = .center
$0.text = "YouTube도 이동하며 계속하세요. 앱 및 Safari에서도 Google 서비스에 로그인됩니다."
}

private lazy var fieldStackView = UIStackView().then {
$0.axis = .vertical
$0.alignment = .fill
$0.distribution = .fillEqually
$0.spacing = 20
$0.addArrangedSubview(nameTextField)
$0.addArrangedSubview(emailTextField)
$0.addArrangedSubview(pwTextField)
}

let nameTextField = UITextField().then {
$0.setTextField(placeholder: "이름을 입력해주세요", secure: false)
}

let emailTextField = UITextField().then {
$0.setTextField(placeholder: "이메일 또는 휴대전화", secure: false)
}

let pwTextField = UITextField().then {
$0.setTextField(placeholder: "비밀번호 입력", secure: true)
}

lazy var signUpButton = UIButton().then {
$0.setTitle("계정만들기", for: .normal)
$0.setTitleColor(.mainBlue, for: .normal)
$0.setTitleColor(.white, for: .highlighted)
$0.titleLabel?.font = .boldSystemFont(ofSize: 16)
$0.addTarget(self, action: #selector(touchUpSignUpButton(_:)), for: .touchUpInside)
}

lazy var signInButton = UIButton().then {
$0.setTitle("다음", for: .normal)
$0.setTitleColor(.white, for: .normal)
$0.titleLabel?.font = .boldSystemFont(ofSize: 18)
$0.backgroundColor = .mainBlue
$0.layer.cornerRadius = 10
$0.addTarget(self, action: #selector(touchUpSignInButton(_:)), for: .touchUpInside)
}

// MARK: - Lifecycle
override func viewDidLoad() {
super.viewDidLoad()
configUI()
setupAutoLayout()
}

// MARK: - Custom Method
func configUI() {
view.backgroundColor = .white
}

func setupAutoLayout() {
view.addSubviews([logoLabel, loginLabel, explainLabel,
fieldStackView, signUpButton, signInButton])

logoLabel.snp.makeConstraints { make in
make.top.equalTo(self.view.safeAreaLayoutGuide.snp.top).inset(20)
make.centerX.equalToSuperview()
}

loginLabel.snp.makeConstraints { make in
make.top.equalTo(logoLabel.snp.bottom).offset(15)
make.centerX.equalToSuperview()
}

explainLabel.snp.makeConstraints { make in
make.top.equalTo(loginLabel.snp.bottom).offset(35)
make.leading.trailing.equalToSuperview().inset(30)
make.centerX.equalToSuperview()
}

nameTextField.snp.makeConstraints { make in
make.height.equalTo(60)
}

fieldStackView.snp.makeConstraints { make in
make.top.equalTo(explainLabel.snp.bottom).offset(35)
make.leading.trailing.equalToSuperview().inset(30)
make.centerX.equalToSuperview()
}

signUpButton.snp.makeConstraints { make in
make.top.equalTo(fieldStackView.snp.bottom).offset(110)
make.leading.equalToSuperview().inset(30)
}

signInButton.snp.makeConstraints { make in
make.trailing.equalToSuperview().inset(30)
make.centerY.equalTo(signUpButton.snp.centerY)
make.width.equalTo(80)
make.height.equalTo(50)
}
}

// MARK: - @objc
@objc func touchUpSignUpButton(_ sender: UIButton) {

}

@objc func touchUpSignInButton(_ sender: UIButton) {

}
}

This file was deleted.

0 comments on commit 30ac352

Please sign in to comment.