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] hoon, MINT #110

Draft
wants to merge 13 commits into
base: ic_9_mint09
Choose a base branch
from
Draft
Binary file removed .DS_Store
Copy link

Choose a reason for hiding this comment

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

dsstore가 올라와 있네요!

Copy link

Choose a reason for hiding this comment

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

수정하였습니다.😊

Binary file not shown.
22 changes: 22 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,23 @@
.DS_Store

# Created by https://www.toptal.com/developers/gitignore/api/xcode
# Edit at https://www.toptal.com/developers/gitignore?templates=xcode

### Xcode ###
## User settings
xcuserdata/

## Xcode 8 and earlier
*.xcscmblueprint
*.xccheckout

### Xcode Patch ###
*.xcodeproj/*
!*.xcodeproj/project.pbxproj
!*.xcodeproj/xcshareddata/
!*.xcodeproj/project.xcworkspace/
!*.xcworkspace/contents.xcworkspacedata
/*.gcno
**/xcshareddata/WorkspaceSettings.xcsettings

# End of https://www.toptal.com/developers/gitignore/api/xcode
48 changes: 48 additions & 0 deletions BoxOffice.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
63DF20FB2970E1A1005DF7D1 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 63DF20F92970E1A1005DF7D1 /* LaunchScreen.storyboard */; };
924EFF102A6EC2E7002764D5 /* JsonDecodeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 924EFF0F2A6EC2E7002764D5 /* JsonDecodeTests.swift */; };
924EFF212A6F68C3002764D5 /* BoxOfficeData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 924EFF202A6F68C3002764D5 /* BoxOfficeData.swift */; };
92A28BD42A8B6BF1003E8249 /* MovieInformation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92A28BD32A8B6BF1003E8249 /* MovieInformation.swift */; };
92A28BD72A8B8084003E8249 /* NetworkManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92A28BD62A8B8084003E8249 /* NetworkManager.swift */; };
92A28BD92A8B8209003E8249 /* URLType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92A28BD82A8B8209003E8249 /* URLType.swift */; };
92A28BDC2A8B83ED003E8249 /* NetworkError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92A28BDB2A8B83ED003E8249 /* NetworkError.swift */; };
92A28BDE2A8C6831003E8249 /* HTTP.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92A28BDD2A8C6831003E8249 /* HTTP.swift */; };
92A28BE12A8C68D3003E8249 /* Decodable+.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92A28BE02A8C68D3003E8249 /* Decodable+.swift */; };
92FE87E52A6F7443000510A3 /* Json.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 92FE87E42A6F7443000510A3 /* Json.xcassets */; };
/* End PBXBuildFile section */

