Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

Refactored Color to Extension | Move genre code to Model #39

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
36 changes: 8 additions & 28 deletions MovieApp/MovieApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
objects = {

/* Begin PBXBuildFile section */
7D0408B72A94815200402458 /* Cache.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D0408B62A94815200402458 /* Cache.swift */; };
7D15F0D727D6F0AE0029C40F /* CreditTableViewDescriptionCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D15F0D627D6F0AE0029C40F /* CreditTableViewDescriptionCell.swift */; };
7D15F0DA27D726E50029C40F /* CreditFootherView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D15F0D927D726E50029C40F /* CreditFootherView.swift */; };
7D1979E827BE0C9A00CD3DB9 /* Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D1979E727BE0C9A00CD3DB9 /* Extensions.swift */; };
Expand All @@ -25,7 +24,6 @@
7D40A07F27BCC33D002C21FE /* IconLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D40A07E27BCC33D002C21FE /* IconLabel.swift */; };
7D40A08127BCC91E002C21FE /* DescriptionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D40A08027BCC91E002C21FE /* DescriptionView.swift */; };
7D40A08327BCD362002C21FE /* DoubleColumDescriptionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D40A08227BCD362002C21FE /* DoubleColumDescriptionView.swift */; };
7D7A7D3A2A7E744100E7879A /* ImageCacheManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D7A7D392A7E744100E7879A /* ImageCacheManager.swift */; };
7D8740F527841F5600E92C72 /* Constant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D8740F427841F5600E92C72 /* Constant.swift */; };
7D88534027BA1E7500CC915E /* DetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D88533F27BA1E7500CC915E /* DetailViewController.swift */; };
7D88534327BA371D00CC915E /* DetailViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D88534227BA371D00CC915E /* DetailViewModel.swift */; };
Expand All @@ -39,14 +37,14 @@
7DDE9C2D2787D6EE00938996 /* MainTabBarController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DDE9C2C2787D6EE00938996 /* MainTabBarController.swift */; };
7DDE9C302787E0C700938996 /* ChartViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DDE9C2F2787E0C700938996 /* ChartViewController.swift */; };
7DDE9C322788045B00938996 /* ChartTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DDE9C312788045B00938996 /* ChartTableViewCell.swift */; };
7DE8154327910DDC00726799 /* Keys.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DE8154227910DDC00726799 /* Keys.swift */; };
945E07952AC1BAF600A54568 /* Keys.swift in Sources */ = {isa = PBXBuildFile; fileRef = 945E07942AC1BAF600A54568 /* Keys.swift */; };
945E07972AC1BC8900A54568 /* GenreModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 945E07962AC1BC8900A54568 /* GenreModel.swift */; };
9F38C115EB6AF0EEE6B8E0C5 /* Pods_MovieApp.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1333EC5F83FAB13E0CD0D899 /* Pods_MovieApp.framework */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
1333EC5F83FAB13E0CD0D899 /* Pods_MovieApp.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_MovieApp.framework; sourceTree = BUILT_PRODUCTS_DIR; };
4940141FE31A8FDE1F3A884C /* Pods-MovieApp.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MovieApp.debug.xcconfig"; path = "Target Support Files/Pods-MovieApp/Pods-MovieApp.debug.xcconfig"; sourceTree = "<group>"; };
7D0408B62A94815200402458 /* Cache.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Cache.swift; sourceTree = "<group>"; };
7D15F0D627D6F0AE0029C40F /* CreditTableViewDescriptionCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreditTableViewDescriptionCell.swift; sourceTree = "<group>"; };
7D15F0D927D726E50029C40F /* CreditFootherView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreditFootherView.swift; sourceTree = "<group>"; };
7D1979E727BE0C9A00CD3DB9 /* Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Extensions.swift; sourceTree = "<group>"; };
Expand All @@ -66,7 +64,6 @@
7D40A07E27BCC33D002C21FE /* IconLabel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IconLabel.swift; sourceTree = "<group>"; };
7D40A08027BCC91E002C21FE /* DescriptionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DescriptionView.swift; sourceTree = "<group>"; };
7D40A08227BCD362002C21FE /* DoubleColumDescriptionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DoubleColumDescriptionView.swift; sourceTree = "<group>"; };
7D7A7D392A7E744100E7879A /* ImageCacheManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageCacheManager.swift; sourceTree = "<group>"; };
7D8740F427841F5600E92C72 /* Constant.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Constant.swift; sourceTree = "<group>"; };
7D88533F27BA1E7500CC915E /* DetailViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailViewController.swift; sourceTree = "<group>"; };
7D88534227BA371D00CC915E /* DetailViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailViewModel.swift; sourceTree = "<group>"; };
Expand All @@ -80,7 +77,8 @@
7DDE9C2C2787D6EE00938996 /* MainTabBarController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainTabBarController.swift; sourceTree = "<group>"; };
7DDE9C2F2787E0C700938996 /* ChartViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChartViewController.swift; sourceTree = "<group>"; };
7DDE9C312788045B00938996 /* ChartTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChartTableViewCell.swift; sourceTree = "<group>"; };
7DE8154227910DDC00726799 /* Keys.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Keys.swift; sourceTree = "<group>"; };
945E07942AC1BAF600A54568 /* Keys.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Keys.swift; sourceTree = "<group>"; };
945E07962AC1BC8900A54568 /* GenreModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GenreModel.swift; sourceTree = "<group>"; };
FDA2E981A792A2B7397508AB /* Pods-MovieApp.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MovieApp.release.xcconfig"; path = "Target Support Files/Pods-MovieApp/Pods-MovieApp.release.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */

