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

[3주차] 기본과제 구현 #9

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
99b9d7a
[Feat] ButtonBuilder패턴 생성 (+도무지 빌더패턴 왜쓰는지 모르겠음) #8
meltsplit Apr 22, 2023
98093a1
[Chore] 오타수정 #8
meltsplit Apr 22, 2023
f12c682
[Feat] 순환LinkedList 통해 문자열 전환 기능 구현 #8
meltsplit Apr 22, 2023
4d3a5d0
[Feat] Node에 prev 추가 #8
meltsplit Apr 23, 2023
332c4ec
[Chore] Font, Color Extension 변수 및 메소드 class -> static 으로 변경 #8
meltsplit Apr 23, 2023
4f5cc4b
[Chore] 폴더링 및 코드 일부 수정 #8
meltsplit Apr 27, 2023
c3a085f
[Add] 이메일 정규식 추가 #10
meltsplit Apr 27, 2023
5e188ff
[Add] Observer 패턴 추가 #10
meltsplit Apr 27, 2023
0c06cd7
[Refactor] MVVM 패턴으로 이메일 형식, 비밀번호 형식 유효할때 로그인버튼 활성화 #10
meltsplit Apr 27, 2023
04297b6
[Feat] email, password 값에 따른 에러 핸들링 구현 #10
meltsplit Apr 27, 2023
b665a3d
[Chore] AuthTextField 클로저 -> authDelegate 방식으로 변경 #10
meltsplit Apr 27, 2023
1a6df01
[Chore] Error 메세지 AuthError enum 내부 프로퍼티로 선언 #10
meltsplit Apr 27, 2023
104ca3b
[Feat] TextField Return 버튼 누를시 UX 개선 #10
meltsplit Apr 27, 2023
7340e32
[Conflict] 파일복구 #8
meltsplit Apr 28, 2023
865df23
[Conflict] 파일복구2 복붙하기 #8
meltsplit Apr 28, 2023
0b08662
[Feat] 헤더뷰 구현 #8
meltsplit Apr 28, 2023
d532961
[Feat] 마이페이지 UI구현 #8
meltsplit Apr 28, 2023
3d0336b
[Chore] 주석 제거 및 코드 수정 #8
meltsplit Apr 28, 2023
43a2fa7
[Git] gitignore 수정 및 프로젝트 파일 추가 #8
meltsplit May 3, 2023
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
34 changes: 27 additions & 7 deletions SOPTving/SOPTving/Presentation/MainScene/VC/MainVC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,25 @@ final class MainVC: UIViewController {

//MARK: - Properties

private var name: String? {
var mainTitle: String? {
didSet {
updateUI()
}
}

private var data: [String] = ["처음", "중간", "마지막"]

private var currentNode : Node<String>? {
didSet{ mainTitle = currentNode?.data }
}
private var dataLinkedList = LinkedList<String>()

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.

캐로우셀에 적용시키려니까 너무 어렵네여으 ㅠㅜ 그냥 배열로 할까봐요...


//MARK: - UI Components

private let profileLabel: UILabel = {
let label = UILabel()
label.font = .tvingSemiBold(ofSize: 20)
label.text = "gd"
label.text = "asdf"
label.textColor = .white
return label
}()
Expand All @@ -34,7 +41,7 @@ final class MainVC: UIViewController {
.setTitle("다음으로",
color: .white,
font: .tvingSemiBold(ofSize: 16))
.setBackGroundColor(.systemBlue)
.setBackgroundColor(.systemBlue)
.setCornerRadius(12)
.setAction { [weak self] _ in
self?.nextButtonDidTap()
Expand All @@ -49,6 +56,17 @@ final class MainVC: UIViewController {
style()
hierarchy()
layout()

}

override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)

}

override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
setData()
}

}
Expand All @@ -58,13 +76,15 @@ final class MainVC: UIViewController {
extension MainVC {

private func updateUI() {
profileLabel.text = name
profileLabel.text = mainTitle
}


//MARK: Public

public func dataBind(_ text: String) {
self.name = text
private func setData() {
dataLinkedList.append(data: data)
currentNode = dataLinkedList.getFirstNode()
}

}
Expand All @@ -73,7 +93,7 @@ extension MainVC {

extension MainVC {
func nextButtonDidTap() {

currentNode = currentNode?.next
}
}

Expand Down
38 changes: 38 additions & 0 deletions SOPTving/SOPTving/Utility/DataStructure/LinkedList.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,41 @@
//

import Foundation

final class LinkedList<T> {
private var head: Node<T>?
private var tail: Node<T>?

var isEmpty: Bool {
return head == nil
}

func append(data: T?) {
let newNode = Node(data)

if isEmpty {
head = newNode
tail = newNode
tail?.next = head
} else {
tail?.next = newNode
tail = newNode
tail?.next = head
}
}

// append 인자에 배열을 넣었을 경우, append(T)를 반복한다.
func append(data: [T]?) {
guard let data else { return }
for t in data {
append(data: t)
}
}

func getFirstNode() -> Node<T>? {
return head
}



}
10 changes: 10 additions & 0 deletions SOPTving/SOPTving/Utility/DataStructure/Node.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,13 @@
//

import Foundation

final class Node<T> {
var data: T?
var next: Node?

init(_ data: T?, next: Node? = nil) {
self.data = data
self.next = next
}
}