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차 세미나 과제 (기본 과제 + 심화과제) - MainPage, MyPage #3

Open
wants to merge 23 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
d86e722
[3차 세미나 과제] - 플로우 + 데이터 세팅, 에셋 추가
yeahh315 Apr 24, 2023
9798c6e
[3차 세미나 과제] - BaseVC 추가, 에셋 추가
yeahh315 Apr 25, 2023
0f76ee6
[3차 세미나 과제] - TableView 구현중 (Section O - Header, Footer X)
yeahh315 Apr 25, 2023
b5e73e2
[3차 세미나 과제] - Header 구현중
yeahh315 Apr 26, 2023
58b3064
[3차 세미나 과제] - 마이 페이지 구현 완료 (코드 수정 필요)
yeahh315 Apr 27, 2023
87fae86
[3차 세미나 과제] - delete 임시파일
yeahh315 Apr 27, 2023
56142c1
[3차 세미나 과제] - 기본 과제 구현 완료 (플로우까지)
yeahh315 Apr 27, 2023
dd636f2
[3차 세미나 과제] - 심화과제 에셋 추가
yeahh315 Apr 28, 2023
20a6715
[2차 세미나 과제] - 심화과제 구현중 (Paging, topbar 아직 X)
yeahh315 May 1, 2023
c670bb2
[2차 세미나 과제] - 심화과제 구현중 (Paging, topbar 아직 X)
yeahh315 May 1, 2023
61db677
[2차 세미나 과제] - 심화과제 구현중 (Paging, topbar 아직 X)
yeahh315 May 1, 2023
6dd3133
[3차 세미나 과제] - 심화 과제 (paging 구현 - 오류 존재)
yeahh315 May 2, 2023
9d0867c
[3차 세미나 과제] - paging 구현 완료
yeahh315 May 2, 2023
5e1064e
[3차 세미나 과제] - 구조 변경
yeahh315 May 2, 2023
da7231f
[3차 세미나 과제] - 심화과제 PagingVC 구현중
yeahh315 May 3, 2023
444f26b
[3차 세미나 과제] - 심화과제 PagingVC 구현중
yeahh315 May 3, 2023
2fa51fb
[3차 세미나 과제] - 폴더링 수정
yeahh315 May 3, 2023
8a7e084
[3차 세미나 과제] - 심화과제 구현 완료
yeahh315 May 3, 2023
e492624
[3차 세미나 과제] - 심화과제 구현 완료 (코드 정리 필요)
yeahh315 May 3, 2023
8ebe930
[3차 세미나 과제] - 코드 수정
yeahh315 May 4, 2023
5da2836
[3차 세미나 과제] - 코드 수정 (함수로 따로 빼줌)
yeahh315 May 4, 2023
9b37a2c
[3차 세미나 과제] - 사소한 수정사항
yeahh315 May 11, 2023
cdce2f4
[3차 세미나 과제] - 불필요한 파일 삭제
yeahh315 May 11, 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
272 changes: 258 additions & 14 deletions GO_SOPT_Seminar_Assignment.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,13 @@
<integer>1</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>6B5944F829F5BE000087A4C3</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>
18 changes: 13 additions & 5 deletions GO_SOPT_Seminar_Assignment/Base.lproj/LaunchScreen.storyboard
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" 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="21507" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_12" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21505"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
Expand All @@ -11,15 +14,20 @@
<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"/>
<color key="backgroundColor" xcode11CocoaTouchSystemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
</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>
<systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
</resources>
</document>
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
//
// Contents.swift
// GO_SOPT_Seminar_Assignment
//
// Created by 김다예 on 2023/04/29.
//

import UIKit

struct Contents {
let image: UIImage
var name: String? = nil
var subName: String? = nil
let sectionNum: Int
}

extension Contents {
static func dummy() -> [[Contents]] {
let contents = [[Contents(image: .main1, sectionNum: 0),
Contents(image: .main2, sectionNum: 0),
Contents(image: .main3, sectionNum: 0),
Contents(image: .main4, sectionNum: 0)],
[Contents(image: .loardOfTheKingPoster, name: "반지의 제왕", sectionNum: 1),
Contents(image: .signalPoster, name: "시그널", sectionNum: 1),
Contents(image: .harryPotterPoster, name: "해리포터", sectionNum: 1),
Contents(image: .suzumePoster, name: "스즈메의 문단속", sectionNum: 1),
Contents(image: .mtPoster, name: "청춘MT", sectionNum: 1)],
[Contents(image: .banner1, sectionNum: 3),
Contents(image: .banner2, sectionNum: 3),
Contents(image: .banner3, sectionNum: 3)],
[Contents(image: .live1, name: "tvN Show", subName: "신서유기5 10화\n24.3%", sectionNum: 4),
Contents(image: .live2, name: "JTBC", subName: "JTBC 뉴스\n10.7%", sectionNum: 4),
Contents(image: .live3, name: "tvN", subName: "부산 촌놈 3화\n7.4%", sectionNum: 4)],
[Contents(image: .paramount1, name: "그리스: 라이즈 오브 핑크 레이디스", sectionNum: 5),
Contents(image: .paramount2, name: "옐로우재킷 시즌2", sectionNum: 5),
Contents(image: .paramount3, name: "래빗홀", sectionNum: 5),
Contents(image: .paramount4, name: "메이어 오브 킹스타운", sectionNum: 5),
Contents(image: .paramount5, name: "1923", sectionNum: 5)]]

return contents
}
Copy link

Choose a reason for hiding this comment

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

우와 정리 깔끔하네여.. 진짜 깔끔 다예...


static func sectionName() -> [String] {
return ["", "티빙에서 꼭 봐야하는 콘텐츠", "", "인기 LIVE 채널", "파라마운트+의 따끈한 신작"]
}

static func sectionLayout() -> [String] {
return ["Header", "Normal", "Banner", "Live", "Normal"]
}
}