Expand Down Expand Up @@ -141,15 +139,6 @@
path = MovieApp;
sourceTree = "<group>";
};
7D1D5DE62A8FB0500007E953 /* Cache */ = {
isa = PBXGroup;
children = (
7D7A7D392A7E744100E7879A /* ImageCacheManager.swift */,
7D0408B62A94815200402458 /* Cache.swift */,
);
path = Cache;
sourceTree = "<group>";
};
7D2DD61F278537A7000EBDE0 /* DiscoverView */ = {
isa = PBXGroup;
children = (
Expand All @@ -163,7 +152,6 @@
7D37ADA5278D5D3D004BBFF9 /* Domain */ = {
isa = PBXGroup;
children = (
7D7A7D362A7E731B00E7879A /* Utils */,
7D37ADA7278D5D50004BBFF9 /* Model */,
7D37ADA6278D5D48004BBFF9 /* Service */,
);
Expand All @@ -174,7 +162,7 @@
isa = PBXGroup;
children = (
7D37AD9F278D5C97004BBFF9 /* APIService.swift */,
7DE8154227910DDC00726799 /* Keys.swift */,
945E07942AC1BAF600A54568 /* Keys.swift */,
);
path = Service;
sourceTree = "<group>";
Expand All @@ -185,6 +173,7 @@
7D37ADA1278D5CE7004BBFF9 /* MovieList.swift */,
7D9D9F49278E928C0098FEA3 /* MovieFront.swift */,
7D202FAD27B262A6008F8051 /* MovieDetail.swift */,
945E07962AC1BC8900A54568 /* GenreModel.swift */,
);
path = Model;
sourceTree = "<group>";
Expand All @@ -199,14 +188,6 @@
path = CustomView;
sourceTree = "<group>";
};
7D7A7D362A7E731B00E7879A /* Utils */ = {
isa = PBXGroup;
children = (
7D1D5DE62A8FB0500007E953 /* Cache */,
);
path = Utils;
sourceTree = "<group>";
};
7D88533E27BA1E5200CC915E /* DetailView */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -433,16 +414,15 @@
7D40A07F27BCC33D002C21FE /* IconLabel.swift in Sources */,
7D88534027BA1E7500CC915E /* DetailViewController.swift in Sources */,
7DDE9C302787E0C700938996 /* ChartViewController.swift in Sources */,
7D0408B72A94815200402458 /* Cache.swift in Sources */,
7D9D9F4A278E928C0098FEA3 /* MovieFront.swift in Sources */,
7D7A7D3A2A7E744100E7879A /* ImageCacheManager.swift in Sources */,
7D947CA9278C03E00031C7C9 /* CreditViewController.swift in Sources */,
7DE8154327910DDC00726799 /* Keys.swift in Sources */,
7D90EC1B27D5EC160099B485 /* CreditHeaderView.swift in Sources */,
7DC7D34727913C89005C3D9C /* DiscoverViewModel.swift in Sources */,
7D15F0DA27D726E50029C40F /* CreditFootherView.swift in Sources */,
7DC7D34A27913E8F005C3D9C /* ChartViewModel.swift in Sources */,
945E07972AC1BC8900A54568 /* GenreModel.swift in Sources */,
7D1982F02782D77500F2E745 /* SceneDelegate.swift in Sources */,
945E07952AC1BAF600A54568 /* Keys.swift in Sources */,
7D8740F527841F5600E92C72 /* Constant.swift in Sources */,
7D90EC1927D5DA310099B485 /* CreditSection.swift in Sources */,
);
Expand Down
30 changes: 0 additions & 30 deletions MovieApp/MovieApp/Constant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,6 @@