Expand All @@ -40,6 +46,12 @@
924EFF0D2A6EC2E7002764D5 /* BoxOfficeTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = BoxOfficeTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
924EFF0F2A6EC2E7002764D5 /* JsonDecodeTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JsonDecodeTests.swift; sourceTree = "<group>"; };
924EFF202A6F68C3002764D5 /* BoxOfficeData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BoxOfficeData.swift; sourceTree = "<group>"; };
92A28BD32A8B6BF1003E8249 /* MovieInformation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MovieInformation.swift; sourceTree = "<group>"; };
92A28BD62A8B8084003E8249 /* NetworkManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkManager.swift; sourceTree = "<group>"; };
92A28BD82A8B8209003E8249 /* URLType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = URLType.swift; sourceTree = "<group>"; };
92A28BDB2A8B83ED003E8249 /* NetworkError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkError.swift; sourceTree = "<group>"; };
92A28BDD2A8C6831003E8249 /* HTTP.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HTTP.swift; sourceTree = "<group>"; };
92A28BE02A8C68D3003E8249 /* Decodable+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Decodable+.swift"; sourceTree = "<group>"; };
92FE87E32A6F71A3000510A3 /* TestPlan.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = TestPlan.xctestplan; sourceTree = "<group>"; };
92FE87E42A6F7443000510A3 /* Json.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Json.xcassets; path = BoxOfficeTests/Json.xcassets; sourceTree = SOURCE_ROOT; };
/* End PBXFileReference section */
Expand Down Expand Up @@ -83,6 +95,9 @@
63DF20ED2970E1A0005DF7D1 /* BoxOffice */ = {
isa = PBXGroup;
children = (
92A28BDF2A8C68B3003E8249 /* Extension */,
92A28BDA2A8B83DD003E8249 /* Error */,
92A28BD52A8B7E3E003E8249 /* Network */,
924EFF1D2A6EC5C6002764D5 /* Application */,
924EFF1C2A6EC584002764D5 /* Controller */,
924EFF1B2A6EC57C002764D5 /* View */,
Expand All @@ -107,6 +122,7 @@
isa = PBXGroup;
children = (
924EFF202A6F68C3002764D5 /* BoxOfficeData.swift */,
92A28BD32A8B6BF1003E8249 /* MovieInformation.swift */,
);
path = Model;
sourceTree = "<group>";
Expand Down Expand Up @@ -137,6 +153,32 @@
path = Application;
sourceTree = "<group>";
};
92A28BD52A8B7E3E003E8249 /* Network */ = {
isa = PBXGroup;
children = (
92A28BD62A8B8084003E8249 /* NetworkManager.swift */,
92A28BD82A8B8209003E8249 /* URLType.swift */,
92A28BDD2A8C6831003E8249 /* HTTP.swift */,
);
path = Network;
sourceTree = "<group>";
};
92A28BDA2A8B83DD003E8249 /* Error */ = {
isa = PBXGroup;
children = (
92A28BDB2A8B83ED003E8249 /* NetworkError.swift */,
);
path = Error;
sourceTree = "<group>";
};
92A28BDF2A8C68B3003E8249 /* Extension */ = {
isa = PBXGroup;
children = (
92A28BE02A8C68D3003E8249 /* Decodable+.swift */,
);
path = Extension;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
Expand Down Expand Up @@ -239,9 +281,15 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
92A28BDE2A8C6831003E8249 /* HTTP.swift in Sources */,
92A28BD72A8B8084003E8249 /* NetworkManager.swift in Sources */,
92A28BDC2A8B83ED003E8249 /* NetworkError.swift in Sources */,
63DF20F32970E1A0005DF7D1 /* ViewController.swift in Sources */,
92A28BD42A8B6BF1003E8249 /* MovieInformation.swift in Sources */,
63DF20EF2970E1A0005DF7D1 /* AppDelegate.swift in Sources */,
92A28BE12A8C68D3003E8249 /* Decodable+.swift in Sources */,
63DF20F12970E1A0005DF7D1 /* SceneDelegate.swift in Sources */,
92A28BD92A8B8209003E8249 /* URLType.swift in Sources */,
924EFF212A6F68C3002764D5 /* BoxOfficeData.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.

This file was deleted.

This file was deleted.

This file was deleted.

8 changes: 3 additions & 5 deletions BoxOffice/Controller/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,16 @@
// ViewController.swift
// BoxOffice
//
// Created by kjs on 13/01/23.
// Created by 훈민트 on 2023/08/16.
//

import UIKit

class ViewController: UIViewController {

override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}


}

14 changes: 14 additions & 0 deletions BoxOffice/Error/NetworkError.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// NetworkError.swift
// BoxOffice
//
// Created by 훈민트 on 2023/08/15.
//

enum NetworkError: Error {
case dataTaskFail
case responseCasting
case invalidStatus
case noData
case invalidURL
}
24 changes: 24 additions & 0 deletions BoxOffice/Extension/Decodable+.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//
// Decodable+.swift
// BoxOffice
//
// Created by 훈민트 on 2023/08/16.
//

import Foundation

extension Decodable {
static func decode(data: Data) -> Self? {
var result: Self?

do {
result = try JSONDecoder().decode(Self.self, from: data)
} catch {
print(error.localizedDescription)
}

return result
}
}
Copy link

Choose a reason for hiding this comment

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

이 함수의 존재의 이유를 잘 모르겠어요!
decode에 실패했을 때 print를 찍는건 적절한 에러 핸들링이 아닐 거 같다는 생각이 듭니다 ㅠㅠ



5 changes: 5 additions & 0 deletions BoxOffice/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
Expand Down
2 changes: 1 addition & 1 deletion BoxOffice/Model/BoxOfficeData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// BoxOfficeData.swift
// BoxOffice
//
// Created by hoon, mint on 2023/07/25.
// Created by 훈민트 on 2023/07/25.
//

struct BoxOfficeData: Decodable {
Expand Down
143 changes: 143 additions & 0 deletions BoxOffice/Model/MovieInformation.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
//
// MovieInformation.swift
// BoxOffice
//
// Created by 훈민트 on 2023/08/15.
//

struct MovieInformation: Decodable {
let movieInformationResult: MovieInformationResult

enum CodingKeys: String, CodingKey {
Copy link

Choose a reason for hiding this comment

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

Suggested change
enum CodingKeys: String, CodingKey {
private enum CodingKeys: String, CodingKey {

Copy link

Choose a reason for hiding this comment

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

접근 제어를 사용하여 외부에서 접근하지 못하도록 수정하였습니다.

관련 커밋: 8c8af63

case movieInformationResult = "movieInfoResult"
}
}

struct MovieInformationResult: Decodable {
let detailMovieInformation: DetailMovieInformation
let source: String

enum CodingKeys: String, CodingKey {
case detailMovieInformation = "movieInfo"
case source
}
}

struct DetailMovieInformation: Decodable {
let movieCode: String
let movieName: String
let movieEnglishName: String
let movieOriginalName: String
let showTime: String
let productYear: String
let openDate: String
let productStatus: String
let typeName: String
let nations: [Nation]
let genres: [Genre]
let directors: [Director]
let actors: [Actor]
let showTypes: [ShowType]
let companys: [Company]
let audits: [Audit]
let staffs: [Staff]

enum CodingKeys: String, CodingKey {
case movieCode = "movieCd"
case movieName = "movieNm"
case movieEnglishName = "movieNmEn"
case movieOriginalName = "movieNmOg"
case showTime = "showTm"
case productYear = "prdtYear"
case openDate = "openDt"
case productStatus = "prdtStatNm"
case typeName = "typeNm"
case nations, genres, directors, actors, showTypes, companys, audits, staffs
}
}

struct Actor: Decodable {
let name: String
let englishName: String
let cast: String
let englishCast: String

enum CodingKeys: String, CodingKey {
case name = "peopleNm"
case englishName = "peopleNmEn"
case cast
case englishCast = "castEn"
}
}

struct Audit: Decodable {
let auditNumber: String
let watchGrade: String

enum CodingKeys: String, CodingKey {
case auditNumber = "auditNo"
case watchGrade = "watchGradeNm"
}
}

struct Company: Decodable {
let code: String
let name: String
let englishName: String
let partName: String

enum CodingKeys: String, CodingKey {
case code = "companyCd"
case name = "companyNm"
case englishName = "companyNmEn"
case partName = "companyPartNm"
}
}

struct Director: Decodable {
let name: String
let englishName: String

enum CodingKeys: String, CodingKey {
case name = "peopleNm"
case englishName = "peopleNmEn"
}
}

struct Genre: Decodable {
let name: String

enum CodingKeys: String, CodingKey {
case name = "genreNm"
}
}

struct Nation: Decodable {
let name: String

enum CodingKeys: String, CodingKey {
case name = "nationNm"
}
}

struct ShowType: Decodable {
let groupName: String
let name: String

enum CodingKeys: String, CodingKey {
case groupName = "showTypeGroupNm"
case name = "showTypeNm"
}
}

struct Staff: Decodable {
let name: String
let englishName: String
let roleName: String

enum CodingKeys: String, CodingKey {
case name = "peopleNm"
case englishName = "peopleNmEn"
case roleName = "staffRoleNm"
}
}
Loading