Choose a reason for hiding this comment

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

오 저도 이거 이렇게 정리해둬야겠다고 생각하고 있었는데 먼저 해두셨군요 🤩
참고하겠습니다 ^__^

Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
//
// MainViewSection.swift
// GO_SOPT_Seminar_Assignment
//
// Created by 김다예 on 2023/05/01.
//

import UIKit

@frozen
enum ContentsSectionLayout: String {

case header = "Header"
case normal = "Normal"
case live = "Live"
case banner = "Banner"

var itemSize: NSCollectionLayoutSize {

Choose a reason for hiding this comment

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

hoxy NSCollectionLayoutSize 가 뭔지 알려주실 수 있나요?!
사용하는건 처음 보는 것 같아서유 !!

switch self {
case .header:
return NSCollectionLayoutSize(widthDimension: .fractionalWidth(1.0) ,heightDimension: .absolute(520))
case .normal:
return NSCollectionLayoutSize(widthDimension: .absolute(98) ,heightDimension: .absolute(160))
case .live:
return NSCollectionLayoutSize(widthDimension: .absolute(160) ,heightDimension: .absolute(140))
case .banner:
return NSCollectionLayoutSize(widthDimension: .absolute(300) ,heightDimension: .absolute(100))
}
}

var interGroupSpacing: CGFloat {
switch self {
case .header:
return 0
default:
return 10
}
}
Comment on lines +31 to +38

Choose a reason for hiding this comment

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

움 .header 를 제외한 다른 모든 경우라 default 를 쓰신 것 같은데
가독성을 위해 아래와 같이 하면 어떨까요??!

Suggested change
var interGroupSpacing: CGFloat {
switch self {
case .header:
return 0
default:
return 10
}
}
var interGroupSpacing: CGFloat {
switch self {
case .header:
return 0
case .normal, .live, .banner:
return 10
}
}

완전 개인 취향인 것 같아서 편하신대로 해도 될 것 같긴 해요 :)


var orthogonalScrollinBehavior: UICollectionLayoutSectionOrthogonalScrollingBehavior {
switch self {
case .header:
return .groupPaging
default:
return .continuous
}
}

var header: [NSCollectionLayoutBoundarySupplementaryItem] {
switch self {
case .normal, .live:
let headerSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1), heightDimension: .absolute(30))
let header = NSCollectionLayoutBoundarySupplementaryItem(layoutSize: headerSize, elementKind: UICollectionView.elementKindSectionHeader, alignment: .top)
return [header]
default:
return []
}
}

var footer: [NSCollectionLayoutBoundarySupplementaryItem] {
switch self {
case .header:
let footerSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1), heightDimension: .absolute(20))
let footer = NSCollectionLayoutBoundarySupplementaryItem(layoutSize: footerSize, elementKind: UICollectionView.elementKindSectionFooter, alignment: .bottom)
return [footer]
default:
return []
}
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
//
// TvingButton.swift
// GO_SOPT_Seminar_Assignment
//
// Created by 김다예 on 2023/04/26.
//

import UIKit

import SnapKit
import Then