import Foundation


struct Colors {
static let background = "BgColor"
static let light_background = "LightBgColor"
static let placeholder = "PlaceholderTextColor"
}

struct identifiers {
static let discover_collection_cell = "DiscoverCollectionCell"
static let discover_collection_header = "DiscoverCollectionHeader"
Expand All @@ -26,26 +19,3 @@ struct identifiers {
static let detail_trailer_collection_Cell = "DetailTrailerCollectionCell"
static let detail_cast_collection_Cell = "DetailCastCollectionCell"
}


let genreCode = [
28 : "Action",
12 : "Adventure",
16 : "Animation",
35 : "Comedy",
80 : "Crime",
99 : "Documentary",
18 : "Drama",
10751 : "Family",
14 : "Fantasy",
36 : "History",
27 : "Horror",
10402 : "Music",
9648 : "Mystery",
10749 : "Romance",
878 : "Science Fiction",
10770 : "TV Movie",
53 : "Thriller",
10752 : "War",
37 : "Western"
]
30 changes: 30 additions & 0 deletions MovieApp/MovieApp/Domain/Model/GenreModel.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//
// GenreModel.swift
// MovieApp
//
// Created by Aakif Nadeem on 25/09/2023.
//

import Foundation

let genreCode = [
28 : "Action",
12 : "Adventure",
16 : "Animation",
35 : "Comedy",
80 : "Crime",
99 : "Documentary",
18 : "Drama",
10751 : "Family",
14 : "Fantasy",
36 : "History",
27 : "Horror",
10402 : "Music",
9648 : "Mystery",
10749 : "Romance",
878 : "Science Fiction",
10770 : "TV Movie",
53 : "Thriller",
10752 : "War",
37 : "Western"
]
12 changes: 3 additions & 9 deletions MovieApp/MovieApp/Domain/Service/APIService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class APIService {
return "https://api.themoviedb.org/3/movie/\(id)?api_key=\(APIKey)&language=\(language)"
}

static func configureUrlString(imagePath: String) -> String {
static func configureUrlString(imagePath: String) -> String{
return "https://image.tmdb.org/t/p/original/\(imagePath)"
}

Expand All @@ -29,26 +29,20 @@ class APIService {

static func fetchRequest(url: String, retries: Int, onComplete: @escaping (Result<Data, Error>) -> Void) {

guard let Url = URL(string: url) else {
print("Error: invalid url")
return
}
guard let Url = URL(string: url) else { return }

let task = URLSession(configuration: .default).dataTask(with: Url) { (data, response, error) in
if let error = error {
print("Error: \(error.localizedDescription)")
onComplete(.failure(error))
return
}

guard let safeData = data else {
guard let httpResponse = response as? HTTPURLResponse else { return }
print("Error: no data")
let httpResponse = response as! HTTPURLResponse
onComplete(.failure(NSError(domain: "no data", code: httpResponse.statusCode, userInfo: nil)))
return
}
onComplete(.success(safeData))

}
task.resume()
}
Expand Down
98 changes: 0 additions & 98 deletions MovieApp/MovieApp/Domain/Utils/Cache/Cache.swift

This file was deleted.

Loading