diff --git a/.gitignore b/.gitignore index e43b0f9..71cc02d 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ .DS_Store +BoxOffice2.xcodeproj/project.xcworkspace/xcuserdata/leewonbeen.xcuserdatad/UserInterfaceState.xcuserstate diff --git a/BoxOffice2.xcodeproj/project.pbxproj b/BoxOffice2.xcodeproj/project.pbxproj index 6ef4880..1edb43f 100644 --- a/BoxOffice2.xcodeproj/project.pbxproj +++ b/BoxOffice2.xcodeproj/project.pbxproj @@ -12,6 +12,11 @@ AF51F6D529A70E75007A5A87 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF51F6D429A70E75007A5A87 /* ViewController.swift */; }; AF51F6DA29A70E76007A5A87 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = AF51F6D929A70E76007A5A87 /* Assets.xcassets */; }; AF51F6DD29A70E76007A5A87 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = AF51F6DB29A70E76007A5A87 /* LaunchScreen.storyboard */; }; + AF51F6E929A7134A007A5A87 /* MovieCellData.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF51F6E829A7134A007A5A87 /* MovieCellData.swift */; }; + AF51F6EB29A71355007A5A87 /* MovieDetailData.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF51F6EA29A71355007A5A87 /* MovieDetailData.swift */; }; + AF51F6ED29A71EC7007A5A87 /* MovieRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF51F6EC29A71EC7007A5A87 /* MovieRepository.swift */; }; + AF51F6EF29A71F5C007A5A87 /* SearchMoviesUseCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF51F6EE29A71F5C007A5A87 /* SearchMoviesUseCase.swift */; }; + AF51F6F129A71FCF007A5A87 /* SearchMovieDetailUseCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF51F6F029A71FCF007A5A87 /* SearchMovieDetailUseCase.swift */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -22,6 +27,11 @@ AF51F6D929A70E76007A5A87 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; AF51F6DC29A70E76007A5A87 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; AF51F6DE29A70E76007A5A87 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + AF51F6E829A7134A007A5A87 /* MovieCellData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MovieCellData.swift; sourceTree = ""; }; + AF51F6EA29A71355007A5A87 /* MovieDetailData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MovieDetailData.swift; sourceTree = ""; }; + AF51F6EC29A71EC7007A5A87 /* MovieRepository.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MovieRepository.swift; sourceTree = ""; }; + AF51F6EE29A71F5C007A5A87 /* SearchMoviesUseCase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchMoviesUseCase.swift; sourceTree = ""; }; + AF51F6F029A71FCF007A5A87 /* SearchMovieDetailUseCase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchMovieDetailUseCase.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -54,6 +64,7 @@ AF51F6CF29A70E75007A5A87 /* BoxOffice2 */ = { isa = PBXGroup; children = ( + AF51F6E429A71314007A5A87 /* Domain */, AF51F6D029A70E75007A5A87 /* AppDelegate.swift */, AF51F6D229A70E75007A5A87 /* SceneDelegate.swift */, AF51F6D429A70E75007A5A87 /* ViewController.swift */, @@ -64,6 +75,42 @@ path = BoxOffice2; sourceTree = ""; }; + AF51F6E429A71314007A5A87 /* Domain */ = { + isa = PBXGroup; + children = ( + AF51F6E529A71319007A5A87 /* Entities */, + AF51F6E629A7131F007A5A87 /* UseCases */, + AF51F6E729A71324007A5A87 /* Interfaces */, + ); + path = Domain; + sourceTree = ""; + }; + AF51F6E529A71319007A5A87 /* Entities */ = { + isa = PBXGroup; + children = ( + AF51F6E829A7134A007A5A87 /* MovieCellData.swift */, + AF51F6EA29A71355007A5A87 /* MovieDetailData.swift */, + ); + path = Entities; + sourceTree = ""; + }; + AF51F6E629A7131F007A5A87 /* UseCases */ = { + isa = PBXGroup; + children = ( + AF51F6EE29A71F5C007A5A87 /* SearchMoviesUseCase.swift */, + AF51F6F029A71FCF007A5A87 /* SearchMovieDetailUseCase.swift */, + ); + path = UseCases; + sourceTree = ""; + }; + AF51F6E729A71324007A5A87 /* Interfaces */ = { + isa = PBXGroup; + children = ( + AF51F6EC29A71EC7007A5A87 /* MovieRepository.swift */, + ); + path = Interfaces; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -134,9 +181,14 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + AF51F6E929A7134A007A5A87 /* MovieCellData.swift in Sources */, AF51F6D529A70E75007A5A87 /* ViewController.swift in Sources */, + AF51F6ED29A71EC7007A5A87 /* MovieRepository.swift in Sources */, + AF51F6F129A71FCF007A5A87 /* SearchMovieDetailUseCase.swift in Sources */, + AF51F6EF29A71F5C007A5A87 /* SearchMoviesUseCase.swift in Sources */, AF51F6D129A70E75007A5A87 /* AppDelegate.swift in Sources */, AF51F6D329A70E75007A5A87 /* SceneDelegate.swift in Sources */, + AF51F6EB29A71355007A5A87 /* MovieDetailData.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/BoxOffice2.xcodeproj/project.xcworkspace/xcuserdata/leewonbeen.xcuserdatad/UserInterfaceState.xcuserstate b/BoxOffice2.xcodeproj/project.xcworkspace/xcuserdata/leewonbeen.xcuserdatad/UserInterfaceState.xcuserstate deleted file mode 100644 index 965a388..0000000 Binary files a/BoxOffice2.xcodeproj/project.xcworkspace/xcuserdata/leewonbeen.xcuserdatad/UserInterfaceState.xcuserstate and /dev/null differ diff --git a/BoxOffice2/Domain/Entities/MovieCellData.swift b/BoxOffice2/Domain/Entities/MovieCellData.swift new file mode 100644 index 0000000..55845bc --- /dev/null +++ b/BoxOffice2/Domain/Entities/MovieCellData.swift @@ -0,0 +1,17 @@ +// +// MovieCellData.swift +// BoxOffice2 +// +// Created by 이원빈 on 2023/02/23. +// + +struct MovieCellData { + let uuid: String + let posterURL: String + let currentRank: String + let title: String + let openDate: String + let totalAudience: String + let rankChange: String + let isNewEntry: Bool +} diff --git a/BoxOffice2/Domain/Entities/MovieDetailData.swift b/BoxOffice2/Domain/Entities/MovieDetailData.swift new file mode 100644 index 0000000..0a84c4a --- /dev/null +++ b/BoxOffice2/Domain/Entities/MovieDetailData.swift @@ -0,0 +1,25 @@ +// +// MovieDetailData.swift +// BoxOffice2 +// +// Created by 이원빈 on 2023/02/23. +// + +struct MovieDetailData { + let uuid: String + let posterURL: String + let currentRank: String + let title: String + let openDate: String + let totalAudience: String + let rankChange: String + let isNewEntry: Bool + let productionYear: String + let openYear: String + let showTime: String + let genreName: String + let directorName: String + let actors: [String] + let ageLimit: String +} + diff --git a/BoxOffice2/Domain/Interfaces/MovieRepository.swift b/BoxOffice2/Domain/Interfaces/MovieRepository.swift new file mode 100644 index 0000000..daccf74 --- /dev/null +++ b/BoxOffice2/Domain/Interfaces/MovieRepository.swift @@ -0,0 +1,11 @@ +// +// MovieRepository.swift +// BoxOffice2 +// +// Created by 이원빈 on 2023/02/23. +// + +protocol MovieRepository { + func fetchMovies() -> [MovieCellData] + func fetchMovieDetail() -> MovieDetailData +} diff --git a/BoxOffice2/Domain/UseCases/SearchMovieDetailUseCase.swift b/BoxOffice2/Domain/UseCases/SearchMovieDetailUseCase.swift new file mode 100644 index 0000000..0a5d597 --- /dev/null +++ b/BoxOffice2/Domain/UseCases/SearchMovieDetailUseCase.swift @@ -0,0 +1,19 @@ +// +// SearchMovieDetailUseCase.swift +// BoxOffice2 +// +// Created by 이원빈 on 2023/02/23. +// + + +protocol SearchMovieDetailUseCase { + func execute() -> MovieDetailData +} + +struct DefaultSearchMovieDetailUseCase: SearchMovieDetailUseCase { + let movieRepository: MovieRepository + + func execute() -> MovieDetailData { + return movieRepository.fetchMovieDetail() + } +} diff --git a/BoxOffice2/Domain/UseCases/SearchMoviesUseCase.swift b/BoxOffice2/Domain/UseCases/SearchMoviesUseCase.swift new file mode 100644 index 0000000..9f4f6bb --- /dev/null +++ b/BoxOffice2/Domain/UseCases/SearchMoviesUseCase.swift @@ -0,0 +1,18 @@ +// +// SearchMoviesUseCase.swift +// BoxOffice2 +// +// Created by 이원빈 on 2023/02/23. +// + +protocol SearchMoviesUseCase { + func execute() -> [MovieCellData] +} + +struct DefaultSearchMoviesUseCase: SearchMoviesUseCase { + let movieRepository: MovieRepository + + func execute() -> [MovieCellData] { + return movieRepository.fetchMovies() + } +}