class CustomTvingButton: UIButton {

override init(frame: CGRect) {
super.init(frame: frame)

style()
setLayout()
}

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

func style() {
self.setTitleColor(.tvingGray2, for: .normal)
self.titleLabel?.textAlignment = .center
self.layer.borderColor = UIColor.tvingGray4.cgColor
self.layer.borderWidth = 1
self.layer.cornerRadius = 3
}

func setLayout() {

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
//
// ContentsCollectionViewCell.swift
// GO_SOPT_Seminar_Assignment
//
// Created by 김다예 on 2023/04/29.
//

import UIKit

class MainViewContentsCell: UICollectionViewCell {

static let identifier = "ContentsCell"

private let contentsStackView = UIStackView()
private let contentsImg = UIImageView()
private let contentsName = UILabel()
private let contentsSubName = UILabel()

var pageIndicatorNum: Int = 0

override init(frame: CGRect) {
super.init(frame: frame)

setStyle()
setHierarchy()
setLayout()
}

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

}

extension MainViewContentsCell {

func setStyle() {

Choose a reason for hiding this comment

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

CustomTvingButton 에서는 style 잡는 함수가 style() 이었는데
이름이 달라서 같은 역할인지 아닌지 헷갈릴 수도 있다고 생각합니다
(극단적으로 생각했을 때 ㅎㅎ...)

고로 함수 이름 통일하면 어떨까,,, 하는 생각? 의견? 리뷰? 입니닷,,

contentsStackView.do {
$0.axis = .vertical
$0.distribution = .fill
}
contentsName.do {
$0.font = .tvingMedium(ofSize: 12)
$0.textColor = .tvingGray2
}
contentsSubName.do {
$0.font = .tvingRegular(ofSize: 10)
$0.textColor = .tvingGray2
$0.numberOfLines = 2
}
}

func setHierarchy() {
contentView.addSubviews(contentsStackView)
contentsStackView.addArrangedSubviews(contentsImg,
contentsName,
contentsSubName)
}

func setLayout() {
contentsStackView.snp.makeConstraints {
$0.edges.equalToSuperview()
}
contentsImg.snp.makeConstraints {
$0.leading.trailing.equalToSuperview()
}
contentsName.snp.makeConstraints {
$0.height.equalTo(20)
$0.leading.trailing.equalToSuperview()
}
contentsSubName.snp.makeConstraints {
$0.height.equalTo(25)
$0.leading.trailing.equalToSuperview()
}
}

func configureCell(_ contents: Contents) {
contentsImg.image = contents.image
contentsName.text = contents.name
contentsSubName.text = contents.subName

if (contentsName.text == nil) {
contentsName.isHidden = true
} else {
contentsName.isHidden = false
}
if (contentsSubName.text == nil) {
contentsSubName.isHidden = true
} else {
contentsSubName.isHidden = false
}
}
Comment on lines +77 to +92

Choose a reason for hiding this comment

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

Suggested change
func configureCell(_ contents: Contents) {
contentsImg.image = contents.image
contentsName.text = contents.name
contentsSubName.text = contents.subName
if (contentsName.text == nil) {
contentsName.isHidden = true
} else {
contentsName.isHidden = false
}
if (contentsSubName.text == nil) {
contentsSubName.isHidden = true
} else {
contentsSubName.isHidden = false
}
}
func configureCell(_ contents: Contents) {
contentsImg.image = contents.image
if let name = contents.name {
contentsName.text = name
} else {
contentsName.isHidden = true
}
if let subName = contents.name {
contentsSubName.text = subName
} else {
contentsSubName.isHidden = true
}
}

위에 contentsName.text = contents.name 을 하고
그 아래에 또 contentsName.text == nil 을 확인한 뒤 값이 있으면 isHidden 을 false 로 한다~
는 코드의 중복이 조금 있는 것 같습니다..!!

제 나름대로 코드 양을 조금 줄이려고 노력해봤는데 잘 됐는지는 모르겠네욥!!

}

Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//
// MypageMenu.swift
// GO_SOPT_Seminar_Assignment
//
// Created by 김다예 on 2023/04/26.
//

import UIKit

struct MyPageMenu {
let menuName: String
}

extension MyPageMenu {

static func dummy() -> [[MyPageMenu]] {
return [[MyPageMenu(menuName: "이용권"),
MyPageMenu(menuName: "1:1 문의내역"),
MyPageMenu(menuName: "예약알림"),
MyPageMenu(menuName: "회원정보 수정"),
MyPageMenu(menuName: "프로모션 정보 수신 동의")],
[MyPageMenu(menuName: "공지사항"),
MyPageMenu(menuName: "이벤트"),
MyPageMenu(menuName: "고객센터"),
MyPageMenu(menuName: "티빙 알아보기")]]
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//
// TvingUser.swift
// GO_SOPT_Seminar_Assignment
//
// Created by 김다예 on 2023/04/28.
//

import Foundation

class TvingUser {

var id: String?
var password: String?
var nickName: String?

func getNickNameOrId() -> String {
if let nickName = self.nickName {
return nickName
} else {
guard let id = self.id?.components(separatedBy: "@").first else { return "" }
return id
}
}
Comment on lines +16 to +23

Choose a reason for hiding this comment

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

오늘 원티드 프리온보딩 들으면서 배운 점인데,
함수 네이밍 할 때 or() 나 and() 라는 내용으로 함수를 만드는건
하나의 함수 내에서 여러 역할을 하는거라 지양하라고 하셨습니닷

getNickName() 따로 getId() 따로 만들어 두는건 어떨까요???

}
Loading