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

만국박람회 [Step 2] Gray, Danny #310

Open
wants to merge 40 commits into
base: ic_11_danny
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
b78c7e1
feat: json 정보를 디코드와하여 초기화면에 타이틀 출력
dannykim1215 Mar 7, 2024
541e8b0
feat: 앱 초기화면 이미지 출력
yawoong2 Mar 7, 2024
82faa63
feat: json 정보를 디코드하여 초기화면에 방문객 숫자 출력
dannykim1215 Mar 8, 2024
0183545
refactor: 초기화면에 방문객 숫자 구현을 NumberFormatter, demical 통해 출력하도록 수정
dannykim1215 Mar 8, 2024
e4eecca
Feat : 초기화면에 개최지, 개최 기간, 박람회 설명이 보이도록 구현
yawoong2 Mar 8, 2024
2b81bd7
feat: KoreanHeritageViewController 생성, ViewControler에서 KoreanHeritage…
dannykim1215 Mar 8, 2024
0148ed9
docs: Update README.md
dannykim1215 Mar 8, 2024
6a53e53
feat: 한국 출품작 목록 화면에 TableView 구현
yawoong2 Mar 8, 2024
158da01
feat: 커스텀 테이블 뷰를 위한 KoreanHeritageTableViewCell 추가
yawoong2 Mar 8, 2024
93c513e
fix: KoreanHeritage 화면에서 한국 출품작 이름이 출력되도록 수정
yawoong2 Mar 10, 2024
b95b8dd
feat: KoreanHeritage 테이블 셀 정보(shortDescription, itemImage) 추가
dannykim1215 Mar 10, 2024
ae1cb0c
feat: 상세 출품작 내용을 보여주기 위한 ViewController 생성 및 제목, 이미지 출력
yawoong2 Mar 10, 2024
263236a
feat: KoreanHeritage 모델 타입에 description case 추가, KoreanHeritageViewCo…
dannykim1215 Mar 10, 2024
2880e99
remove: 사용하지 않는 KoreanHeritageDetail 모델 제거
yawoong2 Mar 10, 2024
69d98d6
refactor: expositionIntroduction 관련 UI를 스크롤 뷰로 수정
dannykim1215 Mar 11, 2024
6dda91d
feat: KoreanHeritageDetail 화면에 스크롤 뷰 적용
yawoong2 Mar 11, 2024
66afc25
refactor: 한국출품작 리스트에 shorDescription을 TextView -> Label로 변경
dannykim1215 Mar 12, 2024
96e53c7
design: 한국 출품작 목록을 보여주는 화면에서 stactview를 통해 레이블의 내용이 모두 보이도록 수정
yawoong2 Mar 13, 2024
08d6ddb
design: 한국 출품작 목록 화면에서 출품작 이름의 크기가 모두 같도록 수정
yawoong2 Mar 13, 2024
a15fef9
degisn: 한국 출품작 상세 화면 이미지 비율 조정
yawoong2 Mar 13, 2024
4012e1d
feat: 메인페이지에서 한국의 출품작 옆 태극기 이미지 삽입 추가
dannykim1215 Mar 13, 2024
4242b26
design: 한국 출품작 목록 화면에서 safeArea 내부에 모든 콘텐츠가 보이도록 수정
yawoong2 Mar 13, 2024
79af818
design: 초기 화면의 스크롤 뷰가 superView 기준으로 크기를 따르도록 수정
yawoong2 Mar 13, 2024
50d5929
design: 초기 화면 stackView에서의 width 제약 조건 중복 제거
yawoong2 Mar 13, 2024
4efdc39
refactor, design: ViewController 네이밍 변경, 메인 화면 뷰의 방문객, 개최지, 개최기간 요구사항…
dannykim1215 Mar 13, 2024
56f640c
feat: 메인 ViewController 코드화 진행 - Navigation Controller 추가, ScrollView…
dannykim1215 Mar 13, 2024
31c0509
feat: 초기화면의 포스터 이미지, 방문자 수, 개최지, 개최기간, 설명을 코드베이스로 구현
yawoong2 Mar 13, 2024
ca54ea4
feat: ExpositionIntroductionViewController 코드화 진행 초기 완성
dannykim1215 Mar 14, 2024
6135f67
feat: 한국 출품작 목록 화면에서 제목 label을 코드 베이스로 구현
yawoong2 Mar 14, 2024
bbcb6f5
feat: 한국의 출품작 테이블뷰 코드로 구현
dannykim1215 Mar 14, 2024
36ca741
feat: 한국 출품작 목록 화면에서 각 행을 터치하면 상세 화면으로 이동하도록 구현
yawoong2 Mar 14, 2024
aa703ad
feat: 한국의 춞품작 상세화면 뷰 코드로 구현
dannykim1215 Mar 14, 2024
df1e0a4
refactor: 한국출품작 테이블 뷰 이미지 제약조건 추가, 셀 클릭했을 때 deselectRow를 추가하여 select …
dannykim1215 Mar 14, 2024
b577685
design: 초기 화면 Navigation bar 숨기기, 타이틀 폰트 크기 조정
yawoong2 Mar 14, 2024
923644b
refactor: 메인화면 방문객, 개최지, 개최기간 Text 필드에 적용되는 NSMutableAttributedString…
dannykim1215 Mar 15, 2024
fcd3d9c
refactor: 스토리보드 제거 및 Controller 이름 수정
yawoong2 Mar 15, 2024
a485893
refactor: HeritageViewCell 저장프로퍼티들 접근제어자 변경 후 메소드 추가 생성
dannykim1215 Mar 15, 2024
626b8c1
refactor: KoreanHeritageDetailViewController의 데이터를 OOP를 준수하도록 수정
yawoong2 Mar 15, 2024
7185445
refactor: ExposionVC, KoreanHeritageVC, KoreanHeritageDetailVC, Herit…
dannykim1215 Mar 15, 2024
f63df9b
Update README.md
dannykim1215 Mar 15, 2024
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
44 changes: 24 additions & 20 deletions Expo1900/Expo1900.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,30 @@
objects = {

/* Begin PBXBuildFile section */
0621F3AC2BA2A19F008EE37D /* HeritageTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0621F3AB2BA2A19F008EE37D /* HeritageTableViewCell.swift */; };
06A4F6942B960F6100C18E34 /* KoreanHeritage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06A4F6932B960F6100C18E34 /* KoreanHeritage.swift */; };
06F415B82BA34F7200AB04F4 /* KoreanHeritageDetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06F415B72BA34F7200AB04F4 /* KoreanHeritageDetailViewController.swift */; };
2EDEB6832BA1ECA300E50437 /* ExpositionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2EDEB6822BA1ECA300E50437 /* ExpositionViewController.swift */; };
2EDEB6852BA2201300E50437 /* KoreanHeritageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2EDEB6842BA2201300E50437 /* KoreanHeritageViewController.swift */; };
2EFFCF372B960D1100956B9A /* ExpositionIntroduction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2EFFCF362B960D1100956B9A /* ExpositionIntroduction.swift */; };
2EFFCF392B960DD500956B9A /* expo_assets in Resources */ = {isa = PBXBuildFile; fileRef = 2EFFCF382B960DD400956B9A /* expo_assets */; };
2EFFCF3B2B9610C700956B9A /* KoreanHeritageDetail.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2EFFCF3A2B9610C600956B9A /* KoreanHeritageDetail.swift */; };
C79FF4B52589F401005FB0FD /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C79FF4B42589F401005FB0FD /* AppDelegate.swift */; };
C79FF4B72589F401005FB0FD /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C79FF4B62589F401005FB0FD /* SceneDelegate.swift */; };
C79FF4B92589F401005FB0FD /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C79FF4B82589F401005FB0FD /* ViewController.swift */; };
C79FF4BC2589F401005FB0FD /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C79FF4BA2589F401005FB0FD /* Main.storyboard */; };
C79FF4BE2589F404005FB0FD /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C79FF4BD2589F404005FB0FD /* Assets.xcassets */; };
C79FF4C12589F404005FB0FD /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C79FF4BF2589F404005FB0FD /* LaunchScreen.storyboard */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
0621F3AB2BA2A19F008EE37D /* HeritageTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeritageTableViewCell.swift; sourceTree = "<group>"; };
06A4F6932B960F6100C18E34 /* KoreanHeritage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KoreanHeritage.swift; sourceTree = "<group>"; };
06F415B72BA34F7200AB04F4 /* KoreanHeritageDetailViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KoreanHeritageDetailViewController.swift; sourceTree = "<group>"; };
2EDEB6822BA1ECA300E50437 /* ExpositionViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExpositionViewController.swift; sourceTree = "<group>"; };
2EDEB6842BA2201300E50437 /* KoreanHeritageViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KoreanHeritageViewController.swift; sourceTree = "<group>"; };
2EFFCF362B960D1100956B9A /* ExpositionIntroduction.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExpositionIntroduction.swift; sourceTree = "<group>"; };
2EFFCF382B960DD400956B9A /* expo_assets */ = {isa = PBXFileReference; lastKnownFileType = folder; path = expo_assets; sourceTree = "<group>"; };
2EFFCF3A2B9610C600956B9A /* KoreanHeritageDetail.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KoreanHeritageDetail.swift; sourceTree = "<group>"; };
C79FF4B12589F401005FB0FD /* Expo1900.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Expo1900.app; sourceTree = BUILT_PRODUCTS_DIR; };
C79FF4B42589F401005FB0FD /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
C79FF4B62589F401005FB0FD /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
C79FF4B82589F401005FB0FD /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
C79FF4BB2589F401005FB0FD /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
C79FF4BD2589F404005FB0FD /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
C79FF4C02589F404005FB0FD /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
C79FF4C22589F404005FB0FD /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
Expand All @@ -45,20 +47,29 @@
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
06BD1C322BA3F42F0087CC30 /* Controller */ = {
isa = PBXGroup;
children = (
2EDEB6822BA1ECA300E50437 /* ExpositionViewController.swift */,
2EDEB6842BA2201300E50437 /* KoreanHeritageViewController.swift */,
06F415B72BA34F7200AB04F4 /* KoreanHeritageDetailViewController.swift */,
);
path = Controller;
sourceTree = "<group>";
};
2EB808362B98AC4E0048C303 /* Model */ = {
isa = PBXGroup;
children = (
2EFFCF362B960D1100956B9A /* ExpositionIntroduction.swift */,
06A4F6932B960F6100C18E34 /* KoreanHeritage.swift */,
2EFFCF3A2B9610C600956B9A /* KoreanHeritageDetail.swift */,
0621F3AB2BA2A19F008EE37D /* HeritageTableViewCell.swift */,
);
path = Model;
sourceTree = "<group>";
};
2EB808372B98AC610048C303 /* Resources */ = {
isa = PBXGroup;
children = (
C79FF4BA2589F401005FB0FD /* Main.storyboard */,
C79FF4BF2589F404005FB0FD /* LaunchScreen.storyboard */,
C79FF4BD2589F404005FB0FD /* Assets.xcassets */,
2EFFCF382B960DD400956B9A /* expo_assets */,
Expand Down Expand Up @@ -87,9 +98,9 @@
children = (
2EB808372B98AC610048C303 /* Resources */,
2EB808362B98AC4E0048C303 /* Model */,
06BD1C322BA3F42F0087CC30 /* Controller */,
C79FF4B42589F401005FB0FD /* AppDelegate.swift */,
C79FF4B62589F401005FB0FD /* SceneDelegate.swift */,
C79FF4B82589F401005FB0FD /* ViewController.swift */,
C79FF4C22589F404005FB0FD /* Info.plist */,
);
path = Expo1900;
Expand Down Expand Up @@ -155,7 +166,6 @@
C79FF4C12589F404005FB0FD /* LaunchScreen.storyboard in Resources */,
2EFFCF392B960DD500956B9A /* expo_assets in Resources */,
C79FF4BE2589F404005FB0FD /* Assets.xcassets in Resources */,
C79FF4BC2589F401005FB0FD /* Main.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -166,26 +176,20 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
C79FF4B92589F401005FB0FD /* ViewController.swift in Sources */,
0621F3AC2BA2A19F008EE37D /* HeritageTableViewCell.swift in Sources */,
2EDEB6832BA1ECA300E50437 /* ExpositionViewController.swift in Sources */,
06A4F6942B960F6100C18E34 /* KoreanHeritage.swift in Sources */,
C79FF4B52589F401005FB0FD /* AppDelegate.swift in Sources */,
C79FF4B72589F401005FB0FD /* SceneDelegate.swift in Sources */,
2EFFCF3B2B9610C700956B9A /* KoreanHeritageDetail.swift in Sources */,
2EDEB6852BA2201300E50437 /* KoreanHeritageViewController.swift in Sources */,
06F415B82BA34F7200AB04F4 /* KoreanHeritageDetailViewController.swift in Sources */,
2EFFCF372B960D1100956B9A /* ExpositionIntroduction.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */

/* Begin PBXVariantGroup section */
C79FF4BA2589F401005FB0FD /* Main.storyboard */ = {
isa = PBXVariantGroup;
children = (
C79FF4BB2589F401005FB0FD /* Base */,
);
name = Main.storyboard;
sourceTree = "<group>";
};
C79FF4BF2589F404005FB0FD /* LaunchScreen.storyboard */ = {
isa = PBXVariantGroup;
children = (
Expand Down
215 changes: 215 additions & 0 deletions Expo1900/Expo1900/Controller/ExpositionViewController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,215 @@
//
// ExpositionViewController.swift
// Expo1900
//
// Created by Danny, Gray on 3/13/24.
//

import UIKit

class ExpositionViewController: UIViewController {
Copy link

Choose a reason for hiding this comment

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

Suggested change
class ExpositionViewController: UIViewController {
final class ExpositionViewController: UIViewController {

static dispatch를 위해서 final은 디폴트로 붙여주세용

var expositionIntroduction: ExpositionIntroduction!
Copy link

Choose a reason for hiding this comment

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

강제 언래핑(!)은 없는 기능이라고 생각해주세요.
현재 디코딩에 실패할 경우 크래시가 발생할거 같아요


private var mainTitleLabel: UILabel = {
let label = UILabel()
label.font = UIFont.preferredFont(forTextStyle: .title1)
return label
}()

private var subTitleLabel: UILabel = {
let label = UILabel()
label.font = UIFont.preferredFont(forTextStyle: .title2)
return label
}()

private var posterImageView: UIImageView = {
let imageView = UIImageView()
return imageView
}()
Comment on lines +25 to +28
Copy link

Choose a reason for hiding this comment

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

따로 무언가 속성을 바꾸지 않는다면, 클로저로 initialize안하고 바로 해도 괜찮을거 같아요!
상황에 따라~


private var visitorLabel: UILabel = {
let label = UILabel()
return label
}()

private var locationLabel: UILabel = {
let label = UILabel()
return label
}()

private var durationLabel: UILabel = {
let label = UILabel()
return label
}()

private var descriptionLabel: UILabel = {
let label = UILabel()
return label
}()
Comment on lines +13 to +48
Copy link

Choose a reason for hiding this comment

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

let이어도 되지 않을까요?

  • UI 프로퍼티는 앵간하면 translatesAutoresizingMaskIntoConstraints = false를 초기화 시점에 해주면 좋아요


private let contentScrollView: UIScrollView = {
let scrollView = UIScrollView()
scrollView.translatesAutoresizingMaskIntoConstraints = false
scrollView.showsHorizontalScrollIndicator = false
return scrollView
}()

private let contentView: UIView = {
let view = UIView()
view.translatesAutoresizingMaskIntoConstraints = false
return view
}()

private let expositionIntroductionStackView: UIStackView = {
let stackView = UIStackView()
stackView.translatesAutoresizingMaskIntoConstraints = false
stackView.axis = .vertical
stackView.alignment = .center
stackView.distribution = .equalSpacing
stackView.spacing = 8
return stackView
}()

private let buttonStackView: UIStackView = {
let stackView = UIStackView()
stackView.translatesAutoresizingMaskIntoConstraints = false
stackView.axis = .horizontal
stackView.alignment = .fill
stackView.distribution = .fill
stackView.spacing = 8
return stackView
}()

private let koreanFlagImageViewFirst: UIImageView = {
let imageView = UIImageView()
imageView.image = UIImage(named: "flag")
return imageView
}()

private let koreanFlagImageViewSecond: UIImageView = {
let imageView = UIImageView()
imageView.image = UIImage(named: "flag")
return imageView
}()

private let koreanHeritageButton: UIButton = {
let button = UIButton(type: .system)
button.setTitle("한국 출품작 보러가기", for: .normal)
return button
}()

override func viewDidLoad() {
super.viewDidLoad()
expositionIntroductionJsonDecode()
showExpositionIntroduction()
addSubview()
}

override func viewWillAppear(_ animated: Bool) {
navigationController?.navigationBar.isHidden = true
}

override func viewWillDisappear(_ animated: Bool) {
navigationController?.navigationBar.isHidden = false
}
}

extension ExpositionViewController {
private func expositionIntroductionJsonDecode(){
let jsonDecoder: JSONDecoder = JSONDecoder()
guard let dataAsset: NSDataAsset = NSDataAsset(name: "exposition_universelle_1900") else {
return
}

do {
self.expositionIntroduction = try jsonDecoder.decode(ExpositionIntroduction.self, from: dataAsset.data)
} catch {
print(error.localizedDescription)
Copy link

Choose a reason for hiding this comment

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

에러처리도 요구사항중에 중요한 부분이라고 생각되는데요,
alert를 표시하던가, 에러 화면을 보여줘야 할거 같아요

}
}
}

extension ExpositionViewController {
private func addSubview() {
view.addSubview(contentScrollView)
contentScrollView.addSubview(contentView)
contentView.addSubview(expositionIntroductionStackView)
expositionIntroductionStackView.addArrangedSubview(mainTitleLabel)
expositionIntroductionStackView.addArrangedSubview(subTitleLabel)
expositionIntroductionStackView.addArrangedSubview(posterImageView)
expositionIntroductionStackView.addArrangedSubview(visitorLabel)
expositionIntroductionStackView.addArrangedSubview(locationLabel)
expositionIntroductionStackView.addArrangedSubview(durationLabel)
expositionIntroductionStackView.addArrangedSubview(descriptionLabel)
expositionIntroductionStackView.addArrangedSubview(buttonStackView)
buttonStackView.addArrangedSubview(koreanFlagImageViewFirst)
buttonStackView.addArrangedSubview(koreanHeritageButton)
buttonStackView.addArrangedSubview(koreanFlagImageViewSecond)
Comment on lines +137 to +147
Copy link

Choose a reason for hiding this comment

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

stackView에 넣을 때 setCustomSpacing이었나 따로 스페이싱 주는 인터페이스가 있으니 참고하심 좋을듯~


setUpUIConstraints()
}

private func setUpUIConstraints() {
NSLayoutConstraint.activate([
contentScrollView.topAnchor.constraint(equalTo: view.topAnchor),
contentScrollView.leadingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leadingAnchor),
contentScrollView.bottomAnchor.constraint(equalTo: view.bottomAnchor),
contentScrollView.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor),

contentView.topAnchor.constraint(equalTo: contentScrollView.topAnchor),
contentView.leadingAnchor.constraint(equalTo: contentScrollView.leadingAnchor),
contentView.bottomAnchor.constraint(equalTo: contentScrollView.bottomAnchor),
contentView.trailingAnchor.constraint(equalTo: contentScrollView.trailingAnchor),
contentView.widthAnchor.constraint(equalTo: contentScrollView.widthAnchor),

expositionIntroductionStackView.topAnchor.constraint(equalTo: contentView.topAnchor),
expositionIntroductionStackView.leadingAnchor.constraint(equalTo: contentView.leadingAnchor, constant: 20),
expositionIntroductionStackView.trailingAnchor.constraint(equalTo: contentView.trailingAnchor, constant: -20),
expositionIntroductionStackView.bottomAnchor.constraint(equalTo: contentView.bottomAnchor, constant: -20),

buttonStackView.heightAnchor.constraint(equalToConstant: 50),

koreanFlagImageViewFirst.widthAnchor.constraint(equalTo: buttonStackView.widthAnchor, multiplier: 0.2),
koreanFlagImageViewSecond.widthAnchor.constraint(equalTo: buttonStackView.widthAnchor, multiplier: 0.2)
])

}
}

extension ExpositionViewController {
private func showExpositionIntroduction(){
let numberFormatter: NumberFormatter = NumberFormatter()
numberFormatter.numberStyle = .decimal

guard let visitorString: String = numberFormatter.string(for: expositionIntroduction.visitors) else {
return
}

mainTitleLabel.text = String(expositionIntroduction.title.prefix(13))
subTitleLabel.text = String(expositionIntroduction.title.suffix(28))
Comment on lines +188 to +189
Copy link

Choose a reason for hiding this comment

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

요 로직은 조금 의아한데요, title이 41글자가 아니면 에러가 날수도 있을거 같아요!

posterImageView.image = UIImage(named: "poster.png")
visitorLabel.attributedText = textAttributedToString(text: "방문객 : \(visitorString) 명", length: 3)
locationLabel.attributedText = textAttributedToString(text: "개최지 : \(expositionIntroduction.location)", length: 3)
durationLabel.attributedText = textAttributedToString(text: "개최 기간 : \(expositionIntroduction.duration)", length: 6)
descriptionLabel.numberOfLines = 0
descriptionLabel.text = expositionIntroduction.description
koreanHeritageButton.addTarget(self, action: #selector(openKoreanHeritageViewController), for: .touchUpInside)
}

private func textAttributedToString(text: String, length: Int) -> NSAttributedString {
let textAttributes:[NSAttributedString.Key: Any] = [.font: UIFont.systemFont(ofSize: 20)]
let textAttributedToString = NSMutableAttributedString(string: text)
textAttributedToString.addAttributes(textAttributes, range: NSRange(location: 0, length: length))
return textAttributedToString
}

@objc private func openKoreanHeritageViewController() {
let koreanHeritageViewController = KoreanHeritageViewController()
let backBarButtonItem = UIBarButtonItem(title: "메인", style: .plain, target: self, action: nil)
self.navigationItem.backBarButtonItem = backBarButtonItem
koreanHeritageViewController.title = "한국의 출품작"

navigationController?.pushViewController(koreanHeritageViewController, animated: true)
}
}

Loading