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

박스오피스II [STEP 2] Prism, Gray #135

Open
wants to merge 44 commits into
base: ic_11_prism
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
3bfd009
refactor: property observer 제거
PrismSpirit Apr 17, 2024
ce51969
fix: navigation으로 다른 viewController을 push하고 되돌아올 때마다 refresh하는 문제 수정
PrismSpirit Apr 17, 2024
f97a882
feat: 영화 상세보기 화면 구현
yawoong2 Apr 18, 2024
7d81e44
refactor: DetailView 이름 변경
PrismSpirit Apr 18, 2024
1ca7536
refactor: 코드 indentation 조정 및 view hierarchy 변경
PrismSpirit Apr 18, 2024
b37ffa4
refactor: MovieDetail 파일 분리
PrismSpirit Apr 18, 2024
7203e9c
feat: 서버로부터 movieDetail를 불러오는 기능 추가
PrismSpirit Apr 18, 2024
17f6dca
refactor: DetailView constraint 재설정
PrismSpirit Apr 19, 2024
dc50838
design: 예시 이미지에 맞게 constraint 조정
PrismSpirit Apr 19, 2024
06e6ea4
feat: 화면 전환 모드 툴바 생성
yawoong2 Apr 22, 2024
90b282c
feat: 화면 모드 변경 터치 시 나타나는 action sheet 구현
PrismSpirit Apr 22, 2024
27c01bb
feat: 화면 모드 변경 기능 구현
PrismSpirit Apr 22, 2024
734c0c8
feat: 이미지 URL을 받아올 타입 정의
PrismSpirit Apr 23, 2024
cf4d36c
feat: Kakao 이미지 검색 API Key 추가
PrismSpirit Apr 23, 2024
240b8f4
fix: request에 header를 추가해 보낼 수 있도록 변경
PrismSpirit Apr 23, 2024
8d2f97e
feat: 이미지 검색 API로부터 이미지 URL을 받고 URL을 통해 이미지를 받아오는 기능 추가
PrismSpirit Apr 23, 2024
5dad3c1
design: 그리드 레이아웃 시 layer의 border 굵기 조정
PrismSpirit Apr 23, 2024
d725d64
design: 이미지 로드 시 비율에 맞춰 높이를 조정하도록 변경
PrismSpirit Apr 23, 2024
a39f4fc
design: variableLabel의 height의 최소값을 constantLabel의 height로 설정
PrismSpirit Apr 23, 2024
aa1f07b
fix: 상세화면 뷰에서 toolbar가 나타나는 현상 수정
PrismSpirit Apr 23, 2024
e72ee12
feat: 포스터 이미지 불러오기 실패 시 기본 이미지를 보여주도록 수정
yawoong2 Apr 23, 2024
c0cfec7
feat: DetailView 데이터 로드 시 activity indicator를 표시하는 기능 추가
PrismSpirit Apr 23, 2024
aaa3bd3
refactor: 코드 구조 변경
PrismSpirit Apr 24, 2024
b8e3f72
fix: http 통신 허용
PrismSpirit Apr 24, 2024
4e4a22d
refactor: datasource를 설정하는 메서드가 직관적이지 않은 문제 수정
yawoong2 Apr 24, 2024
01354f1
refactor: contentView 리팩토링
PrismSpirit Apr 24, 2024
2637eea
refactor: Layout 생성 코드 분리
PrismSpirit Apr 24, 2024
fed5c67
refactor: dataSource 설정 코드 리팩토링
PrismSpirit Apr 24, 2024
e8648d0
refactor: layer의 border 설정을 contentView 내에서 하도록 변경
PrismSpirit Apr 24, 2024
0e41225
feat: UILabel에 dynamic type 적용
PrismSpirit Apr 24, 2024
c555ea9
refactor: toolbar 숨기는 코드 위치 변경
PrismSpirit Apr 25, 2024
80c1341
refactor: AlertManager 네이밍 변경 및 접근제어 설정
PrismSpirit Apr 25, 2024
24486ff
refactor: 메서드 네이밍 변경
PrismSpirit Apr 25, 2024
8dff20a
refactor: DailyBoxOfficeDetatilView, DailyBoxOfficeDetailViewControll…
yawoong2 Apr 25, 2024
5668395
refactor: LayoutManager, DailyBoxOfficeListViewController 내 타입, 메서드 네…
yawoong2 Apr 25, 2024
bafab6e
refactor: forEach를 사용한 메서드 호출
PrismSpirit Apr 25, 2024
26ceb16
refactor: 코드 위치 조정
PrismSpirit Apr 25, 2024
8617737
refactor: UI 작업을 비동기 메서드 내부에서가 아닌 completion handler를 이용해 처리하도록 변경
PrismSpirit Apr 25, 2024
3998a2f
design: list layout에서 영화 제목이 너무 길 때 폰트 크기가 과도하게 작아지는 현상 수정
PrismSpirit Apr 25, 2024
4a64beb
design: 기기 폰트 사이즈 설정에 따라 동적으로 폰트 사이즈를 변경
PrismSpirit Apr 26, 2024
1c0bf4e
refactor: gridContentView가 stackView를 활용하도록 변경
PrismSpirit Apr 26, 2024
2fe7c2e
design: gridView에 적용될 수 있는 최대 contentSizeCategory를 `.accessibilityMed…
PrismSpirit Apr 26, 2024
6fa859c
refactor: viewController 네이밍 변경
PrismSpirit Apr 26, 2024
4362223
add: 실행화면 스크린샷 추가
PrismSpirit Apr 26, 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
48 changes: 36 additions & 12 deletions BoxOffice.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
objects = {

/* Begin PBXBuildFile section */
0613876C2BCF950800C945DA /* DailyBoxOfficeDetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0613876B2BCF950800C945DA /* DailyBoxOfficeDetailViewController.swift */; };
067336112BC041DB0068B2BF /* NetworkService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 067336102BC041DB0068B2BF /* NetworkService.swift */; };
068691712BBBA8C0005CEC17 /* DailyBoxOfficeResponseDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 068691702BBBA8C0005CEC17 /* DailyBoxOfficeResponseDTO.swift */; };
06872D272BCFFD0C003E6BB5 /* DailyBoxOfficeDetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06872D262BCFFD0C003E6BB5 /* DailyBoxOfficeDetailView.swift */; };
06C46EF52BC6497100A8B2D0 /* BoxOffice.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06C46EF42BC6497100A8B2D0 /* BoxOffice.swift */; };
63DF20EF2970E1A0005DF7D1 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63DF20EE2970E1A0005DF7D1 /* AppDelegate.swift */; };
63DF20F12970E1A0005DF7D1 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63DF20F02970E1A0005DF7D1 /* SceneDelegate.swift */; };
63DF20F32970E1A0005DF7D1 /* DailyBoxOfficeListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63DF20F22970E1A0005DF7D1 /* DailyBoxOfficeListViewController.swift */; };
63DF20F32970E1A0005DF7D1 /* DailyBoxOfficeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63DF20F22970E1A0005DF7D1 /* DailyBoxOfficeViewController.swift */; };
63DF20F82970E1A1005DF7D1 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 63DF20F72970E1A1005DF7D1 /* Assets.xcassets */; };
C4058F962BBBD47800B02D2F /* BoxOfficeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4058F952BBBD47800B02D2F /* BoxOfficeTests.swift */; };
C4058F9D2BBBD5CA00B02D2F /* box_office_sample.json in Resources */ = {isa = PBXBuildFile; fileRef = C4058F9C2BBBD5CA00B02D2F /* box_office_sample.json */; };
Expand All @@ -21,10 +23,14 @@
C40D92602BC6886900417DB5 /* FormatStyle+.swift in Sources */ = {isa = PBXBuildFile; fileRef = C40D925F2BC6886900417DB5 /* FormatStyle+.swift */; };
C40D92642BC8F1E600417DB5 /* DailyBoxOfficeContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C40D92632BC8F1E600417DB5 /* DailyBoxOfficeContentView.swift */; };
C40D92662BC8F26D00417DB5 /* DailyBoxOfficeConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = C40D92652BC8F26D00417DB5 /* DailyBoxOfficeConfiguration.swift */; };
C41B861E2BCD765400182324 /* AlertFactory.swift in Sources */ = {isa = PBXBuildFile; fileRef = C41B861D2BCD765400182324 /* AlertFactory.swift */; };
C41B861E2BCD765400182324 /* AlertManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = C41B861D2BCD765400182324 /* AlertManager.swift */; };
C41B86222BCE9AA400182324 /* CalendarViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C41B86212BCE9AA400182324 /* CalendarViewController.swift */; };
C41B86342BD1763600182324 /* MovieDetail.swift in Sources */ = {isa = PBXBuildFile; fileRef = C41B86332BD1763600182324 /* MovieDetail.swift */; };
C43A73C92BD937AC00C16EBE /* LayoutManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = C43A73C82BD937AC00C16EBE /* LayoutManager.swift */; };
C46DB6E42BC0EC87000D6A41 /* APIs.swift in Sources */ = {isa = PBXBuildFile; fileRef = C46DB6E32BC0EC87000D6A41 /* APIs.swift */; };
C46DB6EE2BC621F5000D6A41 /* DailyBoxOfficeListCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = C46DB6ED2BC621F5000D6A41 /* DailyBoxOfficeListCell.swift */; };
C46DB6EE2BC621F5000D6A41 /* DailyBoxOfficeCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = C46DB6ED2BC621F5000D6A41 /* DailyBoxOfficeCell.swift */; };
C4E2F8CE2BD789E90030E242 /* Document.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4E2F8CD2BD789E90030E242 /* Document.swift */; };
C4E2F8D02BD78A120030E242 /* ImageSearchResponseDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4E2F8CF2BD78A120030E242 /* ImageSearchResponseDTO.swift */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand All @@ -38,13 +44,15 @@
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
0613876B2BCF950800C945DA /* DailyBoxOfficeDetailViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DailyBoxOfficeDetailViewController.swift; sourceTree = "<group>"; };
067336102BC041DB0068B2BF /* NetworkService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkService.swift; sourceTree = "<group>"; };
068691702BBBA8C0005CEC17 /* DailyBoxOfficeResponseDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DailyBoxOfficeResponseDTO.swift; sourceTree = "<group>"; tabWidth = 1; };
06872D262BCFFD0C003E6BB5 /* DailyBoxOfficeDetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DailyBoxOfficeDetailView.swift; sourceTree = "<group>"; };
06C46EF42BC6497100A8B2D0 /* BoxOffice.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BoxOffice.swift; sourceTree = "<group>"; };
63DF20EB2970E1A0005DF7D1 /* BoxOffice.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = BoxOffice.app; sourceTree = BUILT_PRODUCTS_DIR; };
63DF20EE2970E1A0005DF7D1 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
63DF20F02970E1A0005DF7D1 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
63DF20F22970E1A0005DF7D1 /* DailyBoxOfficeListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DailyBoxOfficeListViewController.swift; sourceTree = "<group>"; };
63DF20F22970E1A0005DF7D1 /* DailyBoxOfficeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DailyBoxOfficeViewController.swift; sourceTree = "<group>"; };
63DF20F72970E1A1005DF7D1 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
63DF20FC2970E1A1005DF7D1 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
C4058F932BBBD47800B02D2F /* BoxOfficeTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = BoxOfficeTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
Expand All @@ -56,10 +64,14 @@
C40D925F2BC6886900417DB5 /* FormatStyle+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "FormatStyle+.swift"; sourceTree = "<group>"; };
C40D92632BC8F1E600417DB5 /* DailyBoxOfficeContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DailyBoxOfficeContentView.swift; sourceTree = "<group>"; };
C40D92652BC8F26D00417DB5 /* DailyBoxOfficeConfiguration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DailyBoxOfficeConfiguration.swift; sourceTree = "<group>"; };
C41B861D2BCD765400182324 /* AlertFactory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlertFactory.swift; sourceTree = "<group>"; };
C41B861D2BCD765400182324 /* AlertManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlertManager.swift; sourceTree = "<group>"; };
C41B86212BCE9AA400182324 /* CalendarViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CalendarViewController.swift; sourceTree = "<group>"; };
C41B86332BD1763600182324 /* MovieDetail.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MovieDetail.swift; sourceTree = "<group>"; };
C43A73C82BD937AC00C16EBE /* LayoutManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LayoutManager.swift; sourceTree = "<group>"; };
C46DB6E32BC0EC87000D6A41 /* APIs.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = APIs.swift; sourceTree = "<group>"; };
C46DB6ED2BC621F5000D6A41 /* DailyBoxOfficeListCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DailyBoxOfficeListCell.swift; sourceTree = "<group>"; };
C46DB6ED2BC621F5000D6A41 /* DailyBoxOfficeCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DailyBoxOfficeCell.swift; sourceTree = "<group>"; };
C4E2F8CD2BD789E90030E242 /* Document.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Document.swift; sourceTree = "<group>"; };
C4E2F8CF2BD78A120030E242 /* ImageSearchResponseDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageSearchResponseDTO.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -137,6 +149,8 @@
isa = PBXGroup;
children = (
06C46EF42BC6497100A8B2D0 /* BoxOffice.swift */,
C41B86332BD1763600182324 /* MovieDetail.swift */,
C4E2F8CD2BD789E90030E242 /* Document.swift */,
);
path = Model;
sourceTree = "<group>";
Expand All @@ -152,7 +166,8 @@
C40D926A2BC90C2A00417DB5 /* ViewController */ = {
isa = PBXGroup;
children = (
63DF20F22970E1A0005DF7D1 /* DailyBoxOfficeListViewController.swift */,
63DF20F22970E1A0005DF7D1 /* DailyBoxOfficeViewController.swift */,
0613876B2BCF950800C945DA /* DailyBoxOfficeDetailViewController.swift */,
C41B86212BCE9AA400182324 /* CalendarViewController.swift */,
);
path = ViewController;
Expand All @@ -163,8 +178,10 @@
children = (
C40D92652BC8F26D00417DB5 /* DailyBoxOfficeConfiguration.swift */,
C40D92632BC8F1E600417DB5 /* DailyBoxOfficeContentView.swift */,
C46DB6ED2BC621F5000D6A41 /* DailyBoxOfficeListCell.swift */,
C41B861D2BCD765400182324 /* AlertFactory.swift */,
C46DB6ED2BC621F5000D6A41 /* DailyBoxOfficeCell.swift */,
06872D262BCFFD0C003E6BB5 /* DailyBoxOfficeDetailView.swift */,
C41B861D2BCD765400182324 /* AlertManager.swift */,
C43A73C82BD937AC00C16EBE /* LayoutManager.swift */,
);
path = View;
sourceTree = "<group>";
Expand All @@ -184,6 +201,7 @@
children = (
068691702BBBA8C0005CEC17 /* DailyBoxOfficeResponseDTO.swift */,
C40AB8692BC03647001BCAC7 /* MovieDetailResponseDTO.swift */,
C4E2F8CF2BD78A120030E242 /* ImageSearchResponseDTO.swift */,
);
path = DataMapping;
sourceTree = "<group>";
Expand Down Expand Up @@ -290,19 +308,25 @@
files = (
C41B86222BCE9AA400182324 /* CalendarViewController.swift in Sources */,
C40D92642BC8F1E600417DB5 /* DailyBoxOfficeContentView.swift in Sources */,
C4E2F8D02BD78A120030E242 /* ImageSearchResponseDTO.swift in Sources */,
C40AB8642BBFC923001BCAC7 /* Environment.swift in Sources */,
63DF20F32970E1A0005DF7D1 /* DailyBoxOfficeListViewController.swift in Sources */,
C41B86342BD1763600182324 /* MovieDetail.swift in Sources */,
63DF20F32970E1A0005DF7D1 /* DailyBoxOfficeViewController.swift in Sources */,
C46DB6E42BC0EC87000D6A41 /* APIs.swift in Sources */,
06872D272BCFFD0C003E6BB5 /* DailyBoxOfficeDetailView.swift in Sources */,
C40D92602BC6886900417DB5 /* FormatStyle+.swift in Sources */,
63DF20EF2970E1A0005DF7D1 /* AppDelegate.swift in Sources */,
C46DB6EE2BC621F5000D6A41 /* DailyBoxOfficeListCell.swift in Sources */,
C46DB6EE2BC621F5000D6A41 /* DailyBoxOfficeCell.swift in Sources */,
C40D92662BC8F26D00417DB5 /* DailyBoxOfficeConfiguration.swift in Sources */,
63DF20F12970E1A0005DF7D1 /* SceneDelegate.swift in Sources */,
067336112BC041DB0068B2BF /* NetworkService.swift in Sources */,
06C46EF52BC6497100A8B2D0 /* BoxOffice.swift in Sources */,
C41B861E2BCD765400182324 /* AlertFactory.swift in Sources */,
C43A73C92BD937AC00C16EBE /* LayoutManager.swift in Sources */,
C41B861E2BCD765400182324 /* AlertManager.swift in Sources */,
0613876C2BCF950800C945DA /* DailyBoxOfficeDetailViewController.swift in Sources */,
C40AB86A2BC03647001BCAC7 /* MovieDetailResponseDTO.swift in Sources */,
068691712BBBA8C0005CEC17 /* DailyBoxOfficeResponseDTO.swift in Sources */,
C4E2F8CE2BD789E90030E242 /* Document.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
17 changes: 13 additions & 4 deletions BoxOffice/App/Environment.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import Foundation

public enum Environment {
enum Keys {
static let apiKey = "API_KEY"
static let kobisApiKey = "KOBIS_API_KEY"
static let kakaoApiKey = "KAKAO_API_KEY"
}

private static let infoDictionary: [String: Any] = {
Expand All @@ -20,9 +21,17 @@ public enum Environment {
return dict
}()

static let apiKey: String = {
guard let apiKeyString = Environment.infoDictionary[Keys.apiKey] as? String else {
fatalError("API KEY does not exist in plist")
static let kobisApiKey: String = {
guard let apiKeyString = Environment.infoDictionary[Keys.kobisApiKey] as? String else {
fatalError("Kobis API KEY does not exist in plist")
}

return apiKeyString
}()

static let kakaoApiKey: String = {
guard let apiKeyString = Environment.infoDictionary[Keys.kakaoApiKey] as? String else {
fatalError("Kakao API KEY does not exist in plist")
}

return apiKeyString
Expand Down
4 changes: 2 additions & 2 deletions BoxOffice/App/SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {

window = UIWindow(windowScene: windowScene)

let dailyBoxOfficeListViewController = DailyBoxOfficeListViewController(networkService: defaultNetworkService)
let navigationController = UINavigationController(rootViewController: dailyBoxOfficeListViewController)
let dailyBoxOfficeViewController = DailyBoxOfficeViewController(networkService: defaultNetworkService)
let navigationController = UINavigationController(rootViewController: dailyBoxOfficeViewController)
window?.rootViewController = navigationController
window?.makeKeyAndVisible()
}
Expand Down
23 changes: 23 additions & 0 deletions BoxOffice/Assets.xcassets/not_found_image.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "not_found_image.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "not_found_image 1.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "not_found_image 2.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.
11 changes: 9 additions & 2 deletions BoxOffice/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,15 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>API_KEY</key>
<string>$(API_KEY)</string>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>KAKAO_API_KEY</key>
<string>$(KAKAO_API_KEY)</string>
<key>KOBIS_API_KEY</key>
<string>$(KOBIS_API_KEY)</string>
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
Expand Down
1 change: 1 addition & 0 deletions BoxOffice/Model/BoxOffice.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ struct BoxOffice: Hashable {
let title: String
let todayAudience: Int
let totalAudience: Int
let movieCode: String

enum RankingEntry {
case old
Expand Down
13 changes: 13 additions & 0 deletions BoxOffice/Model/Document.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// Document.swift
// BoxOffice
//
// Created by Jaehun Lee on 4/23/24.
//

struct Document {
let docURL: String
let imageURL: String
let width: Int
let height: Int
}
18 changes: 18 additions & 0 deletions BoxOffice/Model/MovieDetail.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// MovieDetail.swift
// BoxOffice
//
// Created by Jaehun Lee on 4/19/24.
//

struct MovieDetail {
let movieName: String
let directors: String
let productionYear: Int
let openDate: String
let showTime: Int
let watchGrade: String
let nations: String
let genres: String
let actors: String
}
19 changes: 19 additions & 0 deletions BoxOffice/Network/APIs.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ enum APIs {
enum Kobis {
static let baseURL = URL(string: "https://www.kobis.or.kr/kobisopenapi/webservice/rest")!
}

enum Kakao {
static let baseURL = URL(string: "https://dapi.kakao.com/v2/")!
}
}

extension APIs.Kobis {
Expand Down Expand Up @@ -45,6 +49,21 @@ extension APIs.Kobis {
}
}

extension APIs.Kakao {
enum Search: RawRepresentable, API {
static var baseURL = APIs.Kakao.baseURL.appendingPathComponent("search")

var rawValue: String {
switch self {
case .image:
return "image"
}
}

case image
}
}

extension RawRepresentable where RawValue == String, Self: API {
var url: URL { Self.baseURL.appendingPathComponent(rawValue) }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ extension DailyBoxOfficeResponseDTO.DailyBoxOfficeDTO {
rankingEntry: rankingEntry == .old ? .old : .new,
title: movieName,
todayAudience: Int(audienceCount) ?? .zero,
totalAudience: Int(audienceAccmulation) ?? .zero)
totalAudience: Int(audienceAccmulation) ?? .zero,
movieCode: movieCode)
}
}
43 changes: 43 additions & 0 deletions BoxOffice/Network/DataMapping/ImageSearchResponseDTO.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
//
// ImageSearchResponseDTO.swift
// BoxOffice
//
// Created by Jaehun Lee on 4/23/24.
//

struct ImageSearchResponseDTO: Decodable {
let documents: [DocumentDTO]
}

extension ImageSearchResponseDTO {
struct DocumentDTO: Decodable {
private enum CodingKeys: String, CodingKey {
case collection
case datetime
case displaySiteName = "display_sitename"
case docURL = "doc_url"
case imageURL = "image_url"
case thumbnailURL = "thumbnail_url"
case width
case height
}

let collection: String
let datetime: String
let displaySiteName: String
let docURL: String
let imageURL: String
let thumbnailURL: String
let width: Int
let height: Int
}
}

extension ImageSearchResponseDTO.DocumentDTO {
func toModel() -> Document {
return .init(docURL: docURL,
imageURL: imageURL,
width: width,
height: height)
}
}
15 changes: 15 additions & 0 deletions BoxOffice/Network/DataMapping/MovieDetailResponseDTO.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
// Created by Jaehun Lee on 4/5/24.
//

import Foundation

struct MovieDetailResponseDTO: Decodable {
let movieInfoResult: MovieInfoResultDTO
}
Expand Down Expand Up @@ -94,3 +96,16 @@ extension MovieDetailResponseDTO {
}
}

extension MovieDetailResponseDTO.MovieInfoDTO {
func toModel() -> MovieDetail {
return .init(movieName: movieName,
directors: directors.map { $0.name }.joined(separator: ", "),
productionYear: Int(productionYear) ?? .zero,
openDate: ((try? Date.ISO8601FormatStyle.iso8601FullDateWithoutSeparator.parse(openDate)) ?? Date()).formatted(.iso8601FullDate),
showTime: Int(showTime) ?? .zero,
watchGrade: audits.map { $0.watchGradeName }.joined(separator: ", "),
nations: nations.map { $0.nationName }.joined(separator: ", "),
genres: genres.map { $0.genreName }.joined(separator: ", "),
actors: actors.map { $0.actorName }.joined(separator: ", "))
}
}
Loading