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

➕[ADD] 4차 세미나 프로젝트 추가 (#7) #8

Closed
wants to merge 11 commits into from
Closed
Show file tree
Hide file tree
Changes from 8 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
Binary file not shown.
Binary file added 29th-iOS-week4-homework/.Podfile.swp
Binary file not shown.

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?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>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?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>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//
// VideoContentDataModel.swift
// 29th-iOS-week3-homework
//
// Created by 임주민 on 2021/10/29.
//

import UIKit

struct VideoContentData{
let videoName: String
let description: String
}

struct YoutuberData {
let youtuberName: String
let youtuberImageName: String

func makeYoutuberImage() -> UIImage? {
return UIImage(named: youtuberImageName)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
//
// CheckViewController.swift
// 29th-iOS-week2-homework
//
// Created by 임주민 on 2021/10/20.
//

import UIKit

class CheckViewController: UIViewController {

// MARK: - Vars & Lets Part

var message: String?

// MARK: - UI Component Part

@IBOutlet weak var showNameLabel: UILabel!

// MARK: - Life Cycle Part
override func viewDidLoad() {
super.viewDidLoad()
Comment on lines +20 to +22
Copy link
Member

Choose a reason for hiding this comment

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

여기 컨벤션 지켜서 빈 줄 하나 추가해주세요.

setNameInLabel()
}

// MARK: - IBAction Part

@IBAction func touchUpOkayButton(_ sender: Any) {
guard let nextVC = self.storyboard?.instantiateViewController(withIdentifier: "CustomTabBarController") as? CustomTabBarController
else {return}
Copy link
Member

Choose a reason for hiding this comment

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

{ return } 이라고 컨벤션 맞춰주면 좋겠습니다.. 컨벤션무새가 되어버린 나..


nextVC.modalPresentationStyle = .fullScreen
nextVC.modalTransitionStyle = .crossDissolve

self.present(nextVC, animated: true, completion: nil)
}

// MARK: - Custom Method Part

func setNameInLabel() {
if let name = message {
showNameLabel.text = "\(name)님\n환영합니다!"
showNameLabel.sizeToFit()
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
//
// CustomTabBarController.swift
// 29th-iOS-week2-homework
//
// Created by 임주민 on 2021/10/19.
//

import UIKit

class CustomTabBarController: UITabBarController {

// MARK: - Life Cycle Part

override func viewDidLoad() {
super.viewDidLoad()
setTabBar()
self.tabBar.tintColor = .black
self.tabBar.unselectedItemTintColor = .gray
Comment on lines +17 to +18
Copy link
Member

Choose a reason for hiding this comment

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

생명주기에 함수만 넣어주쇼랑

}

// MARK: - Custom Method Part

func setTabBar() {
guard let homeVC = self.storyboard?.instantiateViewController(identifier: "HomeVC"),
let shortsVC = self.storyboard?.instantiateViewController(identifier: "ShortsVC"),
let plusVC = self.storyboard?.instantiateViewController(identifier: "PlusVC"),
let subscriptionVC = self.storyboard?.instantiateViewController(identifier: "SubscriptionVC"),
let libraryVC = self.storyboard?.instantiateViewController(identifier: "LibraryVC")
else {return}

homeVC.tabBarItem.title="홈"
homeVC.tabBarItem.image=UIImage(named: "homeIconFill")
homeVC.tabBarItem.selectedImage = UIImage(named: "homeIcon")
shortsVC.tabBarItem.title="shorts"
shortsVC.tabBarItem.image=UIImage(named: "shortsIcon")
shortsVC.tabBarItem.selectedImage=UIImage(named: "shortsIconFill")
plusVC.tabBarItem.title="추가"
plusVC.tabBarItem.image=UIImage(named: "plueCircleIcon")
plusVC.tabBarItem.selectedImage=UIImage(named: "plueCircleIcon")
subscriptionVC.tabBarItem.title="구독"
subscriptionVC.tabBarItem.image=UIImage(named: "subscriptionsIcon")
subscriptionVC.tabBarItem.selectedImage=UIImage(named: "subscriptionIconsFill")
libraryVC.tabBarItem.title="저장"
libraryVC.tabBarItem.image=UIImage(named: "LibraryIcon")
libraryVC.tabBarItem.selectedImage=UIImage(named: "LibraryIconFill")
Comment on lines +31 to +45
Copy link
Member

Choose a reason for hiding this comment

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

= 여기 양 사이드로도 공백 하나씩 해서 맞춰주세요~!


setViewControllers([homeVC, shortsVC, plusVC, subscriptionVC, libraryVC], animated: true)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// HomeVC.swift
// 29th-iOS-week2-homework
//
// Created by 임주민 on 2021/10/19.
//

import UIKit

class HomeVC: UIViewController {

override func viewDidLoad() {
super.viewDidLoad()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// LibraryVC.swift
// 29th-iOS-week2-homework
//
// Created by 임주민 on 2021/10/19.
//

import UIKit

class LibraryVC: UIViewController {

override func viewDidLoad() {
super.viewDidLoad()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// NavigationViewController.swift
// 29th-iOS-week4-homework
//
// Created by 임주민 on 2021/11/14.
//

import UIKit

class NavigationViewController: UINavigationController {

override func viewDidLoad() {
super.viewDidLoad()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// PlusVC.swift
// 29th-iOS-week2-homework
//
// Created by 임주민 on 2021/10/19.
//

import UIKit

class PlusVC: UIViewController {

override func viewDidLoad() {
super.viewDidLoad()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// ShortsVC.swift
// 29th-iOS-week2-homework
//
// Created by 임주민 on 2021/10/19.
//

import UIKit

class ShortsVC: UIViewController {

override func viewDidLoad() {
super.viewDidLoad()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
//
// SignInViewController.swift
// 29th-iOS-week2-homework
//
// Created by 임주민 on 2021/10/20.
//

import UIKit

class SignInViewController: UIViewController, UITextFieldDelegate {

// MARK: - UI Component Part

@IBOutlet weak var nameTextField: UITextField!
@IBOutlet weak var emailTextField: UITextField!
@IBOutlet weak var pwdTextField: UITextField!
@IBOutlet weak var nextButton: UIButton!

// MARK: - Life Cycle Part

override func viewDidLoad() {
super.viewDidLoad()
nameTextField.delegate = self
}

// MARK: - IBAction Part

@IBAction func touchUpNextButton(_ sender: Any) {
requestLogin()
}

@IBAction func touchUpSignUpButton(_ sender: Any) {
guard let nextVC = self.storyboard?.instantiateViewController(withIdentifier: "SignUpViewController")
else {return}

[nameTextField,emailTextField,pwdTextField].forEach{
$0.text?.removeAll()
}

self.navigationController?.pushViewController(nextVC, animated: true)
}

@IBAction func myExit(sender: UIStoryboardSegue) {
}

// MARK: - Custom Method Part

override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?){
self.view.endEditing(true)
}

func textFieldShouldReturn(_ textField: UITextField) -> Bool {
if textField == self.nameTextField {
textField.resignFirstResponder()
self.emailTextField.becomeFirstResponder()
}
else if textField == self.emailTextField {
textField.resignFirstResponder()
self.pwdTextField.becomeFirstResponder()
}
textField.resignFirstResponder()
return true
}

func simpleAlert(message: String) {
let alert = UIAlertController(title: "로그인", message: message, preferredStyle: .alert)
if message == "로그인 성공" {
let okAction = UIAlertAction(title: "확인", style: .default) {(action) in
self.goToCheckView() }
alert.addAction(okAction)
present(alert, animated: true)
} else {
let okAction = UIAlertAction(title: "확인", style: .default)
alert.addAction(okAction)
present(alert, animated: true)
}
Comment on lines +67 to +76
Copy link
Member

Choose a reason for hiding this comment

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

성공할 때만 self.goToCheckView() 해준 거 잘했는데 그 외의 중복되는 건 따로 빼주면 좋을 거 가텅

}

func goToCheckView() {
guard let nextVC = self.storyboard?.instantiateViewController(withIdentifier: "CheckViewController") as? CheckViewController
else {return}

nextVC.message = nameTextField.text
nextVC.modalPresentationStyle = .fullScreen
nextVC.modalTransitionStyle = .crossDissolve

[nameTextField,emailTextField,pwdTextField].forEach{
$0.text?.removeAll()
}

self.present(nextVC, animated: true, completion: nil)
}
}

// MARK: - Extension Part

extension SignInViewController {
func requestLogin() {
UserSignService.shared.login(email: emailTextField.text ?? "" ,
name: nameTextField.text ?? "",
password: pwdTextField.text ?? "") { responseData in
switch responseData {
case .success(let loginResponse):
guard let response = loginResponse as? LoginResponseData else {return}
self.simpleAlert(message: response.message)
case .requestErr(let loginResponse):
guard let message = loginResponse as? String else { return }
self.simpleAlert(message: message)
case .pathErr:
print("pathErr")
case .serverErr:
print("serverErr")
case .networkFail:
print("networkFail")
}
}
}
}
Loading