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

Second assignment #2

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
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
9 changes: 9 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## 🛠 Issue
<!-- 이슈에 대해 간략하게 설명해주세요 -->

## 📋 To-do
<!-- 진행할 작업에 대해 적어주세요 -->
- [ ] todo!



17 changes: 17 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# 🔥 Pull requests
## 🌴 작업한 브랜치
- # 이슈넘버 적어주세용

## ✅ 작업한 내용
- 작업한 내용 작성하세용

## 💁🏻‍♂️ 추가한 기능
- 추가한 기능 작성하세용

## 🧗🏻 추가할 기능
- 추가해야할 기능 작성하세용

## 📸 스크린샷
스크린샷 첨부해주세용

closed #이슈넘버 적어주세용
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# NOHHANSOL
# BaeSungho



![gitbanner_hansol](https://tva1.sinaimg.cn/large/e6c9d24egy1h6m86nwttxj22aj0hiabx.jpg)

![curri](https://tva1.sinaimg.cn/large/e6c9d24egy1h6m8g413dwj21hc0u0dja.jpg)

![gitbanner_sungho](https://user-images.githubusercontent.com/45239582/193579660-2944d5c1-81e1-4e8e-b91f-55528cc1f595.png)

![curri](https://tva1.sinaimg.cn/large/e6c9d24egy1h6m8g413dwj21hc0u0dja.jpg)
12 changes: 0 additions & 12 deletions first assignment/first assignment/MainAccount.swift

This file was deleted.

19 changes: 0 additions & 19 deletions first assignment/first assignment/ViewController.swift

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "Group 121.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Group 121@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Group 121@3x.png",
"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.
57 changes: 57 additions & 0 deletions first_assignment/first_assignment/CheckAccount.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
//
// CheckAccount.swift
// first assignment
//
// Created by saint on 2022/10/03.
//

import UIKit

class CheckAccount: UIViewController {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

보통 파일명과 클래스명의 끝부분에는 상속받는 클래스의 이름(UI 제외)을 붙여주는 것 같아요~! 이 뷰의 경우에는 CheckAccountViewController가 되겠네요


private let helloLabel: UILabel = {
let label = UILabel(frame: CGRect(x: 45, y: 300, width: 300, height: 60))
label.numberOfLines = 2
label.text = "000님\n환영합니다"
label.font = .systemFont(ofSize: 20, weight: .bold)
label.textColor = .black
label.textAlignment = .center
return label
}()

private let acceptButton: UIButton = {
let button = UIButton(frame: CGRect(x: 45, y: 415, width: 300, height: 40))
button.setTitle("확인", for: .normal)
button.setTitleColor(.black, for: .normal)
button.titleLabel?.font = .systemFont(ofSize: 16, weight: .bold)
button.backgroundColor = .systemYellow
button.addTarget(self, action: #selector(touchupOkayButton), for: .touchUpInside)
return button
}()

override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .white

let components: [Any] = [helloLabel, acceptButton]
components.forEach{
view.addSubview($0 as! UIView)
}
Comment on lines +34 to +39
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

viewDidLoad와 같은 생명주기 함수 내에서는 보통 메소드 호출을 해주는 것이 가독성에도 더 좋고 코드가 깔끔해진다고 생각합니다❗️개인적인 의견이니 참고만 해주세요 ~!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

넵~😄

}

func showText(email: String){
helloLabel.text = "당신의 선택은 \(email)였군요!"
}

@objc
private func touchupOkayButton(){
if self.navigationController == nil{
self.dismiss(animated: true, completion: nil)
}
else{
self.navigationController?.popViewController(animated: true)
}
}


}
23 changes: 23 additions & 0 deletions first_assignment/first_assignment/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
<false/>
<key>UISceneConfigurations</key>
<dict>
<key>UIWindowSceneSessionRoleApplication</key>
<array>
<dict>
<key>UISceneConfigurationName</key>
<string>Default Configuration</string>
<key>UISceneDelegateClassName</key>
<string>$(PRODUCT_MODULE_NAME).SceneDelegate</string>
</dict>
</array>
</dict>
</dict>
</dict>
</plist>
38 changes: 38 additions & 0 deletions first_assignment/first_assignment/KakaoCustomView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
//
// KakaoTextField.swift
// first_assignment
//
// Created by saint on 2022/10/03.
//

/// text field를 만들 때, 텍스트+밑줄을 한꺼번에 만드는 class
import UIKit

class KakaoCustomView: UIView {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

커스텀뷰 사용 너무 좋네요👍


let nameTextField: UITextField = {
let textField = UITextField(frame: CGRect(x: 0, y: 0, width: 300, height: 39))
return textField
}()

private let underLineView: UIView = {
let view = UIView(frame: CGRect(x: 0, y: 39, width: 300, height: 1))
view.backgroundColor = .systemGray4
return view
}()

override init(frame: CGRect) {
super.init(frame: frame)
[nameTextField, underLineView].forEach {
self.addSubview($0)
}
}

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

func dataBind(placeholder: String) {
nameTextField.placeholder = placeholder
}
}
105 changes: 105 additions & 0 deletions first_assignment/first_assignment/LoginMenu.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
//
// MainAccount.swift
// first assignment
//
// Created by saint on 2022/10/03.
//

import UIKit

class LoginMenu: UIViewController {

static let height : Int = 40

private let startLabel: UILabel = {
let label = UILabel(frame: CGRect(x: 90, y: 120, width: UIScreen.main.bounds.width - 60, height: 40))
label.text = "카카오톡을 시작합니다"
label.font = .systemFont(ofSize: 24, weight: .bold)
return label
}()

private let introLabel: UILabel = {

let label = UILabel(frame: CGRect(x: 45, y: 170, width: 300, height: 40 ))
label.numberOfLines = 2
label.text = "사용하던 카카오계정이 있다면\n이메일 또는 전화번호로 로그인해 주세요."
label.font = .systemFont(ofSize: 12, weight: .medium)
label.textColor = .systemGray
label.textAlignment = .center
return label
}()

private let emailPhoneTextField: KakaoCustomView = {
let textField = KakaoCustomView(frame: CGRect(x: 45, y: 250, width: 300, height: 40))
return textField
}()

private let passwordTextField: KakaoCustomView = {
let textField = KakaoCustomView(frame: CGRect(x: 45, y: 300, width: 300, height: 40))
return textField
}()

private func config(){
emailPhoneTextField.dataBind(placeholder: "이메일 또는 전화번호")
passwordTextField.dataBind(placeholder: "비밀번호")
}

private let loginButton: UIButton = {
let button = UIButton(frame: CGRect(x: 45, y: 365, width: 300, height: 40))
button.setTitle("카카오계정 로그인", for: .normal)
button.setTitleColor(.black, for: .normal)
button.titleLabel?.font = .systemFont(ofSize: 16)
button.backgroundColor = .systemGray5
button.addTarget(self, action: #selector(presentToCheckAccount), for: .touchUpInside)
return button
}()

private let newAccountButton: UIButton = {
let button = UIButton(frame: CGRect(x: 45, y: 415, width: 300, height: 40))
button.setTitle("새로운 카카오계정 만들기", for: .normal)
button.setTitleColor(.black, for: .normal)
button.titleLabel?.font = .systemFont(ofSize: 16)
button.backgroundColor = .systemGray5
//self는 어디서든 main class를 가리킨다.
button.addTarget(self, action: #selector(pushToNewAccount), for: .touchUpInside)
return button
}()

private let findAccountButton: UIButton = {
let button = UIButton(frame: CGRect(x: 45, y: 465, width: 300, height: 30))
button.setTitle("카카오계정 또는 비밀번호 찾기", for: .normal)
button.setTitleColor(.black, for: .normal)
button.titleLabel?.font = .systemFont(ofSize: 14)
return button
}()


override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .white
config()

let components: [Any] = [startLabel, introLabel, emailPhoneTextField, passwordTextField, loginButton, newAccountButton, findAccountButton]
components.forEach{
view.addSubview($0 as! UIView)
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

따로 빼셔도 좋을 것 같아용~!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

늦게 봤네용 좋은 의견 감사합니당 ☺️

}

@objc
private func pushToNewAccount(){
let na = NewAccount()
self.navigationController?.pushViewController(na, animated: true)
}

@objc
private func presentToCheckAccount(){
let ca = CheckAccount()
ca.modalPresentationStyle = .fullScreen
self.present(ca, animated: true, completion: nil) // animated : true -> 애니메이션을 보이게 하기; completion : 종료 후에 실행할 작업, closer 활용하기

if let answer = emailPhoneTextField.nameTextField.text{
ca.showText(email: answer)
}
}

}
Loading