diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 6377004..0000000 Binary files a/.DS_Store and /dev/null differ diff --git a/NetflixCloneApp/.gitignore b/.gitignore similarity index 99% rename from NetflixCloneApp/.gitignore rename to .gitignore index b583f53..dc86e33 100644 --- a/NetflixCloneApp/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -MovieInfo.plist +API.plist .DS_Store # Created by https://www.toptal.com/developers/gitignore/api/swift @@ -60,6 +60,7 @@ playground.xcworkspace # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control # Pods/ # Add this line if you want to avoid checking in source code from the Xcode workspace + *.xcworkspace # Carthage diff --git a/NetflixCloneApp/NetflixCloneApp.xcodeproj/project.pbxproj b/NetflixCloneApp/NetflixCloneApp.xcodeproj/project.pbxproj index 115a8b7..c72407f 100644 --- a/NetflixCloneApp/NetflixCloneApp.xcodeproj/project.pbxproj +++ b/NetflixCloneApp/NetflixCloneApp.xcodeproj/project.pbxproj @@ -8,18 +8,19 @@ /* Begin PBXBuildFile section */ 59814AB850FBDA6D727AD2DA /* Pods_NetflixCloneApp.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 501F4B9AB8AA132693F4199F /* Pods_NetflixCloneApp.framework */; }; - C1209EBF28D1796900DEDCFD /* ThumbnailsVIew.swift in Sources */ = {isa = PBXBuildFile; fileRef = C1209EBE28D1796900DEDCFD /* ThumbnailsVIew.swift */; }; - C1398AC928C74611001E6E20 /* WebService.swift in Sources */ = {isa = PBXBuildFile; fileRef = C1398AC828C74611001E6E20 /* WebService.swift */; }; + C1209EC228D1EC8D00DEDCFD /* API.plist in Resources */ = {isa = PBXBuildFile; fileRef = C1209EC128D1EC8D00DEDCFD /* API.plist */; }; + C1314B8F28DBE22E008A2F80 /* DetailContentsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C1314B8E28DBE22E008A2F80 /* DetailContentsView.swift */; }; C17869E828C0950C00C4EFBA /* MainHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C17869E728C0950C00C4EFBA /* MainHeaderView.swift */; }; C17869EA28C0A24D00C4EFBA /* Contents.swift in Sources */ = {isa = PBXBuildFile; fileRef = C17869E928C0A24D00C4EFBA /* Contents.swift */; }; C17869EC28C0A3B100C4EFBA /* MainTabView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C17869EB28C0A3B100C4EFBA /* MainTabView.swift */; }; C17869F128C233D700C4EFBA /* MovieViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C17869F028C233D700C4EFBA /* MovieViewModel.swift */; }; - C17869F928C24FBF00C4EFBA /* URLImage in Frameworks */ = {isa = PBXBuildFile; productRef = C17869F828C24FBF00C4EFBA /* URLImage */; }; C17869FB28C2A3F400C4EFBA /* RecommendView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C17869FA28C2A3F400C4EFBA /* RecommendView.swift */; }; C17869FD28C2A3FD00C4EFBA /* SearchView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C17869FC28C2A3FD00C4EFBA /* SearchView.swift */; }; C17869FF28C2A42000C4EFBA /* StoreView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C17869FE28C2A42000C4EFBA /* StoreView.swift */; }; C1786A0328C408CF00C4EFBA /* MyNetflixBundle.swift in Sources */ = {isa = PBXBuildFile; fileRef = C1786A0228C408CF00C4EFBA /* MyNetflixBundle.swift */; }; - C1786A0528C6BC6D00C4EFBA /* MovieInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = C1786A0428C6BC6D00C4EFBA /* MovieInfo.plist */; }; + C192A1D728D1F0E00090D863 /* DetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C192A1D628D1F0E00090D863 /* DetailView.swift */; }; + C192A1D928D1F1020090D863 /* DetailViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C192A1D828D1F1020090D863 /* DetailViewModel.swift */; }; + C1CA705728D2AAF40007EAE5 /* ImageLoader.swift in Sources */ = {isa = PBXBuildFile; fileRef = C1CA705628D2AAF40007EAE5 /* ImageLoader.swift */; }; C1F9A25D28BCF09F00E29F77 /* NetflixCloneAppApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = C1F9A25C28BCF09F00E29F77 /* NetflixCloneAppApp.swift */; }; C1F9A25F28BCF09F00E29F77 /* MainView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C1F9A25E28BCF09F00E29F77 /* MainView.swift */; }; C1F9A26128BCF0A400E29F77 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C1F9A26028BCF0A400E29F77 /* Assets.xcassets */; }; @@ -30,8 +31,8 @@ 501F4B9AB8AA132693F4199F /* Pods_NetflixCloneApp.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_NetflixCloneApp.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 5966523523CB42FF853DBF00 /* Pods-NetflixCloneApp.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-NetflixCloneApp.debug.xcconfig"; path = "Target Support Files/Pods-NetflixCloneApp/Pods-NetflixCloneApp.debug.xcconfig"; sourceTree = ""; }; AD975C9F232C3BD333327CBB /* Pods-NetflixCloneApp.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-NetflixCloneApp.release.xcconfig"; path = "Target Support Files/Pods-NetflixCloneApp/Pods-NetflixCloneApp.release.xcconfig"; sourceTree = ""; }; - C1209EBE28D1796900DEDCFD /* ThumbnailsVIew.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThumbnailsVIew.swift; sourceTree = ""; }; - C1398AC828C74611001E6E20 /* WebService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebService.swift; sourceTree = ""; }; + C1209EC128D1EC8D00DEDCFD /* API.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = API.plist; sourceTree = ""; }; + C1314B8E28DBE22E008A2F80 /* DetailContentsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailContentsView.swift; sourceTree = ""; }; C17869E728C0950C00C4EFBA /* MainHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainHeaderView.swift; sourceTree = ""; }; C17869E928C0A24D00C4EFBA /* Contents.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Contents.swift; sourceTree = ""; }; C17869EB28C0A3B100C4EFBA /* MainTabView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainTabView.swift; sourceTree = ""; }; @@ -40,7 +41,9 @@ C17869FC28C2A3FD00C4EFBA /* SearchView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchView.swift; sourceTree = ""; }; C17869FE28C2A42000C4EFBA /* StoreView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StoreView.swift; sourceTree = ""; }; C1786A0228C408CF00C4EFBA /* MyNetflixBundle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyNetflixBundle.swift; sourceTree = ""; }; - C1786A0428C6BC6D00C4EFBA /* MovieInfo.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = MovieInfo.plist; sourceTree = ""; }; + C192A1D628D1F0E00090D863 /* DetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailView.swift; sourceTree = ""; }; + C192A1D828D1F1020090D863 /* DetailViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailViewModel.swift; sourceTree = ""; }; + C1CA705628D2AAF40007EAE5 /* ImageLoader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageLoader.swift; sourceTree = ""; }; C1F9A25928BCF09F00E29F77 /* NetflixCloneApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = NetflixCloneApp.app; sourceTree = BUILT_PRODUCTS_DIR; }; C1F9A25C28BCF09F00E29F77 /* NetflixCloneAppApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetflixCloneAppApp.swift; sourceTree = ""; }; C1F9A25E28BCF09F00E29F77 /* MainView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainView.swift; sourceTree = ""; }; @@ -53,7 +56,6 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - C17869F928C24FBF00C4EFBA /* URLImage in Frameworks */, 59814AB850FBDA6D727AD2DA /* Pods_NetflixCloneApp.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -94,20 +96,12 @@ path = Model; sourceTree = ""; }; - C17869F328C2393800C4EFBA /* View */ = { - isa = PBXGroup; - children = ( - ); - path = View; - sourceTree = ""; - }; C1786A0028C2A43600C4EFBA /* Main */ = { isa = PBXGroup; children = ( C17869EB28C0A3B100C4EFBA /* MainTabView.swift */, C17869E728C0950C00C4EFBA /* MainHeaderView.swift */, C1F9A25E28BCF09F00E29F77 /* MainView.swift */, - C1209EBE28D1796900DEDCFD /* ThumbnailsVIew.swift */, ); path = Main; sourceTree = ""; @@ -116,10 +110,21 @@ isa = PBXGroup; children = ( C1786A0228C408CF00C4EFBA /* MyNetflixBundle.swift */, + C1CA705628D2AAF40007EAE5 /* ImageLoader.swift */, ); path = Resources; sourceTree = ""; }; + C192A1D528D1F0B00090D863 /* Detail */ = { + isa = PBXGroup; + children = ( + C192A1D828D1F1020090D863 /* DetailViewModel.swift */, + C192A1D628D1F0E00090D863 /* DetailView.swift */, + C1314B8E28DBE22E008A2F80 /* DetailContentsView.swift */, + ); + name = Detail; + sourceTree = ""; + }; C1F9A25028BCF09F00E29F77 = { isa = PBXGroup; children = ( @@ -141,9 +146,9 @@ C1F9A25B28BCF09F00E29F77 /* NetflixCloneApp */ = { isa = PBXGroup; children = ( + C192A1D528D1F0B00090D863 /* Detail */, C1786A0128C4087600C4EFBA /* Resources */, C1786A0028C2A43600C4EFBA /* Main */, - C17869F328C2393800C4EFBA /* View */, C17869F228C2392F00C4EFBA /* Model */, C17869ED28C2337100C4EFBA /* ViewModel */, C1F9A25C28BCF09F00E29F77 /* NetflixCloneAppApp.swift */, @@ -152,8 +157,7 @@ C17869FA28C2A3F400C4EFBA /* RecommendView.swift */, C17869FC28C2A3FD00C4EFBA /* SearchView.swift */, C17869FE28C2A42000C4EFBA /* StoreView.swift */, - C1786A0428C6BC6D00C4EFBA /* MovieInfo.plist */, - C1398AC828C74611001E6E20 /* WebService.swift */, + C1209EC128D1EC8D00DEDCFD /* API.plist */, ); path = NetflixCloneApp; sourceTree = ""; @@ -185,7 +189,6 @@ ); name = NetflixCloneApp; packageProductDependencies = ( - C17869F828C24FBF00C4EFBA /* URLImage */, ); productName = NetflixCloneApp; productReference = C1F9A25928BCF09F00E29F77 /* NetflixCloneApp.app */; @@ -216,7 +219,6 @@ ); mainGroup = C1F9A25028BCF09F00E29F77; packageReferences = ( - C17869F728C24FBF00C4EFBA /* XCRemoteSwiftPackageReference "url-image" */, ); productRefGroup = C1F9A25A28BCF09F00E29F77 /* Products */; projectDirPath = ""; @@ -233,8 +235,8 @@ buildActionMask = 2147483647; files = ( C1F9A26428BCF0A400E29F77 /* Preview Assets.xcassets in Resources */, - C1786A0528C6BC6D00C4EFBA /* MovieInfo.plist in Resources */, C1F9A26128BCF0A400E29F77 /* Assets.xcassets in Resources */, + C1209EC228D1EC8D00DEDCFD /* API.plist in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -287,14 +289,16 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - C1398AC928C74611001E6E20 /* WebService.swift in Sources */, - C1209EBF28D1796900DEDCFD /* ThumbnailsVIew.swift in Sources */, C1F9A25F28BCF09F00E29F77 /* MainView.swift in Sources */, + C1CA705728D2AAF40007EAE5 /* ImageLoader.swift in Sources */, C17869E828C0950C00C4EFBA /* MainHeaderView.swift in Sources */, C17869EA28C0A24D00C4EFBA /* Contents.swift in Sources */, C1F9A25D28BCF09F00E29F77 /* NetflixCloneAppApp.swift in Sources */, C1786A0328C408CF00C4EFBA /* MyNetflixBundle.swift in Sources */, + C192A1D728D1F0E00090D863 /* DetailView.swift in Sources */, C17869FD28C2A3FD00C4EFBA /* SearchView.swift in Sources */, + C192A1D928D1F1020090D863 /* DetailViewModel.swift in Sources */, + C1314B8F28DBE22E008A2F80 /* DetailContentsView.swift in Sources */, C17869EC28C0A3B100C4EFBA /* MainTabView.swift in Sources */, C17869F128C233D700C4EFBA /* MovieViewModel.swift in Sources */, C17869FF28C2A42000C4EFBA /* StoreView.swift in Sources */, @@ -503,25 +507,6 @@ defaultConfigurationName = Release; }; /* End XCConfigurationList section */ - -/* Begin XCRemoteSwiftPackageReference section */ - C17869F728C24FBF00C4EFBA /* XCRemoteSwiftPackageReference "url-image" */ = { - isa = XCRemoteSwiftPackageReference; - repositoryURL = "https://github.com/dmytro-anokhin/url-image.git"; - requirement = { - kind = upToNextMajorVersion; - minimumVersion = 3.0.0; - }; - }; -/* End XCRemoteSwiftPackageReference section */ - -/* Begin XCSwiftPackageProductDependency section */ - C17869F828C24FBF00C4EFBA /* URLImage */ = { - isa = XCSwiftPackageProductDependency; - package = C17869F728C24FBF00C4EFBA /* XCRemoteSwiftPackageReference "url-image" */; - productName = URLImage; - }; -/* End XCSwiftPackageProductDependency section */ }; rootObject = C1F9A25128BCF09F00E29F77 /* Project object */; } diff --git a/NetflixCloneApp/NetflixCloneApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/NetflixCloneApp/NetflixCloneApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 919434a..0000000 --- a/NetflixCloneApp/NetflixCloneApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/NetflixCloneApp/NetflixCloneApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/NetflixCloneApp/NetflixCloneApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist deleted file mode 100644 index 18d9810..0000000 --- a/NetflixCloneApp/NetflixCloneApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +++ /dev/null @@ -1,8 +0,0 @@ - - - - - IDEDidComputeMac32BitWarning - - - diff --git a/NetflixCloneApp/NetflixCloneApp.xcodeproj/project.xcworkspace/xcuserdata/mangon.xcuserdatad/UserInterfaceState.xcuserstate b/NetflixCloneApp/NetflixCloneApp.xcodeproj/project.xcworkspace/xcuserdata/mangon.xcuserdatad/UserInterfaceState.xcuserstate deleted file mode 100644 index f4a2cd1..0000000 Binary files a/NetflixCloneApp/NetflixCloneApp.xcodeproj/project.xcworkspace/xcuserdata/mangon.xcuserdatad/UserInterfaceState.xcuserstate and /dev/null differ diff --git a/NetflixCloneApp/NetflixCloneApp.xcodeproj/xcuserdata/mangon.xcuserdatad/xcschemes/xcschememanagement.plist b/NetflixCloneApp/NetflixCloneApp.xcodeproj/xcuserdata/mangon.xcuserdatad/xcschemes/xcschememanagement.plist deleted file mode 100644 index 1e40804..0000000 --- a/NetflixCloneApp/NetflixCloneApp.xcodeproj/xcuserdata/mangon.xcuserdatad/xcschemes/xcschememanagement.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - SchemeUserState - - NetflixCloneApp.xcscheme_^#shared#^_ - - orderHint - 2 - - - SuppressBuildableAutocreation - - C1F9A25828BCF09F00E29F77 - - primary - - - - - diff --git a/NetflixCloneApp/NetflixCloneApp.xcworkspace/contents.xcworkspacedata b/NetflixCloneApp/NetflixCloneApp.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 12c9c06..0000000 --- a/NetflixCloneApp/NetflixCloneApp.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - diff --git a/NetflixCloneApp/NetflixCloneApp.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/NetflixCloneApp/NetflixCloneApp.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist deleted file mode 100644 index 18d9810..0000000 --- a/NetflixCloneApp/NetflixCloneApp.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +++ /dev/null @@ -1,8 +0,0 @@ - - - - - IDEDidComputeMac32BitWarning - - - diff --git a/NetflixCloneApp/NetflixCloneApp.xcworkspace/xcshareddata/swiftpm/Package.resolved b/NetflixCloneApp/NetflixCloneApp.xcworkspace/xcshareddata/swiftpm/Package.resolved deleted file mode 100644 index 0abc379..0000000 --- a/NetflixCloneApp/NetflixCloneApp.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ /dev/null @@ -1,14 +0,0 @@ -{ - "pins" : [ - { - "identity" : "url-image", - "kind" : "remoteSourceControl", - "location" : "https://github.com/dmytro-anokhin/url-image.git", - "state" : { - "revision" : "4042f955f1fdff00ced85545e1eecdbf969b5cd0", - "version" : "3.1.1" - } - } - ], - "version" : 2 -} diff --git a/NetflixCloneApp/NetflixCloneApp.xcworkspace/xcuserdata/mangon.xcuserdatad/UserInterfaceState.xcuserstate b/NetflixCloneApp/NetflixCloneApp.xcworkspace/xcuserdata/mangon.xcuserdatad/UserInterfaceState.xcuserstate deleted file mode 100644 index 3fcc681..0000000 Binary files a/NetflixCloneApp/NetflixCloneApp.xcworkspace/xcuserdata/mangon.xcuserdatad/UserInterfaceState.xcuserstate and /dev/null differ diff --git a/NetflixCloneApp/NetflixCloneApp.xcworkspace/xcuserdata/mangon.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/NetflixCloneApp/NetflixCloneApp.xcworkspace/xcuserdata/mangon.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist deleted file mode 100644 index 9a13acf..0000000 --- a/NetflixCloneApp/NetflixCloneApp.xcworkspace/xcuserdata/mangon.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ /dev/null @@ -1,197 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/NetflixCloneApp/NetflixCloneApp/DetailContentsView.swift b/NetflixCloneApp/NetflixCloneApp/DetailContentsView.swift new file mode 100644 index 0000000..6fc283b --- /dev/null +++ b/NetflixCloneApp/NetflixCloneApp/DetailContentsView.swift @@ -0,0 +1,45 @@ +// +// DetailContentsView.swift +// NetflixCloneApp +// +// Created by 정명곤 on 2022/09/22. +// + +import SwiftUI + +struct DetailContentsView: View { + var body: some View { + ZStack { + Color.black + .ignoresSafeArea() + + HStack { + VStack { + Capsule() + .foregroundColor(.red) + .frame(height: 8) + Text("회차") + .font(.system(size: 20).bold()) + .foregroundColor(.white) + + } + VStack { + Capsule() + .foregroundColor(.red) + .frame(height: 8) + Text("함께 시청된 콘텐츠") + .font(.system(size: 20).bold()) + .foregroundColor(.white) + + } + + } + } + } +} + +struct DetailContentsView_Previews: PreviewProvider { + static var previews: some View { + DetailContentsView() + } +} diff --git a/NetflixCloneApp/NetflixCloneApp/DetailView.swift b/NetflixCloneApp/NetflixCloneApp/DetailView.swift new file mode 100644 index 0000000..1ca5ce2 --- /dev/null +++ b/NetflixCloneApp/NetflixCloneApp/DetailView.swift @@ -0,0 +1,153 @@ +// +// DetailView.swift +// NetflixCloneApp +// +// Created by 정명곤 on 2022/09/14. +// + +import SwiftUI + + +struct DetailView: View { + @State var selectedTab: DetailViewModel = . + private var info: Contents + + init(_ info: Contents) { + self.info = info + } + + var body: some View { + ZStack { + VStack(alignment: .leading) { + ZStack(alignment: .topTrailing) { + + AsyncImage(url: URL(string: "https://image.tmdb.org/t/p/w500\(info.backdrop_path!)")) { image in + image.resizable() + .frame(width: 378, height: 180, alignment: .center) + .aspectRatio(contentMode: .fill) + } placeholder: { + Rectangle() + .frame(width: 378, height: 180, alignment: .center) + .foregroundColor(.gray) + } + HStack { + ZStack { + Circle() + .frame(width: 30, height: 30, alignment: .center) + .foregroundColor(.black) + Image(systemName: "tv") + .resizable() + .frame(width: 15, height: 15, alignment: .center) + .font(.headline) + .foregroundColor(.gray) + } + ZStack { + Circle() + .frame(width: 30, height: 30, alignment: .center) + .foregroundColor(.black) + .padding(.trailing) + Image(systemName: "xmark") + .resizable() + .frame(width: 12, height: 12, alignment: .center) + .padding(.trailing) + .font(.headline) + .foregroundColor(.gray) + } + } + .padding(.top, 10) + } + + + ZStack(alignment: .topLeading) { + ScrollView() { + VStack(alignment: .leading) { + Text(info.title!) + .foregroundColor(.white) + + HStack { + Text("New") + .foregroundColor(.green) + + Text("1996") + .foregroundColor(.white) + + Rectangle() + .frame(width: 25, alignment: .center) + .foregroundColor(.gray) + .cornerRadius(2) + + Text("시즌 8개") + .foregroundColor(.white) + + Text("HD") + .frame(width: 30, alignment: .center) + .foregroundColor(.gray) + .font(.system(size: 15, weight: .bold)) + .border(.gray, width: 2) + .cornerRadius(2) + + } + VStack { + + Button { + print("재생") + } label: { + HStack { + Image(systemName: "play.fill") + .font(.headline) + Text("재생") + .font(.headline) + } + } + .foregroundColor(.black) + .frame(width: 378, height: 40, alignment: .center) + .background(.white) + .cornerRadius(9) + + Button { + print("재생") + } label: { + HStack { + Image(systemName: "arrow.down.to.line.compact") + .font(.headline) + Text("저장") + .font(.headline) + } + + } + .foregroundColor(.black) + .frame(width: 378, height: 40, alignment: .center) + .background(.gray) + .cornerRadius(9) + + } + + VStack(alignment: .leading) { + Text(info.overview!) + .foregroundColor(.white) + .font(.headline) + + Text("출연: JMG") + .foregroundColor(.gray) + .font(.subheadline) + .padding(.vertical, 10) + } + + } + .frame(width: 378, alignment: .center) + } + + } + } + .ignoresSafeArea(.all) + .background(.black) + } + } +} + + +struct DetailView_Previews: PreviewProvider { + static var previews: some View { + DetailView(Contents(id: 1, backdrop_path: "/jsoz1HlxczSuTx0mDl2h0lxy36l.jpg", title: "Thor: Love and Thunder", original_language: "en", original_title: "title", overview: "After his retirement is interrupted by Gorr the God Butcher, a galactic killer who seeks the extinction of the gods, Thor Odinson enlists the help of King Valkyrie, Korg, and ex-girlfriend Jane Foster, who now wields Mjolnir as the Mighty Thor. Together they embark upon a harrowing cosmic adventure to uncover the mystery of the God Butcher’s vengeance and stop him before it’s too late.", poster_path: "/pIkRyD18kl4FhoCNQuWxWu5cBLM.jpg", media_type: "movie", popularity: 1.23, release_date: "", vote_average: 1.23)) + } +} diff --git a/NetflixCloneApp/NetflixCloneApp/DetailViewModel.swift b/NetflixCloneApp/NetflixCloneApp/DetailViewModel.swift new file mode 100644 index 0000000..4e2fe34 --- /dev/null +++ b/NetflixCloneApp/NetflixCloneApp/DetailViewModel.swift @@ -0,0 +1,16 @@ +// +// DetailViewModel.swift +// NetflixCloneApp +// +// Created by 정명곤 on 2022/09/14. +// + +import Foundation + + +enum DetailViewModel: Int, CaseIterable { + + case Round = + case + +} diff --git a/NetflixCloneApp/NetflixCloneApp/Main/MainView.swift b/NetflixCloneApp/NetflixCloneApp/Main/MainView.swift index b56ad51..eb1ef7b 100644 --- a/NetflixCloneApp/NetflixCloneApp/Main/MainView.swift +++ b/NetflixCloneApp/NetflixCloneApp/Main/MainView.swift @@ -3,6 +3,8 @@ import SwiftUI struct MainView: View { @ObservedObject var viewModel = MovieViewModel() + @State var isPresented = false + private let sectionTitle = ["몰아보기 추천! 긴장감 넘치는 해외 시리즈", "지금 뜨는 콘텐츠", "넷플릭스 인기 콘텐츠"] var body: some View { @@ -11,9 +13,45 @@ struct MainView: View { ScrollView() { MainHeaderView() - ForEach(sectionTitle, id:\.self) { section in - ThumbnailsVIew(section) + VStack(alignment: .leading) { + Text(sectionTitle[0]) + .font(.headline) + .fontWeight(.bold) + .foregroundColor(.white) + .padding(.horizontal, 5) + + + ScrollView(.horizontal) { + HStack{ + ForEach(viewModel.contents ?? []) { content in + Group { + Button { + self.isPresented = true + } label: { + AsyncImage(url: URL(string: "https://image.tmdb.org/t/p/w500\(content.poster_path!)")) { image in + image.resizable() + } placeholder: { + Rectangle() + .frame(width: 120, height: 180, alignment: .center) + .foregroundColor(.gray) + } + .frame(width: 120, height: 180, alignment: .center) + } + .sheet(isPresented: self.$isPresented) { + DetailView(content) + } + + + + } + } + } + + } } + .frame(height: 220) + .background(.black) + } .background(.black) @@ -21,6 +59,8 @@ struct MainView: View { .ignoresSafeArea(.all, edges: .top) } .navigationViewStyle(StackNavigationViewStyle()) + .background(.black) + .onAppear{viewModel.getTrendigContents()} } } diff --git a/NetflixCloneApp/NetflixCloneApp/Main/ThumbnailsVIew.swift b/NetflixCloneApp/NetflixCloneApp/Main/ThumbnailsVIew.swift deleted file mode 100644 index 9917657..0000000 --- a/NetflixCloneApp/NetflixCloneApp/Main/ThumbnailsVIew.swift +++ /dev/null @@ -1,51 +0,0 @@ -// -// ThumbnailsVIew.swift -// NetflixCloneApp -// -// Created by 정명곤 on 2022/09/14. -// - -import SwiftUI - -struct ThumbnailsVIew: View { - @ObservedObject var viewModel: MovieViewModel = MovieViewModel() - private var sectionTitle: String - - init(_ title: String) { - self.sectionTitle = title - } - - var body: some View { - VStack(alignment: .leading) { - Text(sectionTitle) - .font(.headline) - .fontWeight(.bold) - .foregroundColor(.white) - .padding(.horizontal, 5) - - ScrollView(.horizontal) { - HStack{ - ForEach(0..<7) { content in - Image("image") - .frame(width: 120, height: 180, alignment: .center) - .background(.gray) - .cornerRadius(9) - .aspectRatio(0.01, contentMode: .fill) - - } - } - - } - } - .frame(height: 220) - .background(.black) - .onAppear{ viewModel.getUpcomingContents() } - } -} - - -struct ThumbnailsVIew_Previews: PreviewProvider { - static var previews: some View { - ThumbnailsVIew("Section") - } -} diff --git a/NetflixCloneApp/NetflixCloneApp/Model/Contents.swift b/NetflixCloneApp/NetflixCloneApp/Model/Contents.swift index d79dd3e..4637c1a 100644 --- a/NetflixCloneApp/NetflixCloneApp/Model/Contents.swift +++ b/NetflixCloneApp/NetflixCloneApp/Model/Contents.swift @@ -19,9 +19,14 @@ struct ContentsResults: Decodable { struct Contents: Identifiable, Decodable { let id: Int? + let backdrop_path: String? let title: String? + let original_language: String? + let original_title: String? let overview: String? let poster_path: String? + let media_type: String? let popularity: Float? - + let release_date: String? + let vote_average: Float? } diff --git a/NetflixCloneApp/NetflixCloneApp/Resources/ImageLoader.swift b/NetflixCloneApp/NetflixCloneApp/Resources/ImageLoader.swift new file mode 100644 index 0000000..99fbce3 --- /dev/null +++ b/NetflixCloneApp/NetflixCloneApp/Resources/ImageLoader.swift @@ -0,0 +1,32 @@ +import SwiftUI +import Combine +import Foundation + + + +class ImageLoader: ObservableObject { + @Published private(set) var image: UIImage? + + private var cancellable: AnyCancellable? + + + func load(url: String) { + let url = URL(string:"https://image.tmdb.org/t/p/w500\(url)") + + cancellable = URLSession.shared + .dataTaskPublisher(for: url!) + .map { UIImage(data: $0.data) } + .replaceError(with: nil) + .receive(on: DispatchQueue.main) + .assign(to: \.image, on: self) + } + + func stop() { + cancellable?.cancel() + } + + deinit { + cancellable?.cancel() + } +} + diff --git a/NetflixCloneApp/NetflixCloneApp/Resources/MyNetflixBundle.swift b/NetflixCloneApp/NetflixCloneApp/Resources/MyNetflixBundle.swift index 7849844..0b05a33 100644 --- a/NetflixCloneApp/NetflixCloneApp/Resources/MyNetflixBundle.swift +++ b/NetflixCloneApp/NetflixCloneApp/Resources/MyNetflixBundle.swift @@ -3,10 +3,10 @@ import Foundation extension Bundle { var apiKey: String { - guard let file = self.path(forResource: "MovieInfo", ofType: "plist") else { return "" } + guard let file = self.path(forResource: "API", ofType: "plist") else { return "" } guard let resource = NSDictionary(contentsOfFile: file) else { return "" } - guard let key = resource["API_KEY"] as? String else { fatalError("MovieInfo.plist의 API Key를 설정해주세요.")} + guard let key = resource["API_KEY"] as? String else { fatalError("API.plist의 API Key를 설정해주세요.")} return key } diff --git a/NetflixCloneApp/NetflixCloneApp/StoreView.swift b/NetflixCloneApp/NetflixCloneApp/StoreView.swift index da15b5d..317ab18 100644 --- a/NetflixCloneApp/NetflixCloneApp/StoreView.swift +++ b/NetflixCloneApp/NetflixCloneApp/StoreView.swift @@ -6,6 +6,7 @@ // import SwiftUI +import UIKit struct StoreView: View { var body: some View { @@ -13,6 +14,7 @@ struct StoreView: View { } } + struct StoreView_Previews: PreviewProvider { static var previews: some View { StoreView() diff --git a/NetflixCloneApp/NetflixCloneApp/ViewModel/MovieViewModel.swift b/NetflixCloneApp/NetflixCloneApp/ViewModel/MovieViewModel.swift index 358aa6c..0ee04f6 100644 --- a/NetflixCloneApp/NetflixCloneApp/ViewModel/MovieViewModel.swift +++ b/NetflixCloneApp/NetflixCloneApp/ViewModel/MovieViewModel.swift @@ -1,6 +1,8 @@ import SwiftUI import Combine +import SDWebImage +import SDWebImageSwiftUI struct API { static let API_KEY = Bundle.main.apiKey @@ -19,12 +21,11 @@ enum NetworError: Error { class MovieViewModel: ObservableObject { @Published var contents: [Contents]? - @Published var thumnail: UIImage? private var cancellables = Set() - func getTrendigContents(media_type: String) { - guard let url = URL(string: "\(API.URL)/3/trending/\(media_type)/day?api_key=\(API.API_KEY)") else { return } + func getTrendigContents() { + guard let url = URL(string: "\(API.URL)/3/trending/movie/day?api_key=\(API.API_KEY)") else { return } URLSession.shared.dataTaskPublisher(for: url) .tryMap { data, response -> Data in @@ -34,7 +35,7 @@ class MovieViewModel: ObservableObject { return data } .decode(type: ContentsResults.self, decoder: JSONDecoder()) - .map{ $0.results! } + .map{ $0.results!; } .receive(on: DispatchQueue.main) .eraseToAnyPublisher() .sink { completion in @@ -48,6 +49,7 @@ class MovieViewModel: ObservableObject { self.contents = contents } .store(in: &cancellables) + } @@ -78,41 +80,6 @@ class MovieViewModel: ObservableObject { .store(in: &cancellables) } -// func fecthData(_ section: Int) { -// switch(section) { -// case Sections.TrendingMovie.rawValue: -// case Sections.TrendingTv.rawValue: -// case Sections.Upcoming.rawValue: -// default: return -// } -// } - -// func renderingImage(poster_path: String) { -// let url = URL(string:"https://image.tmdb.org/t/p/w500\(poster_path)") -// -// return URLSession.shared.dataTaskPublisher(for: url!) -// .map { UIImage(data: $0.data) } -// .receive(on: DispatchQueue.main) -// .mapError{ $0 as Error } -// .eraseToAnyPublisher() -// .sink { result in -// switch result { -// case .failure(let error): -// print(error) -// case .finished: -// print("success") -// } -// } receiveValue: { [weak self] data in -// DispatchQueue.main.async { -// self?.thumnail = UIImage(data: data) -// } -// } -// .store(in: &cancellables) -// } - - - - } diff --git a/NetflixCloneApp/NetflixCloneApp/WebService.swift b/NetflixCloneApp/NetflixCloneApp/WebService.swift deleted file mode 100644 index 0f04566..0000000 --- a/NetflixCloneApp/NetflixCloneApp/WebService.swift +++ /dev/null @@ -1,50 +0,0 @@ -import Foundation -import Combine - -//enum HTTPError: LocalizedError { -// case statusCode -// case post -//} -// -//struct WebService { -// -// private var decoder: JSONDecoder = { -// let decoder = JSONDecoder() -// decoder.keyDecodingStrategy = .convertFromSnakeCase -// return decoder -// }() -// -// private var session: URLSession = { -// let config = URLSessionConfiguration.default -// config.urlCache = URLCache.shared -// config.waitsForConnectivity = true -// return URLSession(configuration: config, delegate: nil, delegateQueue: nil) -// }() -// -// private func createPublisher(for url: URL) -> AnyPublisher { -// print("Publisher URL: \(url)") -// return session.dataTaskPublisher(for: url) -// .tryMap { output in -// guard let response = output.response as? HTTPURLResponse, response.statusCode == 200 else { -// print("Response: \(output.response)") -// -// do { -// let ss = try self.decoder.decode(Response.self, from: output.data) -// print("ss: \(ss)") -// } catch { -// print(error) -// } -// throw HTTPError.statusCode -// } -// -// return output.data -// } -// .decode(type: T.self, decoder: decoder) -// .eraseToAnyPublisher() -// } -// -// func getMovieDetail(movieId: Int) -> AnyPublisher { -// createPublisher(for: TMDBClient.Endpoints.movieDetail(movieId).url) -// } -// -//} diff --git a/NetflixCloneApp/Podfile b/NetflixCloneApp/Podfile index 4fd7598..6ec344b 100644 --- a/NetflixCloneApp/Podfile +++ b/NetflixCloneApp/Podfile @@ -6,6 +6,7 @@ target 'NetflixCloneApp' do use_frameworks! # Pods for NetflixCloneApp + pod "SDWebImageSwiftUI" pod "TMDBSwift" end diff --git a/NetflixCloneApp/Podfile.lock b/NetflixCloneApp/Podfile.lock index 6d9d357..072abef 100644 --- a/NetflixCloneApp/Podfile.lock +++ b/NetflixCloneApp/Podfile.lock @@ -1,16 +1,26 @@ PODS: + - SDWebImage (5.13.2): + - SDWebImage/Core (= 5.13.2) + - SDWebImage/Core (5.13.2) + - SDWebImageSwiftUI (2.0.2): + - SDWebImage (~> 5.10) - TMDBSwift (0.5.1) DEPENDENCIES: + - SDWebImageSwiftUI - TMDBSwift SPEC REPOS: trunk: + - SDWebImage + - SDWebImageSwiftUI - TMDBSwift SPEC CHECKSUMS: + SDWebImage: 72f86271a6f3139cc7e4a89220946489d4b9a866 + SDWebImageSwiftUI: 8a3923c95108312b03a599ec1498754af55a6819 TMDBSwift: 9220f3dcee23372c05b92f8c111f5f4c37185aee -PODFILE CHECKSUM: c554f9dc7aff5526016b45ebc96706091ee93b20 +PODFILE CHECKSUM: 37567a5a9200df45df91fab7e5e31f0deb32ea76 COCOAPODS: 1.11.3 diff --git a/NetflixCloneApp/Pods/Manifest.lock b/NetflixCloneApp/Pods/Manifest.lock index 6d9d357..072abef 100644 --- a/NetflixCloneApp/Pods/Manifest.lock +++ b/NetflixCloneApp/Pods/Manifest.lock @@ -1,16 +1,26 @@ PODS: + - SDWebImage (5.13.2): + - SDWebImage/Core (= 5.13.2) + - SDWebImage/Core (5.13.2) + - SDWebImageSwiftUI (2.0.2): + - SDWebImage (~> 5.10) - TMDBSwift (0.5.1) DEPENDENCIES: + - SDWebImageSwiftUI - TMDBSwift SPEC REPOS: trunk: + - SDWebImage + - SDWebImageSwiftUI - TMDBSwift SPEC CHECKSUMS: + SDWebImage: 72f86271a6f3139cc7e4a89220946489d4b9a866 + SDWebImageSwiftUI: 8a3923c95108312b03a599ec1498754af55a6819 TMDBSwift: 9220f3dcee23372c05b92f8c111f5f4c37185aee -PODFILE CHECKSUM: c554f9dc7aff5526016b45ebc96706091ee93b20 +PODFILE CHECKSUM: 37567a5a9200df45df91fab7e5e31f0deb32ea76 COCOAPODS: 1.11.3 diff --git a/NetflixCloneApp/Pods/Pods.xcodeproj/project.pbxproj b/NetflixCloneApp/Pods/Pods.xcodeproj/project.pbxproj index 1b0e913..11283db 100644 --- a/NetflixCloneApp/Pods/Pods.xcodeproj/project.pbxproj +++ b/NetflixCloneApp/Pods/Pods.xcodeproj/project.pbxproj @@ -7,171 +7,543 @@ objects = { /* Begin PBXBuildFile section */ - 015EE06DFCBE2D0DAC513EAEB6E022F6 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 73010CC983E3809BECEE5348DA1BB8C6 /* Foundation.framework */; }; - 091EB88962232BA00774B2E7C8E434D7 /* Client_Certifications.swift in Sources */ = {isa = PBXBuildFile; fileRef = B743D7AEC2CD2D01CFE91A00447CFD6F /* Client_Certifications.swift */; }; - 0C072626149F71717E5EB33B0C41FA75 /* CertificationMDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = F195D8986B72A18787FD933F68F9748D /* CertificationMDB.swift */; }; - 0FE0AABDBAC72232D09C9C7D6FFD501D /* Client_Collections.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D52AAC0B91D9588E349168E2D47EAA7 /* Client_Collections.swift */; }; - 1296C031D31170593AB47EC1052BF2E2 /* Clent_Discover.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CB0237073FB750FD000EA43E57316CE /* Clent_Discover.swift */; }; - 13C276CBB1427E9A82AE59A0806520F0 /* VideosMDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = 218819B9500A5A674B469565A46CAEBB /* VideosMDB.swift */; }; - 1C0A19BA0DBD3DCDB188EE7544704EB0 /* CollectionsMDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39467FCBF986C060F3619EA6B7BA0CF1 /* CollectionsMDB.swift */; }; - 1D788D8553CC7687DD2AD26808E1BBFB /* DiscoverTV.swift in Sources */ = {isa = PBXBuildFile; fileRef = F87ABD25143757E58763E4F98C05719B /* DiscoverTV.swift */; }; - 22BB2957FFD6087C15A89E704F52C609 /* ReviewsMDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = F04C44B525BE21FA8D83E95F451E6410 /* ReviewsMDB.swift */; }; - 293540A76AA4711C311336CCE355417F /* TVCreditsMDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34F1329326E3F912D76EA4B2657A742F /* TVCreditsMDB.swift */; }; - 2A279B82F757E280630290D91FC6FB4D /* Client_Movies.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95FBA89CDB1D8F6A66D55567956545D8 /* Client_Movies.swift */; }; - 2C7B71876E0B095509758F75C2ABDF74 /* PersonMDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9A5E1EEE0A4C02CF745B87B7654DC5D /* PersonMDB.swift */; }; - 2CF5AE45CD50C50EB01D968684992BEE /* Client_People.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF204FF6E57E4067611A7AC399749D83 /* Client_People.swift */; }; - 395E726A7CC67D726456550C39556354 /* CompaniesMDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2F70754DEC2828153894BDE600CA71B5 /* CompaniesMDB.swift */; }; - 4162A3372561D76C8BD18D1623AD6D48 /* Client_Credits.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAD2714F1C617A75E57FA41D5010CD91 /* Client_Credits.swift */; }; - 45682CD7968E40116AC7CADA77F2823E /* TVMDBModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C78810F677E23A27EED88ADE016C834 /* TVMDBModel.swift */; }; - 4FFFCC1A9E326B6CCA2090048FD96F9E /* Client.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EE3B0B8EC96581EC5EEDD9B2920838A /* Client.swift */; }; - 5450E73D7026BC35CB20BBB580748ABB /* MovieMDBModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 80BCA42E9BDD023A17AA5BEEDCD472D6 /* MovieMDBModel.swift */; }; - 55DE8EEFD8C23F544EA722A654388880 /* Client_Review.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF5797CB43DC4603CA24241E67EB1740 /* Client_Review.swift */; }; - 597C259F18C70EFAEE1486F58071F742 /* NetworksMDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = 375DDE1A615DF1E9F0C7A136653893B9 /* NetworksMDB.swift */; }; - 60ADE692825872313AFFE9B1904C2909 /* Pods-NetflixCloneApp-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = EF0809D2458F0C237FE81487FAAC2FAF /* Pods-NetflixCloneApp-dummy.m */; }; - 629966731805F2E3FCBCB98DBA77A006 /* KeywordsMDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C6C26925EFE5EF004902946219CFFD7 /* KeywordsMDB.swift */; }; - 64267A59018F0019387C29D3DC24CCA6 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 73010CC983E3809BECEE5348DA1BB8C6 /* Foundation.framework */; }; - 74A030EB7B325E85D978F15DC6E88A30 /* Client_TVSeasonsEpisodes.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5487B322247890C43C0E63A6683D6F99 /* Client_TVSeasonsEpisodes.swift */; }; - 78A9B70D8A71E8E3E70A9AF02149D893 /* ChangesMDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = FEAD7D19E4CB57B5240230C53B888330 /* ChangesMDB.swift */; }; - 81E7C341F32997CCB744EE95DF06E93C /* Client_Genres.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3FDDE9C11BFD62B412B328264A33019B /* Client_Genres.swift */; }; - 846EAAE5A9FFC5EAB11B606B63AAA4EF /* ConfigurationMDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = 059A37A8FA268997D999344578870A5A /* ConfigurationMDB.swift */; }; - 87FA207D3B39B4C89E603F9C963CFC72 /* TVDetailedMDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B6D2E2DFA8F737A981D2734539EF279 /* TVDetailedMDB.swift */; }; - 903CF46B7C015A24716B14163CAAD3AB /* Discover.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5A99386AE1DC328593CD10E5473F01EA /* Discover.swift */; }; - 94BE73B37F3BC716999F9BF3558F7143 /* ImagesMDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0B2C36D6DA0B21E4F469124AA3A959B5 /* ImagesMDB.swift */; }; - 9A5E72F1D0402E979941752021C428F3 /* Client_Lists.swift in Sources */ = {isa = PBXBuildFile; fileRef = 49D867069E0F85EBFA8CCEA9E0C62796 /* Client_Lists.swift */; }; - 9D041D7328C59BBE3E5A4D23F3265ACB /* PageResultsMDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD64203CBB3084AEA547CB8263FA0ACE /* PageResultsMDB.swift */; }; - A39D8EE617B273BC372B9B1EBD4008B3 /* Client_Search.swift in Sources */ = {isa = PBXBuildFile; fileRef = AEC717EE7ACF81CF26D9756369FD121C /* Client_Search.swift */; }; - B02C71E7B7A569633C0815EB06AAAD5F /* Config.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA39E2B9C879FF71ED8CF74A05D83D67 /* Config.swift */; }; - B14D8D6F4EAD7EA6EF3221344E48EFFA /* TVMDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18849A7F5FF4EED5D0763638A0EDB982 /* TVMDB.swift */; }; - B687AA0580BE6B6D50FDAFFE6978C1C4 /* Client_Configuration.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6796A8969E2C23177954665C88E1865 /* Client_Configuration.swift */; }; - B854BB1616DA13096F1647A1C48CAC98 /* Client_TV.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA0F999B41862A66A2C3777B078450FF /* Client_TV.swift */; }; - B89DB43E91E14387DCC1941172161363 /* TMDBSwift-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 7BE0891E7C6081D9B46D04363DEB995F /* TMDBSwift-dummy.m */; }; - BA07918DB25DBF75C629C8DC03790E25 /* CreditsMDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8095B70539EB10416B3F6C80A3B1BB19 /* CreditsMDB.swift */; }; - BACCD0E829C168C43E4E6011EC49FA9C /* TranslationsMDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = EB601CF8E99775925D7C1515E3D9C0EF /* TranslationsMDB.swift */; }; - BD78906CCD22CCA29C60E8AB4A556FE0 /* Client_Keywords.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0C2FABE0D74688BF5E2012A73CB4089B /* Client_Keywords.swift */; }; - C5B3BD066B09D8C5E0816611581A854F /* Client_Find.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAC2F35F83C31E66864E07819835FD5B /* Client_Find.swift */; }; - C5BA14E395FFFB17E8EF61C4D4A31BF7 /* MovieDetailedMDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77E68795F9116AADA8662F6CA1E5DBED /* MovieDetailedMDB.swift */; }; - CB964148B3723B29080C96E8118FB637 /* TVEpisodesMDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1968869884DD04E9A28FD7979D247705 /* TVEpisodesMDB.swift */; }; - D32CD017BE7DBA113094C281E88BA7E5 /* FindMDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = C65D5776C672F3E264D7F84D7CB465CD /* FindMDB.swift */; }; - D41DB8D66B3F4FE6BFECA6D3564738D5 /* DiscoverMovie.swift in Sources */ = {isa = PBXBuildFile; fileRef = A22C2EEC6627DDC7452D34A6C6468B56 /* DiscoverMovie.swift */; }; - D5609B248021BEDC162513BABCD70A62 /* MovieCreditsMDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = D3EDC56017E5F999BA8913F935FBC87E /* MovieCreditsMDB.swift */; }; - D75DD60C91583127B32729BC9D02D7F1 /* MovieReviewMDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = 982AC43ABDF0524ADB266A0BB1BDBBDA /* MovieReviewMDB.swift */; }; - D9203A26D364066C303A621158C8F17D /* ListsMDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD64C3015B4E385F2601AB3A839BAD8E /* ListsMDB.swift */; }; - D964D8A4FCA93784898BF3C3F55C466F /* Alternative_TitlesMDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23151DC84B3AEBA73B0D526A9FF9936C /* Alternative_TitlesMDB.swift */; }; - E2189B95EC78D6940D074922EA85058A /* SearchMDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = 41E14A52C74B98712EB291A957AD990F /* SearchMDB.swift */; }; - E35154EF5A67CC95CBD13F0F864B77FD /* GenresMDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8445DBDBDEDE62707DC7977D31A605A9 /* GenresMDB.swift */; }; - E4803601B8827074D11488BF1A24B23E /* MovieMDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1620D25A21B1A1C3FEC77904337170C2 /* MovieMDB.swift */; }; - E5B0BF91AD9557EF44ABA4FC6FDFE378 /* SwiftyJSON.swift in Sources */ = {isa = PBXBuildFile; fileRef = B62A45BFABFC541EE240B263015E30D5 /* SwiftyJSON.swift */; }; - E8B7E54A9FCDA9BD29B3C94E790F82EA /* TMDBSwift-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = D881E782E4415EA61E983C2F3BD70A2C /* TMDBSwift-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; - EAC5370F7B165E42747ED6F985591030 /* Client_Changes.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79FB572DC4FC2E9B349168E18D249507 /* Client_Changes.swift */; }; - EC81B58EB88B89AC165F08940056DCAA /* ExternalIdsMDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C6FEE16583A802C266A06106FBF1210 /* ExternalIdsMDB.swift */; }; - EC8340E9DCB0907EFB2D61787A3C609C /* Client_Companies.swift in Sources */ = {isa = PBXBuildFile; fileRef = 731E61625276FD2CA91553C2CDBB2EFB /* Client_Companies.swift */; }; - EE6F3CFB98760F2A902215A1F021600B /* TVSeasonsMDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AF9EB12789629C68F8F23C093A3687B /* TVSeasonsMDB.swift */; }; - F1073C7FEEB33B88CEA3E2C59CE22ADD /* ArrayObjectProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5330C1C040A8C869866E90E279BF38D5 /* ArrayObjectProtocol.swift */; }; - F1C518EC288D909884FABA3A757D39F2 /* CastCrewMDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = D1933EBB5AA4755FE6C511B9DFA42ECB /* CastCrewMDB.swift */; }; - F47A28893F8A3DE9BE2957F64BD849B3 /* MovieReleaseDatesMDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = B235FD82E50FB3626E4F99AB870AF94E /* MovieReleaseDatesMDB.swift */; }; - F919E81955613058B2AD930AE4EE47C0 /* Client_Networks.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3146C890D18D2D1C7B405FA42BCE4C35 /* Client_Networks.swift */; }; - FBD7915669FB7E4FDAE075B5B0DEEE66 /* Pods-NetflixCloneApp-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 0558971FB75DB8453239C411BCEC2DAD /* Pods-NetflixCloneApp-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; - FD94C88E34D9C549FD89183D34995529 /* MovieListMDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEF5E73AC94F63292256A629B409736A /* MovieListMDB.swift */; }; + 007F57C0030B0CA201A359FD816A3CE1 /* SDImageFrame.m in Sources */ = {isa = PBXBuildFile; fileRef = D9ABC37EB67F5E525E9C8111A96FFFC1 /* SDImageFrame.m */; }; + 01518247AE5C0AAD95C02C6631588396 /* AnimatedImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = C88D63608DE51C6BF99BF6E1921E7257 /* AnimatedImage.swift */; }; + 015EE06DFCBE2D0DAC513EAEB6E022F6 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6CDC6391E3063232D20F2FFE1617B4AA /* Foundation.framework */; }; + 0311D5903A8C13AE6158796BC69AD994 /* SDWebImageTransition.h in Headers */ = {isa = PBXBuildFile; fileRef = BB7D6713E34D24DFB2AC7EDCB28F2C74 /* SDWebImageTransition.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 05102BD9E7BCB80DC7B64A34D0E7850B /* SDWebImageCacheSerializer.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A1E648B6566C84BDB4E98C4B4314772 /* SDWebImageCacheSerializer.m */; }; + 05D76FA82DD3C37B76FFC1689CEF9981 /* SDWebImageDownloaderDecryptor.h in Headers */ = {isa = PBXBuildFile; fileRef = F6A67AE5743DF6EB595B185BAA5234D6 /* SDWebImageDownloaderDecryptor.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 07A41F67B40B3C6C6C3DB862F1F633F8 /* SDWebImageManager.h in Headers */ = {isa = PBXBuildFile; fileRef = A58B311EA1CB700A493C508922C9127F /* SDWebImageManager.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 091EB88962232BA00774B2E7C8E434D7 /* Client_Certifications.swift in Sources */ = {isa = PBXBuildFile; fileRef = C059FF1AD5D3123A7DA435A6F5EEFF5B /* Client_Certifications.swift */; }; + 0BFA90EFCD3407716FFC60D140325188 /* UIImageView+WebCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 8C4E39AB3C494384025D8DF717F420DC /* UIImageView+WebCache.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 0C072626149F71717E5EB33B0C41FA75 /* CertificationMDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4296A3D0D572A64B183F144CCB5B2BF /* CertificationMDB.swift */; }; + 0C76BA74E22A5CFD8207C10026401D80 /* SDAnimatedImagePlayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 276C0772D5E34653813BB57358D18887 /* SDAnimatedImagePlayer.m */; }; + 0D0AF4DF934B7BE39EC6E287B003BBA6 /* SDMemoryCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 199E9345699B49FDC54349ED1DB496B5 /* SDMemoryCache.m */; }; + 0D2B3D451D64A5A0AE5CE51E975D7494 /* SDImageCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C0D6A09762B3435DBF3E0BDF2429127 /* SDImageCache.m */; }; + 0DEECB4887F8ED8A8304156D1C440639 /* SDWebImage-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 3785B6D834EFAB609BA7F040AC7296CE /* SDWebImage-dummy.m */; }; + 0F4322740A001E3D7BFD2C333BCF907D /* SDImageCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 4E886ED5E1F036FA3E36594153F3B9B1 /* SDImageCache.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 0FE0AABDBAC72232D09C9C7D6FFD501D /* Client_Collections.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9071DBFBA5CE1FE7115352312C94A4F1 /* Client_Collections.swift */; }; + 0FFA0C960F26666918569059FB8E92BC /* SDImageCoder.h in Headers */ = {isa = PBXBuildFile; fileRef = D353119D1CF0C2785D00B22D4252D90D /* SDImageCoder.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 10E9E4249C8C22A571EBFECF3C0676CC /* UIImageView+WebCache.m in Sources */ = {isa = PBXBuildFile; fileRef = AC74A63BE456EFF43EED5E529E373183 /* UIImageView+WebCache.m */; }; + 11E79385CD0DA86166E63D21E7E078E9 /* SDImageIOAnimatedCoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C7EF080C7C1F27BD59DCEAF6393B67D /* SDImageIOAnimatedCoder.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 1296C031D31170593AB47EC1052BF2E2 /* Clent_Discover.swift in Sources */ = {isa = PBXBuildFile; fileRef = 921083316646B3DB736DA577C2C78FC0 /* Clent_Discover.swift */; }; + 138DFC533930F784B55D9BB8AACC0E06 /* SDImageCacheDefine.m in Sources */ = {isa = PBXBuildFile; fileRef = 7E815BE2C9A76C30189EAD90CDAAC71B /* SDImageCacheDefine.m */; }; + 13C276CBB1427E9A82AE59A0806520F0 /* VideosMDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0C08EB189AEC0772406B978B922303E4 /* VideosMDB.swift */; }; + 164DEB7B33A09DD8663942511488AD16 /* SDImageGIFCoder.m in Sources */ = {isa = PBXBuildFile; fileRef = FF5965CC203FC6DE973869CCE6BBC270 /* SDImageGIFCoder.m */; }; + 168AB5EA0EBEB75D0434B55D0B97AD47 /* SDImageIOAnimatedCoderInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 15447C7B9DB58C272C2635667B3F5E23 /* SDImageIOAnimatedCoderInternal.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 18303B692A81A7D708973A6B9CBA75D8 /* SDAsyncBlockOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = 0ACF56488DA017E7C0AAE512268CE3BB /* SDAsyncBlockOperation.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 1C0A19BA0DBD3DCDB188EE7544704EB0 /* CollectionsMDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3B89F0025630D46B405C9E376EFA4C1 /* CollectionsMDB.swift */; }; + 1D788D8553CC7687DD2AD26808E1BBFB /* DiscoverTV.swift in Sources */ = {isa = PBXBuildFile; fileRef = 40F6E25F89A76BCCFA10D470B7F2E88A /* DiscoverTV.swift */; }; + 20004B99F5050F59E747AB8DFAD7E891 /* SDWebImageDownloaderOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = 2A02C50262F6BC114580EBD93BD1514D /* SDWebImageDownloaderOperation.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 21D05279AA20EE7A1707A76C11BBCC00 /* NSBezierPath+SDRoundedCorners.m in Sources */ = {isa = PBXBuildFile; fileRef = 66A649837FCF2AA5DD45FF608FC88C06 /* NSBezierPath+SDRoundedCorners.m */; }; + 22BB2957FFD6087C15A89E704F52C609 /* ReviewsMDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3C5C39C09113E31FE804B8C8874326C2 /* ReviewsMDB.swift */; }; + 24DA814C2F7EA7C4187E2BF0B6466E9A /* SDAnimatedImageRep.m in Sources */ = {isa = PBXBuildFile; fileRef = 5BB2BD6EEDCEBC593C0EEF20B6433A21 /* SDAnimatedImageRep.m */; }; + 26BF15D648EFA59FCA18AE285AC5B2A1 /* UIImage+MemoryCacheCost.h in Headers */ = {isa = PBXBuildFile; fileRef = AC4B0C65322E56F8CF5BA827677F993E /* UIImage+MemoryCacheCost.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 275F99E74511043432C892810081DCAF /* SDDiskCache.m in Sources */ = {isa = PBXBuildFile; fileRef = B15FFD49E6CA308B9B3CE3EC57FEF40B /* SDDiskCache.m */; }; + 278F5B2C01E923AA0C691D79BD0F321F /* UIImage+MultiFormat.h in Headers */ = {isa = PBXBuildFile; fileRef = A9D87F6CAD1A47D10F71ACBF43DEE596 /* UIImage+MultiFormat.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 28532908E40E423052AA43B0000028BF /* UIImage+Metadata.m in Sources */ = {isa = PBXBuildFile; fileRef = E4E1D4AB19D481860F24F62CEEC7839D /* UIImage+Metadata.m */; }; + 293540A76AA4711C311336CCE355417F /* TVCreditsMDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4DA0917ED0A9A85580B2A7593A0CFC50 /* TVCreditsMDB.swift */; }; + 29A171D04BF558ED769E80CC385DEB7D /* SDWebImageSwiftUI-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 071E024099A72F8BDDCFA119562C2D00 /* SDWebImageSwiftUI-dummy.m */; }; + 2A279B82F757E280630290D91FC6FB4D /* Client_Movies.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17F42EAB1E66DBEF784B40010CCF1C82 /* Client_Movies.swift */; }; + 2C762E5C654B718C19CC98FEB27C2DA4 /* SDFileAttributeHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = F47B089271DDB2F4EB56659080EC5765 /* SDFileAttributeHelper.m */; }; + 2C7B71876E0B095509758F75C2ABDF74 /* PersonMDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FED0B73B0083D0A77E6359D484BD21D /* PersonMDB.swift */; }; + 2CF5AE45CD50C50EB01D968684992BEE /* Client_People.swift in Sources */ = {isa = PBXBuildFile; fileRef = A47DF9A97759073EAB4067494728ED85 /* Client_People.swift */; }; + 2D7E7D5F025A1006C0D373B5884B6E52 /* SDWebImageDownloaderResponseModifier.h in Headers */ = {isa = PBXBuildFile; fileRef = D7298C00FF5A1A57D49B2BA627F35169 /* SDWebImageDownloaderResponseModifier.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2F85FF5597762E2E3C6961C6DD690A60 /* UIView+WebCacheOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = 7973658E79C7838FFCF0D5BAFB381FEF /* UIView+WebCacheOperation.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 3015C91C523C5133A639F57DE0425100 /* SDImageAssetManager.m in Sources */ = {isa = PBXBuildFile; fileRef = F68008A8398F4E7994C5B3DEA08F65E0 /* SDImageAssetManager.m */; }; + 336BA7F271A33087B951BA4C6C6B2C6F /* SDImageAssetManager.h in Headers */ = {isa = PBXBuildFile; fileRef = EA251249D23B262850F4D1FCF1F332E4 /* SDImageAssetManager.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 33C0E2EFD1C8046A2020D25FD1F1611F /* SDImageAWebPCoder.h in Headers */ = {isa = PBXBuildFile; fileRef = EC789C911D0C1620C1446109B57952D3 /* SDImageAWebPCoder.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 343B53EB998CC5B609B8DE84BAD882E0 /* SDWebImageIndicator.m in Sources */ = {isa = PBXBuildFile; fileRef = 8A814A3F661CA2F120AF5A723DF384BA /* SDWebImageIndicator.m */; }; + 36F35669F3AFF65477B2366FC09A1B3F /* SDWebImageOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = F52E6309565FE0CF0CFA63A7E4667DCF /* SDWebImageOperation.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 37E3C820BC838123661E1391BEAF8092 /* UIImageView+HighlightedWebCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FDC9EF0CC19B1676311AE8F9662D9E0 /* UIImageView+HighlightedWebCache.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 38CF7D5EE6C28780FE3F9C1E63CFF3D4 /* SDAnimatedImage.h in Headers */ = {isa = PBXBuildFile; fileRef = CC09DA71D718A0810E41CC1A49217F51 /* SDAnimatedImage.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 395E726A7CC67D726456550C39556354 /* CompaniesMDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = 756A7DF719CB54D142A8E938917ADCFE /* CompaniesMDB.swift */; }; + 3B72C235C1AB8944333C2322F08B6B46 /* SDWebImageTransition.m in Sources */ = {isa = PBXBuildFile; fileRef = 402645E5F85A5FAF0043F06C75C31DA9 /* SDWebImageTransition.m */; }; + 3F567CE353442AE137B71B258409F5DA /* SDImageLoadersManager.m in Sources */ = {isa = PBXBuildFile; fileRef = AB29DA0771C5328C2C588B0440D7AACE /* SDImageLoadersManager.m */; }; + 4075297FF5A21C84EF513521FD7B34EF /* SDWeakProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = A4287258390B8909691A03E41CB093D5 /* SDWeakProxy.m */; }; + 412EE262DCED176A73591124DBDBA97C /* UIImage+MemoryCacheCost.m in Sources */ = {isa = PBXBuildFile; fileRef = F65B5C4F20A9DEBFBE2EC0B4C683AC4E /* UIImage+MemoryCacheCost.m */; }; + 4162A3372561D76C8BD18D1623AD6D48 /* Client_Credits.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA58A429F846D8B2D9299C01C591E3E4 /* Client_Credits.swift */; }; + 42822E48A1441AD8E0011D37C1625B36 /* SDAnimatedImageView+WebCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 2B97C03D18DA87723386936ACCA969C5 /* SDAnimatedImageView+WebCache.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 429E5CC928985357D07058FDEE8069FA /* UIView+WebCacheOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = 8D93D78E2E53AA6F5376ABB600650F3C /* UIView+WebCacheOperation.m */; }; + 45682CD7968E40116AC7CADA77F2823E /* TVMDBModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = DBB439A692046C3BFF7B973CC3F18D42 /* TVMDBModel.swift */; }; + 4623448C58E0E271F0DF5F4CC6CAFD0D /* SDImageCachesManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 7B0CA5939CD80430E10A1411EFE2187D /* SDImageCachesManager.m */; }; + 46F295ABF44B05A541ADA1A51825DA4B /* ImageManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2228A267E986ED83872C3D7ECDCFE3B /* ImageManager.swift */; }; + 474163E6CF20CA1AC3698759F2B6D51B /* NSButton+WebCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 499663A3CCC70621996DDBFF1770260D /* NSButton+WebCache.m */; }; + 48920AFFC7C0E2FEA632DAA2BD63287D /* SDWebImage-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 494E1576C508C08DCE2E696DC24753ED /* SDWebImage-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 498AB54D6531F0B57EAAD113AA0CF0F9 /* SDAsyncBlockOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = 8D70E4F158D328F3EC71445EC48212CB /* SDAsyncBlockOperation.m */; }; + 49F97D8BA4E81A5E0EF866A293392AF2 /* SDWebImageDefine.m in Sources */ = {isa = PBXBuildFile; fileRef = 074FDAC8D9775DF408E7F877AA8CD8B9 /* SDWebImageDefine.m */; }; + 4A27F890C33243C4548A25318264B375 /* UIImage+ForceDecode.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B6B5C63984E342D9BA380750DA36835 /* UIImage+ForceDecode.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 4F5982101CB9FB68613E826F137B5E95 /* SDAssociatedObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 662675A557F215547AB10FA888848173 /* SDAssociatedObject.m */; }; + 4FB353F2B2E7D7AE0811D7C538DA2B36 /* SDAnimatedImageRep.h in Headers */ = {isa = PBXBuildFile; fileRef = 741D12CAB4CB3ECD9FB6F2A6B9944F11 /* SDAnimatedImageRep.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 4FFFCC1A9E326B6CCA2090048FD96F9E /* Client.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2AEF6D763FECC70AE750E47375EABFC /* Client.swift */; }; + 51833F2045AD93A3D77FF8074DDD0CC6 /* SDWebImageSwiftUI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 601D39CB549B16F01A4BBFF261788543 /* SDWebImageSwiftUI.swift */; }; + 519B33DCAE0FB73CC313A2C2AD434449 /* SDImageCoderHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = F4CE27C47FB88D64756D09E07CF62C74 /* SDImageCoderHelper.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 51F891EA712D8F14CF1DD77BF20B62A9 /* ImageIO.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 22AD885D3D57E81A6E96E0E72504B6C8 /* ImageIO.framework */; }; + 523861A018452CE8BB166B59A7872BDA /* SDImageFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 635E2BD5493FA04103F7CFD1155ED49F /* SDImageFrame.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 536E9C0D3855A6AF7CADCB9FBAFC613D /* SDImageIOCoder.m in Sources */ = {isa = PBXBuildFile; fileRef = BA961F106D921434651D6D780D8D8A23 /* SDImageIOCoder.m */; }; + 5450E73D7026BC35CB20BBB580748ABB /* MovieMDBModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0FD272B910C778D660B582837C3683C5 /* MovieMDBModel.swift */; }; + 55DE8EEFD8C23F544EA722A654388880 /* Client_Review.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9DEBF645D35D52037D54B5612F8D34C0 /* Client_Review.swift */; }; + 57E1C476BA5F8DD1ED740FE8DBC05D8A /* SDAnimatedImagePlayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 2C7DF6047A555ABEE497BDD03866DAAF /* SDAnimatedImagePlayer.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 58FAE3A59FBE896EBBDACB0808067CA5 /* SDDeviceHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = B62A8986F54C0DB226A68EA23C403509 /* SDDeviceHelper.m */; }; + 597C259F18C70EFAEE1486F58071F742 /* NetworksMDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6451957A96686449C54B797ACCF13893 /* NetworksMDB.swift */; }; + 5A3E5B854E8188DDF4E958BBC9198600 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6CDC6391E3063232D20F2FFE1617B4AA /* Foundation.framework */; }; + 5B3271A67137276C4B2CD554BAB9F4DA /* UIImage+MultiFormat.m in Sources */ = {isa = PBXBuildFile; fileRef = B70FB80E1FECC8F023F681A5474A9A8A /* UIImage+MultiFormat.m */; }; + 5B69919844A3BD774BAABB186D6A524F /* SDWebImageDownloader.h in Headers */ = {isa = PBXBuildFile; fileRef = 31D51B41A8DED7D6BA8E604C757DE0B6 /* SDWebImageDownloader.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 5BBE7719912593F1DEFF8E763EAD4ED6 /* SDImageCacheDefine.h in Headers */ = {isa = PBXBuildFile; fileRef = 4A5B420028975C4C042F1005C8D37523 /* SDImageCacheDefine.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 5F49C3C9A3733CD50642E0B57D405D44 /* SDWebImageError.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E89D21A8EDAE7E376A70B799858C508 /* SDWebImageError.m */; }; + 61CD5A24511DC980EFF397CF57AC50F5 /* SDInternalMacros.m in Sources */ = {isa = PBXBuildFile; fileRef = 4A2218DFC8DB93D6AFA42BAB078E1A93 /* SDInternalMacros.m */; }; + 629966731805F2E3FCBCB98DBA77A006 /* KeywordsMDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = 365433E30041B149CDE4AF6E35B05F36 /* KeywordsMDB.swift */; }; + 62A22A4C10675F9B65C7677CFD6C4676 /* SDWebImagePrefetcher.m in Sources */ = {isa = PBXBuildFile; fileRef = FAB486655B408C78D7B1DF4A8F10A41A /* SDWebImagePrefetcher.m */; }; + 64CDB33E49BDBE16653C88756E26B8CB /* SDImageCoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 3FB2E75C4B6457E44603CFCA62669204 /* SDImageCoder.m */; }; + 67B0CAAD8E88B9A2357C41E73EA2EB48 /* SDWebImageCacheKeyFilter.m in Sources */ = {isa = PBXBuildFile; fileRef = 65D7D9C5945F4F19AE2A112F10B14A4C /* SDWebImageCacheKeyFilter.m */; }; + 67B3DCBA30FDEDA18E0D4E3B2C16C911 /* SDImageLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = FA26F8D6658216E9328B65C6D7807384 /* SDImageLoader.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 67C1FB634A01239B1C24A1F1AB5FE9B5 /* ActivityIndicator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6424956A73BDBDE8FCF6F6AFA359110C /* ActivityIndicator.swift */; }; + 6C93ABDF963DDA7C78AADD9F22CD5CB1 /* NSBezierPath+SDRoundedCorners.h in Headers */ = {isa = PBXBuildFile; fileRef = 5427FAC312064D259128FA8746B9F98A /* NSBezierPath+SDRoundedCorners.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 6F4B172730B7293C1D988FBE34B45E20 /* SDWebImageOptionsProcessor.h in Headers */ = {isa = PBXBuildFile; fileRef = 9C24738267D466F84218734D0C534311 /* SDWebImageOptionsProcessor.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 70CA6CF0FE0ECE29E4B93A4D29924A56 /* Indicator.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3A968D533B5F4B87D688B9C201D03CD /* Indicator.swift */; }; + 73F2DE8B48DC2F7C87529AB3901B9E94 /* UIImage+Metadata.h in Headers */ = {isa = PBXBuildFile; fileRef = 778276C86B4E8C0022EE8494F53ACBA2 /* UIImage+Metadata.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 74A030EB7B325E85D978F15DC6E88A30 /* Client_TVSeasonsEpisodes.swift in Sources */ = {isa = PBXBuildFile; fileRef = CF1E137CEB2F512808DC6749A8072D3A /* Client_TVSeasonsEpisodes.swift */; }; + 78A9B70D8A71E8E3E70A9AF02149D893 /* ChangesMDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = 07534B6F5A3589DF38E5553CEF643A64 /* ChangesMDB.swift */; }; + 78AE96580BD551EB905F72C21AB81E97 /* SDImageCachesManagerOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = A355A0646F71C56E8997FDFADF57C464 /* SDImageCachesManagerOperation.m */; }; + 7A424FED21A399FE2610DCB710A4A3FB /* SDWebImageOptionsProcessor.m in Sources */ = {isa = PBXBuildFile; fileRef = 0F1299C404AC800C4D663856B1E8BACB /* SDWebImageOptionsProcessor.m */; }; + 7ABC507AF4E384FC551A22DE93891D1D /* Transition.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6AEEAB7F41F8C50F26492D9A848E9044 /* Transition.swift */; }; + 7D9E8F8A5D02148FCC2DBD6319BCC3D1 /* SDWebImageDefine.h in Headers */ = {isa = PBXBuildFile; fileRef = B17123CFD1ADD25B8187654D73E06312 /* SDWebImageDefine.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 7E6862A73246BB1A0E7BCEBAF50FFBE1 /* NSButton+WebCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 734741E8899B00DDC31612B7D12F62CC /* NSButton+WebCache.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 809A09224ABB6A00BEF6B72EFAB30B4E /* SDImageAPNGCoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 43BA409DA09A66B3C1CE81AD6F982191 /* SDImageAPNGCoder.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 80D4A72C26C2EF865F9DCA400D2F1E70 /* SDImageGraphics.h in Headers */ = {isa = PBXBuildFile; fileRef = AE25E11448D3CC5CBF82BA033FA0F27B /* SDImageGraphics.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 81E7C341F32997CCB744EE95DF06E93C /* Client_Genres.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77FB29967A3C58B49D7F038E78D9F21C /* Client_Genres.swift */; }; + 8433F353F3016EFF0316F48188D6B651 /* SDInternalMacros.h in Headers */ = {isa = PBXBuildFile; fileRef = 424D3DAF8FDA19B777BBB4243F391D11 /* SDInternalMacros.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 846EAAE5A9FFC5EAB11B606B63AAA4EF /* ConfigurationMDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBACB54D48BDF9644EF5F98A840EB5BD /* ConfigurationMDB.swift */; }; + 84B624227D73D3746CEFD48E49D74635 /* SDAssociatedObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B91CCC5CB8970101664985116DB4516 /* SDAssociatedObject.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 84B62AA0E3938AFDDA7A4DE9FC610AD9 /* ProgressIndicator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 845713C1F7FD56AD06D720F6C3E080DD /* ProgressIndicator.swift */; }; + 854D7A4A2872566E4D06870518053225 /* SDImageAPNGCoder.m in Sources */ = {isa = PBXBuildFile; fileRef = F0234DBFE4F7D479F77E83CD66A1712F /* SDImageAPNGCoder.m */; }; + 86FAB0E018E830833637F9793540223F /* SDWebImageSwiftUI-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = BDAE8BFA7CCEC385052A98BD487AC5B5 /* SDWebImageSwiftUI-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 87FA207D3B39B4C89E603F9C963CFC72 /* TVDetailedMDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAB07FF6690A0CDB206ED4A8F0CD09E5 /* TVDetailedMDB.swift */; }; + 8821E3636BB86560FC2F2D2CFF545F16 /* SDImageCodersManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 57E0C9B78F91FB83BC84243E988C4ACF /* SDImageCodersManager.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 888BEE4C3B238AC407C59D2194939AB9 /* SDImageCacheConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = BDA64BEA2EBE20CAB7FEBF5689D0EE2B /* SDImageCacheConfig.m */; }; + 8C5D0B2A7B52DF68D03820244993E91B /* SDImageTransformer.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B00E0FFAC1FB1CE337B21E0BA362E59 /* SDImageTransformer.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 8C9D609988FE2993BB116B4B00FAC57B /* SDWebImagePrefetcher.h in Headers */ = {isa = PBXBuildFile; fileRef = B5B29A35E66CB613C265C60C37C87594 /* SDWebImagePrefetcher.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 8F88549F032EFFEA9C281860520CC879 /* SDWebImageIndicator.h in Headers */ = {isa = PBXBuildFile; fileRef = 9DE9D63E915DEDF6021F7F0286C96D26 /* SDWebImageIndicator.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 903CF46B7C015A24716B14163CAAD3AB /* Discover.swift in Sources */ = {isa = PBXBuildFile; fileRef = FB7ACB2C7DA8AA12633FC1AA68DA69E7 /* Discover.swift */; }; + 909CBA577868D6E976AC82340B50343E /* SDImageCachesManager.h in Headers */ = {isa = PBXBuildFile; fileRef = BABB9971DF648AB9F2CFEDB5D608B241 /* SDImageCachesManager.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 94BE73B37F3BC716999F9BF3558F7143 /* ImagesMDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB9AB64D518713EB8A14B1A45ADB274F /* ImagesMDB.swift */; }; + 9514357C83E6BD50F897642320D2661B /* Image.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0265CCACAB5F0FBCD854C406AC0451F /* Image.swift */; }; + 9642957A643D90E5A5741EF65D85D4C3 /* ImageViewWrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = CAE6157DF40832B819ED1DC14DC4A3F5 /* ImageViewWrapper.swift */; }; + 96479C9C76FDC513C03ADD58168F6911 /* SDImageIOAnimatedCoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 315ED0787420F87684970B96D199CEEC /* SDImageIOAnimatedCoder.m */; }; + 9917CEAD8CE1CEB7FEC031255AED8FA8 /* SDWebImageError.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C5E565566D2038F562360B38D6C2537 /* SDWebImageError.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 994327308CC7ECE7850C804FA0EA5F21 /* NSImage+Compatibility.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B5E0882BB068A6828040133E42DE595 /* NSImage+Compatibility.m */; }; + 99709E1C4991C49EE5601FF9461B2969 /* SDImageHEICCoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 261D29F1AAFC30E2F8ABA03335304579 /* SDImageHEICCoder.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 9A5E72F1D0402E979941752021C428F3 /* Client_Lists.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8EC427952B5EEBA3CBFFC885105C9E68 /* Client_Lists.swift */; }; + 9C096C865369C21D252A0F4F90BE21D9 /* SDWeakProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B7FFF2E5B9F43DC6B7B87DC9CE3C472 /* SDWeakProxy.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 9CEB5B454088D6BCC3A11C759A76161A /* SDAnimatedImage.m in Sources */ = {isa = PBXBuildFile; fileRef = 1C3D0C3541722AAC8A11CDFEDB71E701 /* SDAnimatedImage.m */; }; + 9D041D7328C59BBE3E5A4D23F3265ACB /* PageResultsMDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB9338AB851938F757B655AC20A0D9F9 /* PageResultsMDB.swift */; }; + 9D7EBB3A7377C116526B8A511F8CE245 /* SDDisplayLink.m in Sources */ = {isa = PBXBuildFile; fileRef = AE87800AE145C78144BB7248F25A9572 /* SDDisplayLink.m */; }; + A083AAC3481062E5DE223D480757A83B /* UIButton+WebCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 763B2A212DCA56DC520205A7A45684E2 /* UIButton+WebCache.h */; settings = {ATTRIBUTES = (Public, ); }; }; + A24B4B60656BA387B9979BD877A23983 /* SDDisplayLink.h in Headers */ = {isa = PBXBuildFile; fileRef = 277BBBA53BFD35133D89C78878375BF4 /* SDDisplayLink.h */; settings = {ATTRIBUTES = (Private, ); }; }; + A2CE92DE43AB450DE1AAA129BFBADCBE /* SDGraphicsImageRenderer.h in Headers */ = {isa = PBXBuildFile; fileRef = CCE56E86000EBF1F740329AE873EC144 /* SDGraphicsImageRenderer.h */; settings = {ATTRIBUTES = (Public, ); }; }; + A39D8EE617B273BC372B9B1EBD4008B3 /* Client_Search.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2386827B7211BC42131DFA9213B3B86E /* Client_Search.swift */; }; + A3BFF0CDB72BC173BEA1C8ADDBDB0D1D /* UIView+WebCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 17F2FE2B4D77CE151BB645012EF7AF6C /* UIView+WebCache.m */; }; + A8A448F067C823A0EB46823FC123CA53 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6CDC6391E3063232D20F2FFE1617B4AA /* Foundation.framework */; }; + A9A87DA629538D239C4B7401EB56AEB5 /* SDImageTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = 9A36F4575DE2CE33ABD338EA4A391EC8 /* SDImageTransformer.m */; }; + AA3AE0DF5E35D3E0D2CAE7972D69373E /* SDAnimatedImageView+WebCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 3971D6B8F23A0DDEC9762958DC273E75 /* SDAnimatedImageView+WebCache.m */; }; + ABEAA41C35A6CD25C93E622FB129C379 /* SDImageLoader.m in Sources */ = {isa = PBXBuildFile; fileRef = 42A5717BB91B605250A8A7DB389575E9 /* SDImageLoader.m */; }; + AD0CFDA140E346502935BA58225E6EF3 /* SDWebImageDownloaderRequestModifier.h in Headers */ = {isa = PBXBuildFile; fileRef = FC3A59CAFAFD7770905CEF0C9D75D10A /* SDWebImageDownloaderRequestModifier.h */; settings = {ATTRIBUTES = (Public, ); }; }; + AE89C60F9CD4D6E1400DD304CE2A2B9E /* UIColor+SDHexString.m in Sources */ = {isa = PBXBuildFile; fileRef = 0BFFD0254504CE25C09591C4E2D14EAA /* UIColor+SDHexString.m */; }; + B02C71E7B7A569633C0815EB06AAAD5F /* Config.swift in Sources */ = {isa = PBXBuildFile; fileRef = 16D332BFEC872D08F2F300208D0C6295 /* Config.swift */; }; + B04279CC3476C6D75EDE63B360B89DEC /* SDWebImageTransitionInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 39B1F80D2827984FDEB93BD63F4E243C /* SDWebImageTransitionInternal.h */; settings = {ATTRIBUTES = (Private, ); }; }; + B128DE666CCA7CF6B0F09411D8209A92 /* SDWebImageCacheKeyFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = F0592577DFD8156A44F4337B7C6DD1F5 /* SDWebImageCacheKeyFilter.h */; settings = {ATTRIBUTES = (Public, ); }; }; + B14D8D6F4EAD7EA6EF3221344E48EFFA /* TVMDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = EF7DE75F48872C3DF4BF488ABA98E1A4 /* TVMDB.swift */; }; + B1E01BC7CE28C42C8FA2CBB3656913A4 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6CDC6391E3063232D20F2FFE1617B4AA /* Foundation.framework */; }; + B687AA0580BE6B6D50FDAFFE6978C1C4 /* Client_Configuration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2DC89E9F0BD25525AE3C146116DCF067 /* Client_Configuration.swift */; }; + B854BB1616DA13096F1647A1C48CAC98 /* Client_TV.swift in Sources */ = {isa = PBXBuildFile; fileRef = C1BDE9B7E27457D8DE056D2AB81BE86F /* Client_TV.swift */; }; + B88C351562CE8FA4255EA9023213BE4E /* SDGraphicsImageRenderer.m in Sources */ = {isa = PBXBuildFile; fileRef = 24C1536F1535104A934F2CB40FF77725 /* SDGraphicsImageRenderer.m */; }; + B89DB43E91E14387DCC1941172161363 /* TMDBSwift-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 669824AE01A9870A88D27578DB870945 /* TMDBSwift-dummy.m */; }; + B9DC358432C0A7CFCE2630C6E4D61F6C /* Pods-NetflixCloneApp-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = EF0809D2458F0C237FE81487FAAC2FAF /* Pods-NetflixCloneApp-dummy.m */; }; + BA07918DB25DBF75C629C8DC03790E25 /* CreditsMDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67DA7577A1952A22D720FCFCDD883961 /* CreditsMDB.swift */; }; + BACCD0E829C168C43E4E6011EC49FA9C /* TranslationsMDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = F6A0103836154E2452BC19A5428C1BCC /* TranslationsMDB.swift */; }; + BCB7B61DB37BA3EDB8CBBF258DC66446 /* UIImage+ExtendedCacheData.m in Sources */ = {isa = PBXBuildFile; fileRef = 56174EC846D710EBB2914E297D9C2535 /* UIImage+ExtendedCacheData.m */; }; + BD074722CD72470954ADB5B1198E01C5 /* NSData+ImageContentType.h in Headers */ = {isa = PBXBuildFile; fileRef = 0C77914A636766438F28EAABB76EB38C /* NSData+ImageContentType.h */; settings = {ATTRIBUTES = (Public, ); }; }; + BD78906CCD22CCA29C60E8AB4A556FE0 /* Client_Keywords.swift in Sources */ = {isa = PBXBuildFile; fileRef = B66E97E407E57B162E6F4D9CD92EF6A9 /* Client_Keywords.swift */; }; + BE649A29E5FB32C54FDAE55994804F6D /* SDWebImageOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = D08446011D516129E91DA04FF7A65374 /* SDWebImageOperation.m */; }; + BF9A6E2CB8F67686C4B7E04538664919 /* UIImage+Transform.m in Sources */ = {isa = PBXBuildFile; fileRef = 45BFD9C9D54CDAAA33C02ACF498D585E /* UIImage+Transform.m */; }; + C27BD8C6B4E713A8E7B7B76B80E45823 /* SDWebImageDownloaderRequestModifier.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C44E28EA371C025196A4CB7918011D6 /* SDWebImageDownloaderRequestModifier.m */; }; + C2D82385F4FDB67F6613CBBE8E2BD850 /* SDMemoryCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 2349D51F956065FE067820B390F2720D /* SDMemoryCache.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C4762BD85B320B9EBE199F7CDFBCED12 /* UIImageView+HighlightedWebCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 07D2FAC161314E0FAD0AF64D75353E95 /* UIImageView+HighlightedWebCache.m */; }; + C4A78B8FC2DC76FBCF43D9D53BF90767 /* SDImageLoadersManager.h in Headers */ = {isa = PBXBuildFile; fileRef = E386BA2DAAB24CAAA6C16CCEA1D7ED2F /* SDImageLoadersManager.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C55A2D001850D3F407D968CFF1C545E2 /* UIButton+WebCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 848B4065D38A7403C3720DF5BD73DCA6 /* UIButton+WebCache.m */; }; + C5B3BD066B09D8C5E0816611581A854F /* Client_Find.swift in Sources */ = {isa = PBXBuildFile; fileRef = 754A9B7470891647AA65434C0517A4CC /* Client_Find.swift */; }; + C5BA14E395FFFB17E8EF61C4D4A31BF7 /* MovieDetailedMDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5FB71F86CB99F42D724FF7229BF2FBDF /* MovieDetailedMDB.swift */; }; + C7E8A80BE6BE5452380D8CA71F278B8A /* SDImageGIFCoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 118F58E1B7F7D9A1EFD4A73CC435D934 /* SDImageGIFCoder.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C91200738612F1E36114D53986DDEDFB /* Pods-NetflixCloneApp-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 0558971FB75DB8453239C411BCEC2DAD /* Pods-NetflixCloneApp-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; + CB964148B3723B29080C96E8118FB637 /* TVEpisodesMDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = E9F02601F1289C9CEAA0B98ABC87F3A3 /* TVEpisodesMDB.swift */; }; + CD193DB9492BC39C535A7C634A9B22B3 /* WebImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 970AB672654E8E222C76318D6D0BB710 /* WebImage.swift */; }; + D32CD017BE7DBA113094C281E88BA7E5 /* FindMDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = 611C8DB907A2BFACAB392E65A661C99A /* FindMDB.swift */; }; + D41DB8D66B3F4FE6BFECA6D3564738D5 /* DiscoverMovie.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C30EFC078030A3A5108C43BA8EF980E /* DiscoverMovie.swift */; }; + D556C63635E7A83C7A9B04FB104F7339 /* UIImage+Transform.h in Headers */ = {isa = PBXBuildFile; fileRef = 8348EABD3A7C31513FC4D420662EA048 /* UIImage+Transform.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D5609B248021BEDC162513BABCD70A62 /* MovieCreditsMDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D187EE3CB40C5EDBB671F26D3A53CC5 /* MovieCreditsMDB.swift */; }; + D68F08F717E95BABFB43AE705D943426 /* SDWebImageDownloader.m in Sources */ = {isa = PBXBuildFile; fileRef = ECF54ACDF48DDD24BA5FAC139CA1D88E /* SDWebImageDownloader.m */; }; + D75DD60C91583127B32729BC9D02D7F1 /* MovieReviewMDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = A277B41F7D5557D863FF285FE3258DD0 /* MovieReviewMDB.swift */; }; + D7BA04ADFE3104907F100E9370184A65 /* UIImage+ExtendedCacheData.h in Headers */ = {isa = PBXBuildFile; fileRef = EFD62D5E05FF1392ABF87360FC18C6D1 /* UIImage+ExtendedCacheData.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D7D077F0FA5CAC32ACB65372453C701F /* SDImageAWebPCoder.m in Sources */ = {isa = PBXBuildFile; fileRef = BE301BC46F0E71127A8C7B0D1B1C0385 /* SDImageAWebPCoder.m */; }; + D88076DA0593D2835645CA5A92FFA37C /* SDAnimatedImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = AC690A8DB4DCB030E759463F398B0B84 /* SDAnimatedImageView.m */; }; + D9203A26D364066C303A621158C8F17D /* ListsMDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA9EC5C6A81CE257982C8C214FF89AF0 /* ListsMDB.swift */; }; + D964D8A4FCA93784898BF3C3F55C466F /* Alternative_TitlesMDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = E48532E92ADAA5E8BAF71B82366E9426 /* Alternative_TitlesMDB.swift */; }; + D975B260AB44081399BCB612916CE675 /* UIView+WebCache.h in Headers */ = {isa = PBXBuildFile; fileRef = F540372155C330041B9A6E4F78A76FBD /* UIView+WebCache.h */; settings = {ATTRIBUTES = (Public, ); }; }; + DB61822BEA875B413C858E1166590C9F /* SDWebImageDownloaderOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = 0FA8BF319E806466E4249543C60A339B /* SDWebImageDownloaderOperation.m */; }; + DB68D9AFA817850ED9EBBE7F3F378AF5 /* SDImageCodersManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 260519EED0EEE0D055DCC7EC5A3CD2B5 /* SDImageCodersManager.m */; }; + DBBAC864AD405BED53782364E0F0D5F3 /* UIImage+GIF.h in Headers */ = {isa = PBXBuildFile; fileRef = 230D9FFEEB976E721F9FE5490FE259FD /* UIImage+GIF.h */; settings = {ATTRIBUTES = (Public, ); }; }; + DDEC8B313656488F61F7BF091DB22989 /* SwiftUICompatibility.swift in Sources */ = {isa = PBXBuildFile; fileRef = 456A6D3E180E391DFF7E5C3783AAB57D /* SwiftUICompatibility.swift */; }; + DE0BA471FB4FC10C0B25BDE4F22F5B76 /* SDWebImageDownloaderDecryptor.m in Sources */ = {isa = PBXBuildFile; fileRef = BCFF56BB044955624286A31284022D3A /* SDWebImageDownloaderDecryptor.m */; }; + DECA57AF64C5C257919649ECBB75F0B9 /* SDWebImageCacheSerializer.h in Headers */ = {isa = PBXBuildFile; fileRef = 6207E5710B48B087F886CE7BF01BA523 /* SDWebImageCacheSerializer.h */; settings = {ATTRIBUTES = (Public, ); }; }; + DEE74CD0E78DE0DB4056A8A3244B6ED1 /* UIImage+GIF.m in Sources */ = {isa = PBXBuildFile; fileRef = 053B94F0670A3E01C4721348BFA34D22 /* UIImage+GIF.m */; }; + E0D1C9C85B8E3DB406BDFC2F48387F96 /* SDWebImageSwiftUI.h in Headers */ = {isa = PBXBuildFile; fileRef = 102D4250922B45BBA54B65EB2061D136 /* SDWebImageSwiftUI.h */; settings = {ATTRIBUTES = (Public, ); }; }; + E2189B95EC78D6940D074922EA85058A /* SearchMDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8E5FA8E52E94FD3521B812B9C59068FF /* SearchMDB.swift */; }; + E33A7CDF3107CD3426ADD0D906100CD4 /* SDImageHEICCoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 0F70DED218FE80E8A856DE781D2C6EA7 /* SDImageHEICCoder.m */; }; + E35154EF5A67CC95CBD13F0F864B77FD /* GenresMDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = ADE5AD6AC1755CDA02875A69FE7C135A /* GenresMDB.swift */; }; + E4803601B8827074D11488BF1A24B23E /* MovieMDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = A2A4AA03E06BC6590C8F8A52BBDF1849 /* MovieMDB.swift */; }; + E4AF87F8012F919F00E2E8698A1A3C33 /* SDWebImageCompat.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D154CF4A9B7C691AE982AE1C28C6FD0 /* SDWebImageCompat.m */; }; + E515780850EBAD40342EBF2997BFC2D2 /* SDWebImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 828447C148B8246DC83EDB1A607DFB65 /* SDWebImage.h */; settings = {ATTRIBUTES = (Public, ); }; }; + E556832E0C191FCFABB9E97C87D243EF /* SDmetamacros.h in Headers */ = {isa = PBXBuildFile; fileRef = 639968E386E9D7C8E6939D4CFE4D26B7 /* SDmetamacros.h */; settings = {ATTRIBUTES = (Private, ); }; }; + E5B0BF91AD9557EF44ABA4FC6FDFE378 /* SwiftyJSON.swift in Sources */ = {isa = PBXBuildFile; fileRef = 309C65F2971C893297C7911B8D3923A0 /* SwiftyJSON.swift */; }; + E5C6051933677CDF392BF6356271A92E /* SDImageIOCoder.h in Headers */ = {isa = PBXBuildFile; fileRef = B0DA1B787C3CC1D16FF2C9E60FE2E480 /* SDImageIOCoder.h */; settings = {ATTRIBUTES = (Public, ); }; }; + E7FA1E1CD066D0335A95376C73E3F8ED /* SDImageCacheConfig.h in Headers */ = {isa = PBXBuildFile; fileRef = 35A468B922A2797BBFE32C4B813C2258 /* SDImageCacheConfig.h */; settings = {ATTRIBUTES = (Public, ); }; }; + E8B7E54A9FCDA9BD29B3C94E790F82EA /* TMDBSwift-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 07FEE4A81594292AB10FFBFE806B6813 /* TMDBSwift-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; + E8CE28499C17965A931605D4F47AAEBF /* NSImage+Compatibility.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E3D57C2651DEF2F4F6351FF6FC0F34F /* NSImage+Compatibility.h */; settings = {ATTRIBUTES = (Public, ); }; }; + E8D519B63C2077979F799769F9A35072 /* SDImageCachesManagerOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = 988D6A68DD4918A73028756ADC37A58D /* SDImageCachesManagerOperation.h */; settings = {ATTRIBUTES = (Private, ); }; }; + E9CF46857D61D2A8AF4C3722C27C61C6 /* SDImageCoderHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 7F7974BC8380083A84D9174ED340CFCB /* SDImageCoderHelper.m */; }; + EAC5370F7B165E42747ED6F985591030 /* Client_Changes.swift in Sources */ = {isa = PBXBuildFile; fileRef = B877E55F483FBE792D7ACD37195CBD2F /* Client_Changes.swift */; }; + EC81B58EB88B89AC165F08940056DCAA /* ExternalIdsMDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = 88FE49A37E0AD4BCC4A654CDF4731715 /* ExternalIdsMDB.swift */; }; + EC8340E9DCB0907EFB2D61787A3C609C /* Client_Companies.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB001BA0C1F15DA56E443AF2130F7F22 /* Client_Companies.swift */; }; + EE6F3CFB98760F2A902215A1F021600B /* TVSeasonsMDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB084BDB4A8A18EA6D311AA77E7406FB /* TVSeasonsMDB.swift */; }; + F077E74D9855D0D7FCF570F8E8ED4A1E /* SDFileAttributeHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = ADF733BE6CC529AD23B5792C41EF996D /* SDFileAttributeHelper.h */; settings = {ATTRIBUTES = (Private, ); }; }; + F0E28CEF30861F3589A4A662CEA76D80 /* SDImageGraphics.m in Sources */ = {isa = PBXBuildFile; fileRef = B6F03BDD5B4C10813F899EBBB51E32FD /* SDImageGraphics.m */; }; + F1073C7FEEB33B88CEA3E2C59CE22ADD /* ArrayObjectProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 854A8DFFA133EC626FB283087453A394 /* ArrayObjectProtocol.swift */; }; + F161112B04B9AC7D276D9F588BA6E313 /* SDDeviceHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = 772BC85255A03C58EC49B33E114EA9FE /* SDDeviceHelper.h */; settings = {ATTRIBUTES = (Private, ); }; }; + F1C518EC288D909884FABA3A757D39F2 /* CastCrewMDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = E79C2709B1C112002B06C4B6CBBBA0A4 /* CastCrewMDB.swift */; }; + F463DEB020D5C466D4613947AE4BE16F /* SDAnimatedImageView.h in Headers */ = {isa = PBXBuildFile; fileRef = 0C0C8228A943EDFEAF7006D5DB292A4B /* SDAnimatedImageView.h */; settings = {ATTRIBUTES = (Public, ); }; }; + F47A28893F8A3DE9BE2957F64BD849B3 /* MovieReleaseDatesMDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = B9AC5389FAE0CB614D95F719B8B0F6C9 /* MovieReleaseDatesMDB.swift */; }; + F4811CFAC05932CE436CC2C32BAD91E6 /* UIColor+SDHexString.h in Headers */ = {isa = PBXBuildFile; fileRef = 6DD129AB5D570E00831B6AD86A7C491C /* UIColor+SDHexString.h */; settings = {ATTRIBUTES = (Private, ); }; }; + F497CD01EF6568475FD363A248D78A4B /* UIImage+ForceDecode.m in Sources */ = {isa = PBXBuildFile; fileRef = 3A947D2AB9920FC44D8E77DD503B88F4 /* UIImage+ForceDecode.m */; }; + F7289F163C285103D6CCAB39447153CA /* SDWebImageDownloaderConfig.h in Headers */ = {isa = PBXBuildFile; fileRef = FB93F270C46AFA532AFB4D59303DBC89 /* SDWebImageDownloaderConfig.h */; settings = {ATTRIBUTES = (Public, ); }; }; + F919E81955613058B2AD930AE4EE47C0 /* Client_Networks.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAFC3D1C8D426405D666A2D144593F61 /* Client_Networks.swift */; }; + FB359FC2B8375E01A8A8F84D3C50EE82 /* SDWebImageDownloaderResponseModifier.m in Sources */ = {isa = PBXBuildFile; fileRef = BC6C1D386BA08CA936A93E3C4CCB9842 /* SDWebImageDownloaderResponseModifier.m */; }; + FB5688F39EBB6B642F2C442DA3E7D903 /* ImagePlayer.swift in Sources */ = {isa = PBXBuildFile; fileRef = A2B4BB661460E989B1B114EB820183E0 /* ImagePlayer.swift */; }; + FD94C88E34D9C549FD89183D34995529 /* MovieListMDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8AD79F0044DD72FB1E1D60BEF0E90BB8 /* MovieListMDB.swift */; }; + FE0189D2FE038AD82C4CCF5A801A50A3 /* SDDiskCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 34ED975954C4134CC497AAE2EFDA793A /* SDDiskCache.h */; settings = {ATTRIBUTES = (Public, ); }; }; + FE05A1BF611E69C94BC7A9EADBE10B2F /* SDWebImageDownloaderConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = 8D6DCC2FB430E15F8E009435EBFE3884 /* SDWebImageDownloaderConfig.m */; }; + FE4845B6FDD260059CDF9E26965CA31B /* SDWebImageManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 7836EBB911801AEF9D8F2B396839ECDF /* SDWebImageManager.m */; }; + FED292AF8AD5924263FC0A8D0B8AF26D /* SDWebImageCompat.h in Headers */ = {isa = PBXBuildFile; fileRef = B49F6E5964DD917FEAF44D0133973466 /* SDWebImageCompat.h */; settings = {ATTRIBUTES = (Public, ); }; }; + FF66F3E7374A9398D5B08AA23273BC0E /* NSData+ImageContentType.m in Sources */ = {isa = PBXBuildFile; fileRef = BC77972C0EA8399E6DFBB1DC6110EC10 /* NSData+ImageContentType.m */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ - 9838D13BDDBA6702AB43F8ED7432E3E4 /* PBXContainerItemProxy */ = { + 24FEAF3A507C4C32F233B6EFFBC83468 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; proxyType = 1; remoteGlobalIDString = CD08042101584CD51388D925427AEBAC; remoteInfo = TMDBSwift; }; + C017CA66E6134505EB40D23A724D588F /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 3847153A6E5EEFB86565BA840768F429; + remoteInfo = SDWebImage; + }; + CF469B45566AE02793689FFA3D8A5C73 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 3847153A6E5EEFB86565BA840768F429; + remoteInfo = SDWebImage; + }; + EDAC4E5D8CB7D87E30498E28039F0BFB /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 92EBFA3E7005B4C18A9C0B44324EB80F; + remoteInfo = SDWebImageSwiftUI; + }; /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ + 053B94F0670A3E01C4721348BFA34D22 /* UIImage+GIF.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "UIImage+GIF.m"; path = "SDWebImage/Core/UIImage+GIF.m"; sourceTree = ""; }; 0558971FB75DB8453239C411BCEC2DAD /* Pods-NetflixCloneApp-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-NetflixCloneApp-umbrella.h"; sourceTree = ""; }; - 059A37A8FA268997D999344578870A5A /* ConfigurationMDB.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConfigurationMDB.swift; path = Sources/Models/ConfigurationMDB.swift; sourceTree = ""; }; - 0B2C36D6DA0B21E4F469124AA3A959B5 /* ImagesMDB.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ImagesMDB.swift; path = Sources/Models/ImagesMDB.swift; sourceTree = ""; }; - 0C2FABE0D74688BF5E2012A73CB4089B /* Client_Keywords.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Client_Keywords.swift; path = Sources/Client/Client_Keywords.swift; sourceTree = ""; }; - 0EE3B0B8EC96581EC5EEDD9B2920838A /* Client.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Client.swift; path = Sources/Client/Client.swift; sourceTree = ""; }; - 1620D25A21B1A1C3FEC77904337170C2 /* MovieMDB.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = MovieMDB.swift; path = Sources/Models/MovieMDB.swift; sourceTree = ""; }; - 18849A7F5FF4EED5D0763638A0EDB982 /* TVMDB.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = TVMDB.swift; path = Sources/Models/TVMDB.swift; sourceTree = ""; }; - 1968869884DD04E9A28FD7979D247705 /* TVEpisodesMDB.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = TVEpisodesMDB.swift; path = Sources/Models/TVEpisodesMDB.swift; sourceTree = ""; }; - 1AF9EB12789629C68F8F23C093A3687B /* TVSeasonsMDB.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = TVSeasonsMDB.swift; path = Sources/Models/TVSeasonsMDB.swift; sourceTree = ""; }; - 218819B9500A5A674B469565A46CAEBB /* VideosMDB.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = VideosMDB.swift; path = Sources/Models/VideosMDB.swift; sourceTree = ""; }; - 23151DC84B3AEBA73B0D526A9FF9936C /* Alternative_TitlesMDB.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Alternative_TitlesMDB.swift; path = Sources/Models/Alternative_TitlesMDB.swift; sourceTree = ""; }; - 2593DB0CA37BB9C01EC85EDEFE3BDF6F /* TMDBSwift-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "TMDBSwift-prefix.pch"; sourceTree = ""; }; - 2C6C26925EFE5EF004902946219CFFD7 /* KeywordsMDB.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = KeywordsMDB.swift; path = Sources/Models/KeywordsMDB.swift; sourceTree = ""; }; - 2F70754DEC2828153894BDE600CA71B5 /* CompaniesMDB.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CompaniesMDB.swift; path = Sources/Models/CompaniesMDB.swift; sourceTree = ""; }; - 3146C890D18D2D1C7B405FA42BCE4C35 /* Client_Networks.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Client_Networks.swift; path = Sources/Client/Client_Networks.swift; sourceTree = ""; }; + 071E024099A72F8BDDCFA119562C2D00 /* SDWebImageSwiftUI-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "SDWebImageSwiftUI-dummy.m"; sourceTree = ""; }; + 074FDAC8D9775DF408E7F877AA8CD8B9 /* SDWebImageDefine.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDWebImageDefine.m; path = SDWebImage/Core/SDWebImageDefine.m; sourceTree = ""; }; + 07534B6F5A3589DF38E5553CEF643A64 /* ChangesMDB.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ChangesMDB.swift; path = Sources/Models/ChangesMDB.swift; sourceTree = ""; }; + 07D2FAC161314E0FAD0AF64D75353E95 /* UIImageView+HighlightedWebCache.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "UIImageView+HighlightedWebCache.m"; path = "SDWebImage/Core/UIImageView+HighlightedWebCache.m"; sourceTree = ""; }; + 07FEE4A81594292AB10FFBFE806B6813 /* TMDBSwift-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "TMDBSwift-umbrella.h"; sourceTree = ""; }; + 09057BE2905EA1A27AF3AE51A4789396 /* SDWebImageSwiftUI.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = SDWebImageSwiftUI.debug.xcconfig; sourceTree = ""; }; + 0ACF56488DA017E7C0AAE512268CE3BB /* SDAsyncBlockOperation.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDAsyncBlockOperation.h; path = SDWebImage/Private/SDAsyncBlockOperation.h; sourceTree = ""; }; + 0BFFD0254504CE25C09591C4E2D14EAA /* UIColor+SDHexString.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "UIColor+SDHexString.m"; path = "SDWebImage/Private/UIColor+SDHexString.m"; sourceTree = ""; }; + 0C08EB189AEC0772406B978B922303E4 /* VideosMDB.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = VideosMDB.swift; path = Sources/Models/VideosMDB.swift; sourceTree = ""; }; + 0C0C8228A943EDFEAF7006D5DB292A4B /* SDAnimatedImageView.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDAnimatedImageView.h; path = SDWebImage/Core/SDAnimatedImageView.h; sourceTree = ""; }; + 0C77914A636766438F28EAABB76EB38C /* NSData+ImageContentType.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "NSData+ImageContentType.h"; path = "SDWebImage/Core/NSData+ImageContentType.h"; sourceTree = ""; }; + 0F1299C404AC800C4D663856B1E8BACB /* SDWebImageOptionsProcessor.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDWebImageOptionsProcessor.m; path = SDWebImage/Core/SDWebImageOptionsProcessor.m; sourceTree = ""; }; + 0F70DED218FE80E8A856DE781D2C6EA7 /* SDImageHEICCoder.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDImageHEICCoder.m; path = SDWebImage/Core/SDImageHEICCoder.m; sourceTree = ""; }; + 0FA8BF319E806466E4249543C60A339B /* SDWebImageDownloaderOperation.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDWebImageDownloaderOperation.m; path = SDWebImage/Core/SDWebImageDownloaderOperation.m; sourceTree = ""; }; + 0FD272B910C778D660B582837C3683C5 /* MovieMDBModel.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = MovieMDBModel.swift; path = Sources/Models/MovieMDBModel.swift; sourceTree = ""; }; + 102D4250922B45BBA54B65EB2061D136 /* SDWebImageSwiftUI.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDWebImageSwiftUI.h; path = SDWebImageSwiftUI/Module/SDWebImageSwiftUI.h; sourceTree = ""; }; + 118F58E1B7F7D9A1EFD4A73CC435D934 /* SDImageGIFCoder.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDImageGIFCoder.h; path = SDWebImage/Core/SDImageGIFCoder.h; sourceTree = ""; }; + 15447C7B9DB58C272C2635667B3F5E23 /* SDImageIOAnimatedCoderInternal.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDImageIOAnimatedCoderInternal.h; path = SDWebImage/Private/SDImageIOAnimatedCoderInternal.h; sourceTree = ""; }; + 16D332BFEC872D08F2F300208D0C6295 /* Config.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Config.swift; path = Sources/Client/Config.swift; sourceTree = ""; }; + 17F2FE2B4D77CE151BB645012EF7AF6C /* UIView+WebCache.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "UIView+WebCache.m"; path = "SDWebImage/Core/UIView+WebCache.m"; sourceTree = ""; }; + 17F42EAB1E66DBEF784B40010CCF1C82 /* Client_Movies.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Client_Movies.swift; path = Sources/Client/Client_Movies.swift; sourceTree = ""; }; + 199E9345699B49FDC54349ED1DB496B5 /* SDMemoryCache.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDMemoryCache.m; path = SDWebImage/Core/SDMemoryCache.m; sourceTree = ""; }; + 1A1E648B6566C84BDB4E98C4B4314772 /* SDWebImageCacheSerializer.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDWebImageCacheSerializer.m; path = SDWebImage/Core/SDWebImageCacheSerializer.m; sourceTree = ""; }; + 1C3D0C3541722AAC8A11CDFEDB71E701 /* SDAnimatedImage.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDAnimatedImage.m; path = SDWebImage/Core/SDAnimatedImage.m; sourceTree = ""; }; + 1FED0B73B0083D0A77E6359D484BD21D /* PersonMDB.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = PersonMDB.swift; path = Sources/Models/PersonMDB.swift; sourceTree = ""; }; + 22AD885D3D57E81A6E96E0E72504B6C8 /* ImageIO.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ImageIO.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/ImageIO.framework; sourceTree = DEVELOPER_DIR; }; + 230D9FFEEB976E721F9FE5490FE259FD /* UIImage+GIF.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "UIImage+GIF.h"; path = "SDWebImage/Core/UIImage+GIF.h"; sourceTree = ""; }; + 2349D51F956065FE067820B390F2720D /* SDMemoryCache.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDMemoryCache.h; path = SDWebImage/Core/SDMemoryCache.h; sourceTree = ""; }; + 2386827B7211BC42131DFA9213B3B86E /* Client_Search.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Client_Search.swift; path = Sources/Client/Client_Search.swift; sourceTree = ""; }; + 24C1536F1535104A934F2CB40FF77725 /* SDGraphicsImageRenderer.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDGraphicsImageRenderer.m; path = SDWebImage/Core/SDGraphicsImageRenderer.m; sourceTree = ""; }; + 260519EED0EEE0D055DCC7EC5A3CD2B5 /* SDImageCodersManager.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDImageCodersManager.m; path = SDWebImage/Core/SDImageCodersManager.m; sourceTree = ""; }; + 261D29F1AAFC30E2F8ABA03335304579 /* SDImageHEICCoder.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDImageHEICCoder.h; path = SDWebImage/Core/SDImageHEICCoder.h; sourceTree = ""; }; + 276C0772D5E34653813BB57358D18887 /* SDAnimatedImagePlayer.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDAnimatedImagePlayer.m; path = SDWebImage/Core/SDAnimatedImagePlayer.m; sourceTree = ""; }; + 277BBBA53BFD35133D89C78878375BF4 /* SDDisplayLink.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDDisplayLink.h; path = SDWebImage/Private/SDDisplayLink.h; sourceTree = ""; }; + 2A02C50262F6BC114580EBD93BD1514D /* SDWebImageDownloaderOperation.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDWebImageDownloaderOperation.h; path = SDWebImage/Core/SDWebImageDownloaderOperation.h; sourceTree = ""; }; + 2B97C03D18DA87723386936ACCA969C5 /* SDAnimatedImageView+WebCache.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "SDAnimatedImageView+WebCache.h"; path = "SDWebImage/Core/SDAnimatedImageView+WebCache.h"; sourceTree = ""; }; + 2C7DF6047A555ABEE497BDD03866DAAF /* SDAnimatedImagePlayer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDAnimatedImagePlayer.h; path = SDWebImage/Core/SDAnimatedImagePlayer.h; sourceTree = ""; }; + 2DC89E9F0BD25525AE3C146116DCF067 /* Client_Configuration.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Client_Configuration.swift; path = Sources/Client/Client_Configuration.swift; sourceTree = ""; }; + 309C65F2971C893297C7911B8D3923A0 /* SwiftyJSON.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SwiftyJSON.swift; path = "Sources/Open Source/SwiftyJSON.swift"; sourceTree = ""; }; + 315ED0787420F87684970B96D199CEEC /* SDImageIOAnimatedCoder.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDImageIOAnimatedCoder.m; path = SDWebImage/Core/SDImageIOAnimatedCoder.m; sourceTree = ""; }; + 31D51B41A8DED7D6BA8E604C757DE0B6 /* SDWebImageDownloader.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDWebImageDownloader.h; path = SDWebImage/Core/SDWebImageDownloader.h; sourceTree = ""; }; 34A5BB4A26FED60256FC3F639DE7373B /* Pods-NetflixCloneApp-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-NetflixCloneApp-acknowledgements.plist"; sourceTree = ""; }; - 34F1329326E3F912D76EA4B2657A742F /* TVCreditsMDB.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = TVCreditsMDB.swift; path = Sources/Models/TVCreditsMDB.swift; sourceTree = ""; }; - 375DDE1A615DF1E9F0C7A136653893B9 /* NetworksMDB.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = NetworksMDB.swift; path = Sources/Models/NetworksMDB.swift; sourceTree = ""; }; - 39467FCBF986C060F3619EA6B7BA0CF1 /* CollectionsMDB.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CollectionsMDB.swift; path = Sources/Models/CollectionsMDB.swift; sourceTree = ""; }; - 3D52AAC0B91D9588E349168E2D47EAA7 /* Client_Collections.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Client_Collections.swift; path = Sources/Client/Client_Collections.swift; sourceTree = ""; }; - 3FDDE9C11BFD62B412B328264A33019B /* Client_Genres.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Client_Genres.swift; path = Sources/Client/Client_Genres.swift; sourceTree = ""; }; - 41E14A52C74B98712EB291A957AD990F /* SearchMDB.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SearchMDB.swift; path = Sources/Models/SearchMDB.swift; sourceTree = ""; }; - 49D867069E0F85EBFA8CCEA9E0C62796 /* Client_Lists.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Client_Lists.swift; path = Sources/Client/Client_Lists.swift; sourceTree = ""; }; - 5330C1C040A8C869866E90E279BF38D5 /* ArrayObjectProtocol.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ArrayObjectProtocol.swift; path = Sources/Protocols/ArrayObjectProtocol.swift; sourceTree = ""; }; - 5487B322247890C43C0E63A6683D6F99 /* Client_TVSeasonsEpisodes.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Client_TVSeasonsEpisodes.swift; path = Sources/Client/Client_TVSeasonsEpisodes.swift; sourceTree = ""; }; - 59E887F78B37CE4199AE3E3BDDBBE0A0 /* TMDBSwift-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "TMDBSwift-Info.plist"; sourceTree = ""; }; - 5A99386AE1DC328593CD10E5473F01EA /* Discover.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Discover.swift; path = Sources/Models/Discover/Discover.swift; sourceTree = ""; }; - 5C78810F677E23A27EED88ADE016C834 /* TVMDBModel.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = TVMDBModel.swift; path = Sources/Models/TVMDBModel.swift; sourceTree = ""; }; - 6CB0237073FB750FD000EA43E57316CE /* Clent_Discover.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Clent_Discover.swift; path = Sources/Client/Clent_Discover.swift; sourceTree = ""; }; - 73010CC983E3809BECEE5348DA1BB8C6 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; }; - 731E61625276FD2CA91553C2CDBB2EFB /* Client_Companies.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Client_Companies.swift; path = Sources/Client/Client_Companies.swift; sourceTree = ""; }; - 77E68795F9116AADA8662F6CA1E5DBED /* MovieDetailedMDB.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = MovieDetailedMDB.swift; path = Sources/Models/MovieDetailedMDB.swift; sourceTree = ""; }; - 79FB572DC4FC2E9B349168E18D249507 /* Client_Changes.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Client_Changes.swift; path = Sources/Client/Client_Changes.swift; sourceTree = ""; }; - 7B6D2E2DFA8F737A981D2734539EF279 /* TVDetailedMDB.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = TVDetailedMDB.swift; path = Sources/Models/TVDetailedMDB.swift; sourceTree = ""; }; - 7BE0891E7C6081D9B46D04363DEB995F /* TMDBSwift-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "TMDBSwift-dummy.m"; sourceTree = ""; }; - 7C6FEE16583A802C266A06106FBF1210 /* ExternalIdsMDB.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ExternalIdsMDB.swift; path = Sources/Models/ExternalIdsMDB.swift; sourceTree = ""; }; - 8095B70539EB10416B3F6C80A3B1BB19 /* CreditsMDB.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CreditsMDB.swift; path = Sources/Models/CreditsMDB.swift; sourceTree = ""; }; - 80BCA42E9BDD023A17AA5BEEDCD472D6 /* MovieMDBModel.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = MovieMDBModel.swift; path = Sources/Models/MovieMDBModel.swift; sourceTree = ""; }; - 8445DBDBDEDE62707DC7977D31A605A9 /* GenresMDB.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = GenresMDB.swift; path = Sources/Models/GenresMDB.swift; sourceTree = ""; }; - 8640A514D00B06AAC252FEC4B4035228 /* TMDBSwift.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = TMDBSwift.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 34C48738F4C471ABE5CCC1B4A77639C9 /* SDWebImage.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = SDWebImage.release.xcconfig; sourceTree = ""; }; + 34ED975954C4134CC497AAE2EFDA793A /* SDDiskCache.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDDiskCache.h; path = SDWebImage/Core/SDDiskCache.h; sourceTree = ""; }; + 35A468B922A2797BBFE32C4B813C2258 /* SDImageCacheConfig.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDImageCacheConfig.h; path = SDWebImage/Core/SDImageCacheConfig.h; sourceTree = ""; }; + 365433E30041B149CDE4AF6E35B05F36 /* KeywordsMDB.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = KeywordsMDB.swift; path = Sources/Models/KeywordsMDB.swift; sourceTree = ""; }; + 3785B6D834EFAB609BA7F040AC7296CE /* SDWebImage-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "SDWebImage-dummy.m"; sourceTree = ""; }; + 3971D6B8F23A0DDEC9762958DC273E75 /* SDAnimatedImageView+WebCache.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "SDAnimatedImageView+WebCache.m"; path = "SDWebImage/Core/SDAnimatedImageView+WebCache.m"; sourceTree = ""; }; + 39B1F80D2827984FDEB93BD63F4E243C /* SDWebImageTransitionInternal.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDWebImageTransitionInternal.h; path = SDWebImage/Private/SDWebImageTransitionInternal.h; sourceTree = ""; }; + 3A947D2AB9920FC44D8E77DD503B88F4 /* UIImage+ForceDecode.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "UIImage+ForceDecode.m"; path = "SDWebImage/Core/UIImage+ForceDecode.m"; sourceTree = ""; }; + 3B7FFF2E5B9F43DC6B7B87DC9CE3C472 /* SDWeakProxy.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDWeakProxy.h; path = SDWebImage/Private/SDWeakProxy.h; sourceTree = ""; }; + 3C5C39C09113E31FE804B8C8874326C2 /* ReviewsMDB.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ReviewsMDB.swift; path = Sources/Models/ReviewsMDB.swift; sourceTree = ""; }; + 3D187EE3CB40C5EDBB671F26D3A53CC5 /* MovieCreditsMDB.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = MovieCreditsMDB.swift; path = Sources/Models/MovieCreditsMDB.swift; sourceTree = ""; }; + 3FB2E75C4B6457E44603CFCA62669204 /* SDImageCoder.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDImageCoder.m; path = SDWebImage/Core/SDImageCoder.m; sourceTree = ""; }; + 402645E5F85A5FAF0043F06C75C31DA9 /* SDWebImageTransition.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDWebImageTransition.m; path = SDWebImage/Core/SDWebImageTransition.m; sourceTree = ""; }; + 40F6E25F89A76BCCFA10D470B7F2E88A /* DiscoverTV.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = DiscoverTV.swift; path = Sources/Models/Discover/DiscoverTV.swift; sourceTree = ""; }; + 424D3DAF8FDA19B777BBB4243F391D11 /* SDInternalMacros.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDInternalMacros.h; path = SDWebImage/Private/SDInternalMacros.h; sourceTree = ""; }; + 42A5717BB91B605250A8A7DB389575E9 /* SDImageLoader.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDImageLoader.m; path = SDWebImage/Core/SDImageLoader.m; sourceTree = ""; }; + 43BA409DA09A66B3C1CE81AD6F982191 /* SDImageAPNGCoder.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDImageAPNGCoder.h; path = SDWebImage/Core/SDImageAPNGCoder.h; sourceTree = ""; }; + 456A6D3E180E391DFF7E5C3783AAB57D /* SwiftUICompatibility.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SwiftUICompatibility.swift; path = SDWebImageSwiftUI/Classes/SwiftUICompatibility.swift; sourceTree = ""; }; + 458BD4E0A4C339D5CE61D186D3952E63 /* SDWebImageSwiftUI-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "SDWebImageSwiftUI-Info.plist"; sourceTree = ""; }; + 45BFD9C9D54CDAAA33C02ACF498D585E /* UIImage+Transform.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "UIImage+Transform.m"; path = "SDWebImage/Core/UIImage+Transform.m"; sourceTree = ""; }; + 494E1576C508C08DCE2E696DC24753ED /* SDWebImage-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "SDWebImage-umbrella.h"; sourceTree = ""; }; + 499663A3CCC70621996DDBFF1770260D /* NSButton+WebCache.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "NSButton+WebCache.m"; path = "SDWebImage/Core/NSButton+WebCache.m"; sourceTree = ""; }; + 4A2218DFC8DB93D6AFA42BAB078E1A93 /* SDInternalMacros.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDInternalMacros.m; path = SDWebImage/Private/SDInternalMacros.m; sourceTree = ""; }; + 4A5B420028975C4C042F1005C8D37523 /* SDImageCacheDefine.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDImageCacheDefine.h; path = SDWebImage/Core/SDImageCacheDefine.h; sourceTree = ""; }; + 4A66CC6503E4C4913CF97E79FA1328E4 /* TMDBSwift.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = TMDBSwift.modulemap; sourceTree = ""; }; + 4C30EFC078030A3A5108C43BA8EF980E /* DiscoverMovie.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = DiscoverMovie.swift; path = Sources/Models/Discover/DiscoverMovie.swift; sourceTree = ""; }; + 4C44E28EA371C025196A4CB7918011D6 /* SDWebImageDownloaderRequestModifier.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDWebImageDownloaderRequestModifier.m; path = SDWebImage/Core/SDWebImageDownloaderRequestModifier.m; sourceTree = ""; }; + 4D154CF4A9B7C691AE982AE1C28C6FD0 /* SDWebImageCompat.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDWebImageCompat.m; path = SDWebImage/Core/SDWebImageCompat.m; sourceTree = ""; }; + 4DA0917ED0A9A85580B2A7593A0CFC50 /* TVCreditsMDB.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = TVCreditsMDB.swift; path = Sources/Models/TVCreditsMDB.swift; sourceTree = ""; }; + 4E886ED5E1F036FA3E36594153F3B9B1 /* SDImageCache.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDImageCache.h; path = SDWebImage/Core/SDImageCache.h; sourceTree = ""; }; + 4FDC9EF0CC19B1676311AE8F9662D9E0 /* UIImageView+HighlightedWebCache.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "UIImageView+HighlightedWebCache.h"; path = "SDWebImage/Core/UIImageView+HighlightedWebCache.h"; sourceTree = ""; }; + 5427FAC312064D259128FA8746B9F98A /* NSBezierPath+SDRoundedCorners.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "NSBezierPath+SDRoundedCorners.h"; path = "SDWebImage/Private/NSBezierPath+SDRoundedCorners.h"; sourceTree = ""; }; + 555F9F90B47B4FEF51AA920DA56D04CE /* TMDBSwift-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "TMDBSwift-prefix.pch"; sourceTree = ""; }; + 56174EC846D710EBB2914E297D9C2535 /* UIImage+ExtendedCacheData.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "UIImage+ExtendedCacheData.m"; path = "SDWebImage/Core/UIImage+ExtendedCacheData.m"; sourceTree = ""; }; + 571313DE882C3C09AE9A80FA3ED42910 /* SDWebImageSwiftUI.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = SDWebImageSwiftUI.modulemap; sourceTree = ""; }; + 57E0C9B78F91FB83BC84243E988C4ACF /* SDImageCodersManager.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDImageCodersManager.h; path = SDWebImage/Core/SDImageCodersManager.h; sourceTree = ""; }; + 5BB2BD6EEDCEBC593C0EEF20B6433A21 /* SDAnimatedImageRep.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDAnimatedImageRep.m; path = SDWebImage/Core/SDAnimatedImageRep.m; sourceTree = ""; }; + 5C5E565566D2038F562360B38D6C2537 /* SDWebImageError.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDWebImageError.h; path = SDWebImage/Core/SDWebImageError.h; sourceTree = ""; }; + 5E89D21A8EDAE7E376A70B799858C508 /* SDWebImageError.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDWebImageError.m; path = SDWebImage/Core/SDWebImageError.m; sourceTree = ""; }; + 5FB71F86CB99F42D724FF7229BF2FBDF /* MovieDetailedMDB.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = MovieDetailedMDB.swift; path = Sources/Models/MovieDetailedMDB.swift; sourceTree = ""; }; + 601D39CB549B16F01A4BBFF261788543 /* SDWebImageSwiftUI.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SDWebImageSwiftUI.swift; path = SDWebImageSwiftUI/Classes/SDWebImageSwiftUI.swift; sourceTree = ""; }; + 611C8DB907A2BFACAB392E65A661C99A /* FindMDB.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = FindMDB.swift; path = Sources/Models/FindMDB.swift; sourceTree = ""; }; + 6207E5710B48B087F886CE7BF01BA523 /* SDWebImageCacheSerializer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDWebImageCacheSerializer.h; path = SDWebImage/Core/SDWebImageCacheSerializer.h; sourceTree = ""; }; + 635E2BD5493FA04103F7CFD1155ED49F /* SDImageFrame.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDImageFrame.h; path = SDWebImage/Core/SDImageFrame.h; sourceTree = ""; }; + 639968E386E9D7C8E6939D4CFE4D26B7 /* SDmetamacros.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDmetamacros.h; path = SDWebImage/Private/SDmetamacros.h; sourceTree = ""; }; + 6424956A73BDBDE8FCF6F6AFA359110C /* ActivityIndicator.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ActivityIndicator.swift; path = SDWebImageSwiftUI/Classes/Indicator/ActivityIndicator.swift; sourceTree = ""; }; + 6451957A96686449C54B797ACCF13893 /* NetworksMDB.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = NetworksMDB.swift; path = Sources/Models/NetworksMDB.swift; sourceTree = ""; }; + 64BCB947DBA2EA89C79040E1E8DEEDE1 /* SDWebImage-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "SDWebImage-Info.plist"; sourceTree = ""; }; + 65D7D9C5945F4F19AE2A112F10B14A4C /* SDWebImageCacheKeyFilter.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDWebImageCacheKeyFilter.m; path = SDWebImage/Core/SDWebImageCacheKeyFilter.m; sourceTree = ""; }; + 662675A557F215547AB10FA888848173 /* SDAssociatedObject.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDAssociatedObject.m; path = SDWebImage/Private/SDAssociatedObject.m; sourceTree = ""; }; + 669824AE01A9870A88D27578DB870945 /* TMDBSwift-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "TMDBSwift-dummy.m"; sourceTree = ""; }; + 66A649837FCF2AA5DD45FF608FC88C06 /* NSBezierPath+SDRoundedCorners.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "NSBezierPath+SDRoundedCorners.m"; path = "SDWebImage/Private/NSBezierPath+SDRoundedCorners.m"; sourceTree = ""; }; + 67DA7577A1952A22D720FCFCDD883961 /* CreditsMDB.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CreditsMDB.swift; path = Sources/Models/CreditsMDB.swift; sourceTree = ""; }; + 6AEEAB7F41F8C50F26492D9A848E9044 /* Transition.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Transition.swift; path = SDWebImageSwiftUI/Classes/Transition/Transition.swift; sourceTree = ""; }; + 6B1B10F952F684F6767E6903C2F5E816 /* SDWebImageSwiftUI */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = SDWebImageSwiftUI; path = SDWebImageSwiftUI.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 6B5E0882BB068A6828040133E42DE595 /* NSImage+Compatibility.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "NSImage+Compatibility.m"; path = "SDWebImage/Core/NSImage+Compatibility.m"; sourceTree = ""; }; + 6CDC6391E3063232D20F2FFE1617B4AA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; }; + 6DD129AB5D570E00831B6AD86A7C491C /* UIColor+SDHexString.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "UIColor+SDHexString.h"; path = "SDWebImage/Private/UIColor+SDHexString.h"; sourceTree = ""; }; + 6E3D57C2651DEF2F4F6351FF6FC0F34F /* NSImage+Compatibility.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "NSImage+Compatibility.h"; path = "SDWebImage/Core/NSImage+Compatibility.h"; sourceTree = ""; }; + 6E442689AD59C6F6AC239F3B12C2066F /* TMDBSwift.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = TMDBSwift.release.xcconfig; sourceTree = ""; }; + 70EE4AD69A54346B65B68A9CCA3D41C8 /* SDWebImage-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "SDWebImage-prefix.pch"; sourceTree = ""; }; + 734741E8899B00DDC31612B7D12F62CC /* NSButton+WebCache.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "NSButton+WebCache.h"; path = "SDWebImage/Core/NSButton+WebCache.h"; sourceTree = ""; }; + 741D12CAB4CB3ECD9FB6F2A6B9944F11 /* SDAnimatedImageRep.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDAnimatedImageRep.h; path = SDWebImage/Core/SDAnimatedImageRep.h; sourceTree = ""; }; + 754A9B7470891647AA65434C0517A4CC /* Client_Find.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Client_Find.swift; path = Sources/Client/Client_Find.swift; sourceTree = ""; }; + 756A7DF719CB54D142A8E938917ADCFE /* CompaniesMDB.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CompaniesMDB.swift; path = Sources/Models/CompaniesMDB.swift; sourceTree = ""; }; + 7591EF0E33B82CFC494FA8DDEF42B33C /* SDWebImageSwiftUI.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = SDWebImageSwiftUI.release.xcconfig; sourceTree = ""; }; + 763B2A212DCA56DC520205A7A45684E2 /* UIButton+WebCache.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "UIButton+WebCache.h"; path = "SDWebImage/Core/UIButton+WebCache.h"; sourceTree = ""; }; + 772BC85255A03C58EC49B33E114EA9FE /* SDDeviceHelper.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDDeviceHelper.h; path = SDWebImage/Private/SDDeviceHelper.h; sourceTree = ""; }; + 778276C86B4E8C0022EE8494F53ACBA2 /* UIImage+Metadata.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "UIImage+Metadata.h"; path = "SDWebImage/Core/UIImage+Metadata.h"; sourceTree = ""; }; + 77FB29967A3C58B49D7F038E78D9F21C /* Client_Genres.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Client_Genres.swift; path = Sources/Client/Client_Genres.swift; sourceTree = ""; }; + 7836EBB911801AEF9D8F2B396839ECDF /* SDWebImageManager.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDWebImageManager.m; path = SDWebImage/Core/SDWebImageManager.m; sourceTree = ""; }; + 7973658E79C7838FFCF0D5BAFB381FEF /* UIView+WebCacheOperation.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "UIView+WebCacheOperation.h"; path = "SDWebImage/Core/UIView+WebCacheOperation.h"; sourceTree = ""; }; + 7B0CA5939CD80430E10A1411EFE2187D /* SDImageCachesManager.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDImageCachesManager.m; path = SDWebImage/Core/SDImageCachesManager.m; sourceTree = ""; }; + 7C7EF080C7C1F27BD59DCEAF6393B67D /* SDImageIOAnimatedCoder.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDImageIOAnimatedCoder.h; path = SDWebImage/Core/SDImageIOAnimatedCoder.h; sourceTree = ""; }; + 7E815BE2C9A76C30189EAD90CDAAC71B /* SDImageCacheDefine.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDImageCacheDefine.m; path = SDWebImage/Core/SDImageCacheDefine.m; sourceTree = ""; }; + 7F7974BC8380083A84D9174ED340CFCB /* SDImageCoderHelper.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDImageCoderHelper.m; path = SDWebImage/Core/SDImageCoderHelper.m; sourceTree = ""; }; + 828447C148B8246DC83EDB1A607DFB65 /* SDWebImage.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDWebImage.h; path = WebImage/SDWebImage.h; sourceTree = ""; }; + 8348EABD3A7C31513FC4D420662EA048 /* UIImage+Transform.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "UIImage+Transform.h"; path = "SDWebImage/Core/UIImage+Transform.h"; sourceTree = ""; }; + 845713C1F7FD56AD06D720F6C3E080DD /* ProgressIndicator.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ProgressIndicator.swift; path = SDWebImageSwiftUI/Classes/Indicator/ProgressIndicator.swift; sourceTree = ""; }; + 848B4065D38A7403C3720DF5BD73DCA6 /* UIButton+WebCache.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "UIButton+WebCache.m"; path = "SDWebImage/Core/UIButton+WebCache.m"; sourceTree = ""; }; + 854A8DFFA133EC626FB283087453A394 /* ArrayObjectProtocol.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ArrayObjectProtocol.swift; path = Sources/Protocols/ArrayObjectProtocol.swift; sourceTree = ""; }; + 8640A514D00B06AAC252FEC4B4035228 /* TMDBSwift */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = TMDBSwift; path = TMDBSwift.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 88B810388926375B176E15A60D7CF518 /* Pods-NetflixCloneApp.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = "Pods-NetflixCloneApp.modulemap"; sourceTree = ""; }; - 95FBA89CDB1D8F6A66D55567956545D8 /* Client_Movies.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Client_Movies.swift; path = Sources/Client/Client_Movies.swift; sourceTree = ""; }; - 982AC43ABDF0524ADB266A0BB1BDBBDA /* MovieReviewMDB.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = MovieReviewMDB.swift; path = Sources/Models/MovieReviewMDB.swift; sourceTree = ""; }; - 9D940727FF8FB9C785EB98E56350EF41 /* Podfile */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; indentWidth = 2; name = Podfile; path = ../Podfile; sourceTree = SOURCE_ROOT; tabWidth = 2; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; + 88FE49A37E0AD4BCC4A654CDF4731715 /* ExternalIdsMDB.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ExternalIdsMDB.swift; path = Sources/Models/ExternalIdsMDB.swift; sourceTree = ""; }; + 8A814A3F661CA2F120AF5A723DF384BA /* SDWebImageIndicator.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDWebImageIndicator.m; path = SDWebImage/Core/SDWebImageIndicator.m; sourceTree = ""; }; + 8AD79F0044DD72FB1E1D60BEF0E90BB8 /* MovieListMDB.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = MovieListMDB.swift; path = Sources/Models/MovieListMDB.swift; sourceTree = ""; }; + 8C0D6A09762B3435DBF3E0BDF2429127 /* SDImageCache.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDImageCache.m; path = SDWebImage/Core/SDImageCache.m; sourceTree = ""; }; + 8C4E39AB3C494384025D8DF717F420DC /* UIImageView+WebCache.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "UIImageView+WebCache.h"; path = "SDWebImage/Core/UIImageView+WebCache.h"; sourceTree = ""; }; + 8D6DCC2FB430E15F8E009435EBFE3884 /* SDWebImageDownloaderConfig.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDWebImageDownloaderConfig.m; path = SDWebImage/Core/SDWebImageDownloaderConfig.m; sourceTree = ""; }; + 8D70E4F158D328F3EC71445EC48212CB /* SDAsyncBlockOperation.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDAsyncBlockOperation.m; path = SDWebImage/Private/SDAsyncBlockOperation.m; sourceTree = ""; }; + 8D93D78E2E53AA6F5376ABB600650F3C /* UIView+WebCacheOperation.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "UIView+WebCacheOperation.m"; path = "SDWebImage/Core/UIView+WebCacheOperation.m"; sourceTree = ""; }; + 8E5FA8E52E94FD3521B812B9C59068FF /* SearchMDB.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SearchMDB.swift; path = Sources/Models/SearchMDB.swift; sourceTree = ""; }; + 8EC427952B5EEBA3CBFFC885105C9E68 /* Client_Lists.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Client_Lists.swift; path = Sources/Client/Client_Lists.swift; sourceTree = ""; }; + 8F8DC9897BDE7B2C8B9AE8CCF9D1D111 /* TMDBSwift.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = TMDBSwift.debug.xcconfig; sourceTree = ""; }; + 9071DBFBA5CE1FE7115352312C94A4F1 /* Client_Collections.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Client_Collections.swift; path = Sources/Client/Client_Collections.swift; sourceTree = ""; }; + 921083316646B3DB736DA577C2C78FC0 /* Clent_Discover.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Clent_Discover.swift; path = Sources/Client/Clent_Discover.swift; sourceTree = ""; }; + 970AB672654E8E222C76318D6D0BB710 /* WebImage.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = WebImage.swift; path = SDWebImageSwiftUI/Classes/WebImage.swift; sourceTree = ""; }; + 988D6A68DD4918A73028756ADC37A58D /* SDImageCachesManagerOperation.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDImageCachesManagerOperation.h; path = SDWebImage/Private/SDImageCachesManagerOperation.h; sourceTree = ""; }; + 9A36F4575DE2CE33ABD338EA4A391EC8 /* SDImageTransformer.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDImageTransformer.m; path = SDWebImage/Core/SDImageTransformer.m; sourceTree = ""; }; + 9B00E0FFAC1FB1CE337B21E0BA362E59 /* SDImageTransformer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDImageTransformer.h; path = SDWebImage/Core/SDImageTransformer.h; sourceTree = ""; }; + 9B6B5C63984E342D9BA380750DA36835 /* UIImage+ForceDecode.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "UIImage+ForceDecode.h"; path = "SDWebImage/Core/UIImage+ForceDecode.h"; sourceTree = ""; }; + 9B91CCC5CB8970101664985116DB4516 /* SDAssociatedObject.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDAssociatedObject.h; path = SDWebImage/Private/SDAssociatedObject.h; sourceTree = ""; }; + 9BE02F02316F2418064F8AD677407006 /* SDWebImage.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = SDWebImage.modulemap; sourceTree = ""; }; + 9C24738267D466F84218734D0C534311 /* SDWebImageOptionsProcessor.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDWebImageOptionsProcessor.h; path = SDWebImage/Core/SDWebImageOptionsProcessor.h; sourceTree = ""; }; + 9D940727FF8FB9C785EB98E56350EF41 /* Podfile */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; indentWidth = 2; lastKnownFileType = text; name = Podfile; path = ../Podfile; sourceTree = SOURCE_ROOT; tabWidth = 2; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; + 9DE9D63E915DEDF6021F7F0286C96D26 /* SDWebImageIndicator.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDWebImageIndicator.h; path = SDWebImage/Core/SDWebImageIndicator.h; sourceTree = ""; }; + 9DEBF645D35D52037D54B5612F8D34C0 /* Client_Review.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Client_Review.swift; path = Sources/Client/Client_Review.swift; sourceTree = ""; }; A11B387255E344B5FAD743037E83D528 /* Pods-NetflixCloneApp.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-NetflixCloneApp.release.xcconfig"; sourceTree = ""; }; - A22C2EEC6627DDC7452D34A6C6468B56 /* DiscoverMovie.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = DiscoverMovie.swift; path = Sources/Models/Discover/DiscoverMovie.swift; sourceTree = ""; }; - AA39E2B9C879FF71ED8CF74A05D83D67 /* Config.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Config.swift; path = Sources/Client/Config.swift; sourceTree = ""; }; - AEC717EE7ACF81CF26D9756369FD121C /* Client_Search.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Client_Search.swift; path = Sources/Client/Client_Search.swift; sourceTree = ""; }; - AF204FF6E57E4067611A7AC399749D83 /* Client_People.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Client_People.swift; path = Sources/Client/Client_People.swift; sourceTree = ""; }; - AF5797CB43DC4603CA24241E67EB1740 /* Client_Review.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Client_Review.swift; path = Sources/Client/Client_Review.swift; sourceTree = ""; }; - B235FD82E50FB3626E4F99AB870AF94E /* MovieReleaseDatesMDB.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = MovieReleaseDatesMDB.swift; path = Sources/Models/MovieReleaseDatesMDB.swift; sourceTree = ""; }; - B62A45BFABFC541EE240B263015E30D5 /* SwiftyJSON.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SwiftyJSON.swift; path = "Sources/Open Source/SwiftyJSON.swift"; sourceTree = ""; }; - B743D7AEC2CD2D01CFE91A00447CFD6F /* Client_Certifications.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Client_Certifications.swift; path = Sources/Client/Client_Certifications.swift; sourceTree = ""; }; + A277B41F7D5557D863FF285FE3258DD0 /* MovieReviewMDB.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = MovieReviewMDB.swift; path = Sources/Models/MovieReviewMDB.swift; sourceTree = ""; }; + A2A4AA03E06BC6590C8F8A52BBDF1849 /* MovieMDB.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = MovieMDB.swift; path = Sources/Models/MovieMDB.swift; sourceTree = ""; }; + A2B4BB661460E989B1B114EB820183E0 /* ImagePlayer.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ImagePlayer.swift; path = SDWebImageSwiftUI/Classes/ImagePlayer.swift; sourceTree = ""; }; + A355A0646F71C56E8997FDFADF57C464 /* SDImageCachesManagerOperation.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDImageCachesManagerOperation.m; path = SDWebImage/Private/SDImageCachesManagerOperation.m; sourceTree = ""; }; + A3A968D533B5F4B87D688B9C201D03CD /* Indicator.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Indicator.swift; path = SDWebImageSwiftUI/Classes/Indicator/Indicator.swift; sourceTree = ""; }; + A4287258390B8909691A03E41CB093D5 /* SDWeakProxy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDWeakProxy.m; path = SDWebImage/Private/SDWeakProxy.m; sourceTree = ""; }; + A47DF9A97759073EAB4067494728ED85 /* Client_People.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Client_People.swift; path = Sources/Client/Client_People.swift; sourceTree = ""; }; + A58B311EA1CB700A493C508922C9127F /* SDWebImageManager.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDWebImageManager.h; path = SDWebImage/Core/SDWebImageManager.h; sourceTree = ""; }; + A8427414AB61A3B4BA0A76D6C1FF40E6 /* SDWebImage.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = SDWebImage.debug.xcconfig; sourceTree = ""; }; + A9D87F6CAD1A47D10F71ACBF43DEE596 /* UIImage+MultiFormat.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "UIImage+MultiFormat.h"; path = "SDWebImage/Core/UIImage+MultiFormat.h"; sourceTree = ""; }; + AB001BA0C1F15DA56E443AF2130F7F22 /* Client_Companies.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Client_Companies.swift; path = Sources/Client/Client_Companies.swift; sourceTree = ""; }; + AB29DA0771C5328C2C588B0440D7AACE /* SDImageLoadersManager.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDImageLoadersManager.m; path = SDWebImage/Core/SDImageLoadersManager.m; sourceTree = ""; }; + AC4B0C65322E56F8CF5BA827677F993E /* UIImage+MemoryCacheCost.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "UIImage+MemoryCacheCost.h"; path = "SDWebImage/Core/UIImage+MemoryCacheCost.h"; sourceTree = ""; }; + AC690A8DB4DCB030E759463F398B0B84 /* SDAnimatedImageView.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDAnimatedImageView.m; path = SDWebImage/Core/SDAnimatedImageView.m; sourceTree = ""; }; + AC74A63BE456EFF43EED5E529E373183 /* UIImageView+WebCache.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "UIImageView+WebCache.m"; path = "SDWebImage/Core/UIImageView+WebCache.m"; sourceTree = ""; }; + ADE5AD6AC1755CDA02875A69FE7C135A /* GenresMDB.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = GenresMDB.swift; path = Sources/Models/GenresMDB.swift; sourceTree = ""; }; + ADF733BE6CC529AD23B5792C41EF996D /* SDFileAttributeHelper.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDFileAttributeHelper.h; path = SDWebImage/Private/SDFileAttributeHelper.h; sourceTree = ""; }; + AE25E11448D3CC5CBF82BA033FA0F27B /* SDImageGraphics.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDImageGraphics.h; path = SDWebImage/Core/SDImageGraphics.h; sourceTree = ""; }; + AE87800AE145C78144BB7248F25A9572 /* SDDisplayLink.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDDisplayLink.m; path = SDWebImage/Private/SDDisplayLink.m; sourceTree = ""; }; + B0B214D775196BA7CA8E17E53048A493 /* SDWebImage */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = SDWebImage; path = SDWebImage.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + B0DA1B787C3CC1D16FF2C9E60FE2E480 /* SDImageIOCoder.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDImageIOCoder.h; path = SDWebImage/Core/SDImageIOCoder.h; sourceTree = ""; }; + B15FFD49E6CA308B9B3CE3EC57FEF40B /* SDDiskCache.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDDiskCache.m; path = SDWebImage/Core/SDDiskCache.m; sourceTree = ""; }; + B17123CFD1ADD25B8187654D73E06312 /* SDWebImageDefine.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDWebImageDefine.h; path = SDWebImage/Core/SDWebImageDefine.h; sourceTree = ""; }; + B49F6E5964DD917FEAF44D0133973466 /* SDWebImageCompat.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDWebImageCompat.h; path = SDWebImage/Core/SDWebImageCompat.h; sourceTree = ""; }; + B5B29A35E66CB613C265C60C37C87594 /* SDWebImagePrefetcher.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDWebImagePrefetcher.h; path = SDWebImage/Core/SDWebImagePrefetcher.h; sourceTree = ""; }; + B62A8986F54C0DB226A68EA23C403509 /* SDDeviceHelper.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDDeviceHelper.m; path = SDWebImage/Private/SDDeviceHelper.m; sourceTree = ""; }; + B66E97E407E57B162E6F4D9CD92EF6A9 /* Client_Keywords.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Client_Keywords.swift; path = Sources/Client/Client_Keywords.swift; sourceTree = ""; }; + B6F03BDD5B4C10813F899EBBB51E32FD /* SDImageGraphics.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDImageGraphics.m; path = SDWebImage/Core/SDImageGraphics.m; sourceTree = ""; }; + B70FB80E1FECC8F023F681A5474A9A8A /* UIImage+MultiFormat.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "UIImage+MultiFormat.m"; path = "SDWebImage/Core/UIImage+MultiFormat.m"; sourceTree = ""; }; + B877E55F483FBE792D7ACD37195CBD2F /* Client_Changes.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Client_Changes.swift; path = Sources/Client/Client_Changes.swift; sourceTree = ""; }; + B9AC5389FAE0CB614D95F719B8B0F6C9 /* MovieReleaseDatesMDB.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = MovieReleaseDatesMDB.swift; path = Sources/Models/MovieReleaseDatesMDB.swift; sourceTree = ""; }; + BA961F106D921434651D6D780D8D8A23 /* SDImageIOCoder.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDImageIOCoder.m; path = SDWebImage/Core/SDImageIOCoder.m; sourceTree = ""; }; + BABB9971DF648AB9F2CFEDB5D608B241 /* SDImageCachesManager.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDImageCachesManager.h; path = SDWebImage/Core/SDImageCachesManager.h; sourceTree = ""; }; + BB084BDB4A8A18EA6D311AA77E7406FB /* TVSeasonsMDB.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = TVSeasonsMDB.swift; path = Sources/Models/TVSeasonsMDB.swift; sourceTree = ""; }; + BB7D6713E34D24DFB2AC7EDCB28F2C74 /* SDWebImageTransition.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDWebImageTransition.h; path = SDWebImage/Core/SDWebImageTransition.h; sourceTree = ""; }; + BB9338AB851938F757B655AC20A0D9F9 /* PageResultsMDB.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = PageResultsMDB.swift; path = Sources/Models/PageResultsMDB.swift; sourceTree = ""; }; + BC6C1D386BA08CA936A93E3C4CCB9842 /* SDWebImageDownloaderResponseModifier.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDWebImageDownloaderResponseModifier.m; path = SDWebImage/Core/SDWebImageDownloaderResponseModifier.m; sourceTree = ""; }; + BC77972C0EA8399E6DFBB1DC6110EC10 /* NSData+ImageContentType.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "NSData+ImageContentType.m"; path = "SDWebImage/Core/NSData+ImageContentType.m"; sourceTree = ""; }; + BCFF56BB044955624286A31284022D3A /* SDWebImageDownloaderDecryptor.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDWebImageDownloaderDecryptor.m; path = SDWebImage/Core/SDWebImageDownloaderDecryptor.m; sourceTree = ""; }; + BDA64BEA2EBE20CAB7FEBF5689D0EE2B /* SDImageCacheConfig.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDImageCacheConfig.m; path = SDWebImage/Core/SDImageCacheConfig.m; sourceTree = ""; }; + BDAE8BFA7CCEC385052A98BD487AC5B5 /* SDWebImageSwiftUI-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "SDWebImageSwiftUI-umbrella.h"; sourceTree = ""; }; + BE301BC46F0E71127A8C7B0D1B1C0385 /* SDImageAWebPCoder.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDImageAWebPCoder.m; path = SDWebImage/Core/SDImageAWebPCoder.m; sourceTree = ""; }; + C059FF1AD5D3123A7DA435A6F5EEFF5B /* Client_Certifications.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Client_Certifications.swift; path = Sources/Client/Client_Certifications.swift; sourceTree = ""; }; + C1BDE9B7E27457D8DE056D2AB81BE86F /* Client_TV.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Client_TV.swift; path = Sources/Client/Client_TV.swift; sourceTree = ""; }; + C3B89F0025630D46B405C9E376EFA4C1 /* CollectionsMDB.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CollectionsMDB.swift; path = Sources/Models/CollectionsMDB.swift; sourceTree = ""; }; C47A19124F949B56F1E1D12C1EAF1FB1 /* Pods-NetflixCloneApp */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = "Pods-NetflixCloneApp"; path = Pods_NetflixCloneApp.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - C65D5776C672F3E264D7F84D7CB465CD /* FindMDB.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = FindMDB.swift; path = Sources/Models/FindMDB.swift; sourceTree = ""; }; - C6796A8969E2C23177954665C88E1865 /* Client_Configuration.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Client_Configuration.swift; path = Sources/Client/Client_Configuration.swift; sourceTree = ""; }; - D1933EBB5AA4755FE6C511B9DFA42ECB /* CastCrewMDB.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CastCrewMDB.swift; path = Sources/Models/CastCrewMDB.swift; sourceTree = ""; }; - D2F7A58FA06E197A58AF664C8B5A998F /* TMDBSwift.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = TMDBSwift.debug.xcconfig; sourceTree = ""; }; - D3EDC56017E5F999BA8913F935FBC87E /* MovieCreditsMDB.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = MovieCreditsMDB.swift; path = Sources/Models/MovieCreditsMDB.swift; sourceTree = ""; }; + C88D63608DE51C6BF99BF6E1921E7257 /* AnimatedImage.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AnimatedImage.swift; path = SDWebImageSwiftUI/Classes/AnimatedImage.swift; sourceTree = ""; }; + CAE6157DF40832B819ED1DC14DC4A3F5 /* ImageViewWrapper.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ImageViewWrapper.swift; path = SDWebImageSwiftUI/Classes/ImageViewWrapper.swift; sourceTree = ""; }; + CBACB54D48BDF9644EF5F98A840EB5BD /* ConfigurationMDB.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConfigurationMDB.swift; path = Sources/Models/ConfigurationMDB.swift; sourceTree = ""; }; + CC09DA71D718A0810E41CC1A49217F51 /* SDAnimatedImage.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDAnimatedImage.h; path = SDWebImage/Core/SDAnimatedImage.h; sourceTree = ""; }; + CCE56E86000EBF1F740329AE873EC144 /* SDGraphicsImageRenderer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDGraphicsImageRenderer.h; path = SDWebImage/Core/SDGraphicsImageRenderer.h; sourceTree = ""; }; + CF1E137CEB2F512808DC6749A8072D3A /* Client_TVSeasonsEpisodes.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Client_TVSeasonsEpisodes.swift; path = Sources/Client/Client_TVSeasonsEpisodes.swift; sourceTree = ""; }; + D08446011D516129E91DA04FF7A65374 /* SDWebImageOperation.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDWebImageOperation.m; path = SDWebImage/Core/SDWebImageOperation.m; sourceTree = ""; }; + D2AEF6D763FECC70AE750E47375EABFC /* Client.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Client.swift; path = Sources/Client/Client.swift; sourceTree = ""; }; + D353119D1CF0C2785D00B22D4252D90D /* SDImageCoder.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDImageCoder.h; path = SDWebImage/Core/SDImageCoder.h; sourceTree = ""; }; D4093E29AEA374A8A02FF73BFEC8F553 /* Pods-NetflixCloneApp-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-NetflixCloneApp-acknowledgements.markdown"; sourceTree = ""; }; - D72CE8D91EC4F8BC4DE480BF91CC132B /* TMDBSwift.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = TMDBSwift.release.xcconfig; sourceTree = ""; }; - D881E782E4415EA61E983C2F3BD70A2C /* TMDBSwift-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "TMDBSwift-umbrella.h"; sourceTree = ""; }; - DA0F999B41862A66A2C3777B078450FF /* Client_TV.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Client_TV.swift; path = Sources/Client/Client_TV.swift; sourceTree = ""; }; - DAC2F35F83C31E66864E07819835FD5B /* Client_Find.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Client_Find.swift; path = Sources/Client/Client_Find.swift; sourceTree = ""; }; - DD64203CBB3084AEA547CB8263FA0ACE /* PageResultsMDB.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = PageResultsMDB.swift; path = Sources/Models/PageResultsMDB.swift; sourceTree = ""; }; - DD64C3015B4E385F2601AB3A839BAD8E /* ListsMDB.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ListsMDB.swift; path = Sources/Models/ListsMDB.swift; sourceTree = ""; }; + D7298C00FF5A1A57D49B2BA627F35169 /* SDWebImageDownloaderResponseModifier.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDWebImageDownloaderResponseModifier.h; path = SDWebImage/Core/SDWebImageDownloaderResponseModifier.h; sourceTree = ""; }; + D9ABC37EB67F5E525E9C8111A96FFFC1 /* SDImageFrame.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDImageFrame.m; path = SDWebImage/Core/SDImageFrame.m; sourceTree = ""; }; + DA58A429F846D8B2D9299C01C591E3E4 /* Client_Credits.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Client_Credits.swift; path = Sources/Client/Client_Credits.swift; sourceTree = ""; }; + DAB07FF6690A0CDB206ED4A8F0CD09E5 /* TVDetailedMDB.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = TVDetailedMDB.swift; path = Sources/Models/TVDetailedMDB.swift; sourceTree = ""; }; + DB9AB64D518713EB8A14B1A45ADB274F /* ImagesMDB.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ImagesMDB.swift; path = Sources/Models/ImagesMDB.swift; sourceTree = ""; }; + DBB439A692046C3BFF7B973CC3F18D42 /* TVMDBModel.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = TVMDBModel.swift; path = Sources/Models/TVMDBModel.swift; sourceTree = ""; }; + DFA24801818E79A5848179DCD0A2890B /* TMDBSwift-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "TMDBSwift-Info.plist"; sourceTree = ""; }; + E2228A267E986ED83872C3D7ECDCFE3B /* ImageManager.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ImageManager.swift; path = SDWebImageSwiftUI/Classes/ImageManager.swift; sourceTree = ""; }; + E3044FDFAB9F97782E12ACDF5E3C7195 /* SDWebImageSwiftUI-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "SDWebImageSwiftUI-prefix.pch"; sourceTree = ""; }; + E386BA2DAAB24CAAA6C16CCEA1D7ED2F /* SDImageLoadersManager.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDImageLoadersManager.h; path = SDWebImage/Core/SDImageLoadersManager.h; sourceTree = ""; }; + E4296A3D0D572A64B183F144CCB5B2BF /* CertificationMDB.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CertificationMDB.swift; path = Sources/Models/CertificationMDB.swift; sourceTree = ""; }; + E48532E92ADAA5E8BAF71B82366E9426 /* Alternative_TitlesMDB.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Alternative_TitlesMDB.swift; path = Sources/Models/Alternative_TitlesMDB.swift; sourceTree = ""; }; + E4E1D4AB19D481860F24F62CEEC7839D /* UIImage+Metadata.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "UIImage+Metadata.m"; path = "SDWebImage/Core/UIImage+Metadata.m"; sourceTree = ""; }; + E79C2709B1C112002B06C4B6CBBBA0A4 /* CastCrewMDB.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CastCrewMDB.swift; path = Sources/Models/CastCrewMDB.swift; sourceTree = ""; }; E951BE00460D7AF202DA2F215897A8A5 /* Pods-NetflixCloneApp-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-NetflixCloneApp-Info.plist"; sourceTree = ""; }; - EB601CF8E99775925D7C1515E3D9C0EF /* TranslationsMDB.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = TranslationsMDB.swift; path = Sources/Models/TranslationsMDB.swift; sourceTree = ""; }; + E9F02601F1289C9CEAA0B98ABC87F3A3 /* TVEpisodesMDB.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = TVEpisodesMDB.swift; path = Sources/Models/TVEpisodesMDB.swift; sourceTree = ""; }; + EA251249D23B262850F4D1FCF1F332E4 /* SDImageAssetManager.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDImageAssetManager.h; path = SDWebImage/Private/SDImageAssetManager.h; sourceTree = ""; }; + EA9EC5C6A81CE257982C8C214FF89AF0 /* ListsMDB.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ListsMDB.swift; path = Sources/Models/ListsMDB.swift; sourceTree = ""; }; + EAFC3D1C8D426405D666A2D144593F61 /* Client_Networks.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Client_Networks.swift; path = Sources/Client/Client_Networks.swift; sourceTree = ""; }; + EC789C911D0C1620C1446109B57952D3 /* SDImageAWebPCoder.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDImageAWebPCoder.h; path = SDWebImage/Core/SDImageAWebPCoder.h; sourceTree = ""; }; + ECF54ACDF48DDD24BA5FAC139CA1D88E /* SDWebImageDownloader.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDWebImageDownloader.m; path = SDWebImage/Core/SDWebImageDownloader.m; sourceTree = ""; }; EE0F773964510DA86D66FB3921E0BC7A /* Pods-NetflixCloneApp.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-NetflixCloneApp.debug.xcconfig"; sourceTree = ""; }; - EEF5E73AC94F63292256A629B409736A /* MovieListMDB.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = MovieListMDB.swift; path = Sources/Models/MovieListMDB.swift; sourceTree = ""; }; EF0809D2458F0C237FE81487FAAC2FAF /* Pods-NetflixCloneApp-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-NetflixCloneApp-dummy.m"; sourceTree = ""; }; - F04C44B525BE21FA8D83E95F451E6410 /* ReviewsMDB.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ReviewsMDB.swift; path = Sources/Models/ReviewsMDB.swift; sourceTree = ""; }; - F195D8986B72A18787FD933F68F9748D /* CertificationMDB.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CertificationMDB.swift; path = Sources/Models/CertificationMDB.swift; sourceTree = ""; }; + EF7DE75F48872C3DF4BF488ABA98E1A4 /* TVMDB.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = TVMDB.swift; path = Sources/Models/TVMDB.swift; sourceTree = ""; }; + EFD62D5E05FF1392ABF87360FC18C6D1 /* UIImage+ExtendedCacheData.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "UIImage+ExtendedCacheData.h"; path = "SDWebImage/Core/UIImage+ExtendedCacheData.h"; sourceTree = ""; }; + F0234DBFE4F7D479F77E83CD66A1712F /* SDImageAPNGCoder.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDImageAPNGCoder.m; path = SDWebImage/Core/SDImageAPNGCoder.m; sourceTree = ""; }; + F0265CCACAB5F0FBCD854C406AC0451F /* Image.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Image.swift; path = SDWebImageSwiftUI/Classes/Image.swift; sourceTree = ""; }; + F0592577DFD8156A44F4337B7C6DD1F5 /* SDWebImageCacheKeyFilter.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDWebImageCacheKeyFilter.h; path = SDWebImage/Core/SDWebImageCacheKeyFilter.h; sourceTree = ""; }; F2A6C85EE55BF0B37F28864264CDF2FC /* Pods-NetflixCloneApp-frameworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-NetflixCloneApp-frameworks.sh"; sourceTree = ""; }; - F5A3BA2A705D72FEE9D17BABEFE04068 /* TMDBSwift.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = TMDBSwift.modulemap; sourceTree = ""; }; - F87ABD25143757E58763E4F98C05719B /* DiscoverTV.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = DiscoverTV.swift; path = Sources/Models/Discover/DiscoverTV.swift; sourceTree = ""; }; - F9A5E1EEE0A4C02CF745B87B7654DC5D /* PersonMDB.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = PersonMDB.swift; path = Sources/Models/PersonMDB.swift; sourceTree = ""; }; - FAD2714F1C617A75E57FA41D5010CD91 /* Client_Credits.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Client_Credits.swift; path = Sources/Client/Client_Credits.swift; sourceTree = ""; }; - FEAD7D19E4CB57B5240230C53B888330 /* ChangesMDB.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ChangesMDB.swift; path = Sources/Models/ChangesMDB.swift; sourceTree = ""; }; + F47B089271DDB2F4EB56659080EC5765 /* SDFileAttributeHelper.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDFileAttributeHelper.m; path = SDWebImage/Private/SDFileAttributeHelper.m; sourceTree = ""; }; + F4CE27C47FB88D64756D09E07CF62C74 /* SDImageCoderHelper.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDImageCoderHelper.h; path = SDWebImage/Core/SDImageCoderHelper.h; sourceTree = ""; }; + F52E6309565FE0CF0CFA63A7E4667DCF /* SDWebImageOperation.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDWebImageOperation.h; path = SDWebImage/Core/SDWebImageOperation.h; sourceTree = ""; }; + F540372155C330041B9A6E4F78A76FBD /* UIView+WebCache.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "UIView+WebCache.h"; path = "SDWebImage/Core/UIView+WebCache.h"; sourceTree = ""; }; + F65B5C4F20A9DEBFBE2EC0B4C683AC4E /* UIImage+MemoryCacheCost.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "UIImage+MemoryCacheCost.m"; path = "SDWebImage/Core/UIImage+MemoryCacheCost.m"; sourceTree = ""; }; + F68008A8398F4E7994C5B3DEA08F65E0 /* SDImageAssetManager.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDImageAssetManager.m; path = SDWebImage/Private/SDImageAssetManager.m; sourceTree = ""; }; + F6A0103836154E2452BC19A5428C1BCC /* TranslationsMDB.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = TranslationsMDB.swift; path = Sources/Models/TranslationsMDB.swift; sourceTree = ""; }; + F6A67AE5743DF6EB595B185BAA5234D6 /* SDWebImageDownloaderDecryptor.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDWebImageDownloaderDecryptor.h; path = SDWebImage/Core/SDWebImageDownloaderDecryptor.h; sourceTree = ""; }; + FA26F8D6658216E9328B65C6D7807384 /* SDImageLoader.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDImageLoader.h; path = SDWebImage/Core/SDImageLoader.h; sourceTree = ""; }; + FAB486655B408C78D7B1DF4A8F10A41A /* SDWebImagePrefetcher.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDWebImagePrefetcher.m; path = SDWebImage/Core/SDWebImagePrefetcher.m; sourceTree = ""; }; + FB7ACB2C7DA8AA12633FC1AA68DA69E7 /* Discover.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Discover.swift; path = Sources/Models/Discover/Discover.swift; sourceTree = ""; }; + FB93F270C46AFA532AFB4D59303DBC89 /* SDWebImageDownloaderConfig.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDWebImageDownloaderConfig.h; path = SDWebImage/Core/SDWebImageDownloaderConfig.h; sourceTree = ""; }; + FC3A59CAFAFD7770905CEF0C9D75D10A /* SDWebImageDownloaderRequestModifier.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SDWebImageDownloaderRequestModifier.h; path = SDWebImage/Core/SDWebImageDownloaderRequestModifier.h; sourceTree = ""; }; + FF5965CC203FC6DE973869CCE6BBC270 /* SDImageGIFCoder.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SDImageGIFCoder.m; path = SDWebImage/Core/SDImageGIFCoder.m; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ - DA281E8D2748EBBC99BCAD444F86D691 /* Frameworks */ = { + 03FC04A5CC14E97F74BA5BCAB4520FA1 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + A8A448F067C823A0EB46823FC123CA53 /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 3D32F1F4832469E891E925B166828357 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 64267A59018F0019387C29D3DC24CCA6 /* Foundation.framework in Frameworks */, + B1E01BC7CE28C42C8FA2CBB3656913A4 /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + FB6A1E8A43CF1D3ADFB49BA355F0DEA1 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 5A3E5B854E8188DDF4E958BBC9198600 /* Foundation.framework in Frameworks */, + 51F891EA712D8F14CF1DD77BF20B62A9 /* ImageIO.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -186,27 +558,49 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 00B5E5C299169EBE5C63030C964B2B75 /* Support Files */ = { + 0747BEDDEB2E33D38617A38986352AE3 /* Support Files */ = { isa = PBXGroup; children = ( - F5A3BA2A705D72FEE9D17BABEFE04068 /* TMDBSwift.modulemap */, - 7BE0891E7C6081D9B46D04363DEB995F /* TMDBSwift-dummy.m */, - 59E887F78B37CE4199AE3E3BDDBBE0A0 /* TMDBSwift-Info.plist */, - 2593DB0CA37BB9C01EC85EDEFE3BDF6F /* TMDBSwift-prefix.pch */, - D881E782E4415EA61E983C2F3BD70A2C /* TMDBSwift-umbrella.h */, - D2F7A58FA06E197A58AF664C8B5A998F /* TMDBSwift.debug.xcconfig */, - D72CE8D91EC4F8BC4DE480BF91CC132B /* TMDBSwift.release.xcconfig */, + 9BE02F02316F2418064F8AD677407006 /* SDWebImage.modulemap */, + 3785B6D834EFAB609BA7F040AC7296CE /* SDWebImage-dummy.m */, + 64BCB947DBA2EA89C79040E1E8DEEDE1 /* SDWebImage-Info.plist */, + 70EE4AD69A54346B65B68A9CCA3D41C8 /* SDWebImage-prefix.pch */, + 494E1576C508C08DCE2E696DC24753ED /* SDWebImage-umbrella.h */, + A8427414AB61A3B4BA0A76D6C1FF40E6 /* SDWebImage.debug.xcconfig */, + 34C48738F4C471ABE5CCC1B4A77639C9 /* SDWebImage.release.xcconfig */, ); name = "Support Files"; - path = "../Target Support Files/TMDBSwift"; + path = "../Target Support Files/SDWebImage"; sourceTree = ""; }; - 1887DABF11D437A4D21845E651E305C6 /* Pods */ = { + 1628BF05B4CAFDCC3549A101F5A10A17 /* Frameworks */ = { isa = PBXGroup; children = ( - 989A6531501F0DD27440F75CC2FDE9E4 /* TMDBSwift */, + A2DAB88224A5C6E444F84116BC10553A /* iOS */, ); - name = Pods; + name = Frameworks; + sourceTree = ""; + }; + 389AAD6C61B27288FE205F5CCE3DF4BD /* SDWebImageSwiftUI */ = { + isa = PBXGroup; + children = ( + 6424956A73BDBDE8FCF6F6AFA359110C /* ActivityIndicator.swift */, + C88D63608DE51C6BF99BF6E1921E7257 /* AnimatedImage.swift */, + F0265CCACAB5F0FBCD854C406AC0451F /* Image.swift */, + E2228A267E986ED83872C3D7ECDCFE3B /* ImageManager.swift */, + A2B4BB661460E989B1B114EB820183E0 /* ImagePlayer.swift */, + CAE6157DF40832B819ED1DC14DC4A3F5 /* ImageViewWrapper.swift */, + A3A968D533B5F4B87D688B9C201D03CD /* Indicator.swift */, + 845713C1F7FD56AD06D720F6C3E080DD /* ProgressIndicator.swift */, + 102D4250922B45BBA54B65EB2061D136 /* SDWebImageSwiftUI.h */, + 601D39CB549B16F01A4BBFF261788543 /* SDWebImageSwiftUI.swift */, + 456A6D3E180E391DFF7E5C3783AAB57D /* SwiftUICompatibility.swift */, + 6AEEAB7F41F8C50F26492D9A848E9044 /* Transition.swift */, + 970AB672654E8E222C76318D6D0BB710 /* WebImage.swift */, + 65F9CC7578A16B7C00CCBF97AAACA301 /* Support Files */, + ); + name = SDWebImageSwiftUI; + path = SDWebImageSwiftUI; sourceTree = ""; }; 492E2B4302B2D9A1CFE0BB25C8B389AB /* Targets Support Files */ = { @@ -217,98 +611,291 @@ name = "Targets Support Files"; sourceTree = ""; }; - 578452D2E740E91742655AC8F1636D1F /* iOS */ = { + 5F7B700A2EE041871270A57628BCA798 /* Pods */ = { + isa = PBXGroup; + children = ( + C37453FF6AB1784E104598C7D719F4DB /* SDWebImage */, + 389AAD6C61B27288FE205F5CCE3DF4BD /* SDWebImageSwiftUI */, + B847C603BF7D6353530059F1EDAF2387 /* TMDBSwift */, + ); + name = Pods; + sourceTree = ""; + }; + 65F9CC7578A16B7C00CCBF97AAACA301 /* Support Files */ = { + isa = PBXGroup; + children = ( + 571313DE882C3C09AE9A80FA3ED42910 /* SDWebImageSwiftUI.modulemap */, + 071E024099A72F8BDDCFA119562C2D00 /* SDWebImageSwiftUI-dummy.m */, + 458BD4E0A4C339D5CE61D186D3952E63 /* SDWebImageSwiftUI-Info.plist */, + E3044FDFAB9F97782E12ACDF5E3C7195 /* SDWebImageSwiftUI-prefix.pch */, + BDAE8BFA7CCEC385052A98BD487AC5B5 /* SDWebImageSwiftUI-umbrella.h */, + 09057BE2905EA1A27AF3AE51A4789396 /* SDWebImageSwiftUI.debug.xcconfig */, + 7591EF0E33B82CFC494FA8DDEF42B33C /* SDWebImageSwiftUI.release.xcconfig */, + ); + name = "Support Files"; + path = "../Target Support Files/SDWebImageSwiftUI"; + sourceTree = ""; + }; + 90C4744D7DA537417F5C909E2E308A80 /* Core */ = { isa = PBXGroup; children = ( - 73010CC983E3809BECEE5348DA1BB8C6 /* Foundation.framework */, + 5427FAC312064D259128FA8746B9F98A /* NSBezierPath+SDRoundedCorners.h */, + 66A649837FCF2AA5DD45FF608FC88C06 /* NSBezierPath+SDRoundedCorners.m */, + 734741E8899B00DDC31612B7D12F62CC /* NSButton+WebCache.h */, + 499663A3CCC70621996DDBFF1770260D /* NSButton+WebCache.m */, + 0C77914A636766438F28EAABB76EB38C /* NSData+ImageContentType.h */, + BC77972C0EA8399E6DFBB1DC6110EC10 /* NSData+ImageContentType.m */, + 6E3D57C2651DEF2F4F6351FF6FC0F34F /* NSImage+Compatibility.h */, + 6B5E0882BB068A6828040133E42DE595 /* NSImage+Compatibility.m */, + CC09DA71D718A0810E41CC1A49217F51 /* SDAnimatedImage.h */, + 1C3D0C3541722AAC8A11CDFEDB71E701 /* SDAnimatedImage.m */, + 2C7DF6047A555ABEE497BDD03866DAAF /* SDAnimatedImagePlayer.h */, + 276C0772D5E34653813BB57358D18887 /* SDAnimatedImagePlayer.m */, + 741D12CAB4CB3ECD9FB6F2A6B9944F11 /* SDAnimatedImageRep.h */, + 5BB2BD6EEDCEBC593C0EEF20B6433A21 /* SDAnimatedImageRep.m */, + 0C0C8228A943EDFEAF7006D5DB292A4B /* SDAnimatedImageView.h */, + AC690A8DB4DCB030E759463F398B0B84 /* SDAnimatedImageView.m */, + 2B97C03D18DA87723386936ACCA969C5 /* SDAnimatedImageView+WebCache.h */, + 3971D6B8F23A0DDEC9762958DC273E75 /* SDAnimatedImageView+WebCache.m */, + 9B91CCC5CB8970101664985116DB4516 /* SDAssociatedObject.h */, + 662675A557F215547AB10FA888848173 /* SDAssociatedObject.m */, + 0ACF56488DA017E7C0AAE512268CE3BB /* SDAsyncBlockOperation.h */, + 8D70E4F158D328F3EC71445EC48212CB /* SDAsyncBlockOperation.m */, + 772BC85255A03C58EC49B33E114EA9FE /* SDDeviceHelper.h */, + B62A8986F54C0DB226A68EA23C403509 /* SDDeviceHelper.m */, + 34ED975954C4134CC497AAE2EFDA793A /* SDDiskCache.h */, + B15FFD49E6CA308B9B3CE3EC57FEF40B /* SDDiskCache.m */, + 277BBBA53BFD35133D89C78878375BF4 /* SDDisplayLink.h */, + AE87800AE145C78144BB7248F25A9572 /* SDDisplayLink.m */, + ADF733BE6CC529AD23B5792C41EF996D /* SDFileAttributeHelper.h */, + F47B089271DDB2F4EB56659080EC5765 /* SDFileAttributeHelper.m */, + CCE56E86000EBF1F740329AE873EC144 /* SDGraphicsImageRenderer.h */, + 24C1536F1535104A934F2CB40FF77725 /* SDGraphicsImageRenderer.m */, + 43BA409DA09A66B3C1CE81AD6F982191 /* SDImageAPNGCoder.h */, + F0234DBFE4F7D479F77E83CD66A1712F /* SDImageAPNGCoder.m */, + EA251249D23B262850F4D1FCF1F332E4 /* SDImageAssetManager.h */, + F68008A8398F4E7994C5B3DEA08F65E0 /* SDImageAssetManager.m */, + EC789C911D0C1620C1446109B57952D3 /* SDImageAWebPCoder.h */, + BE301BC46F0E71127A8C7B0D1B1C0385 /* SDImageAWebPCoder.m */, + 4E886ED5E1F036FA3E36594153F3B9B1 /* SDImageCache.h */, + 8C0D6A09762B3435DBF3E0BDF2429127 /* SDImageCache.m */, + 35A468B922A2797BBFE32C4B813C2258 /* SDImageCacheConfig.h */, + BDA64BEA2EBE20CAB7FEBF5689D0EE2B /* SDImageCacheConfig.m */, + 4A5B420028975C4C042F1005C8D37523 /* SDImageCacheDefine.h */, + 7E815BE2C9A76C30189EAD90CDAAC71B /* SDImageCacheDefine.m */, + BABB9971DF648AB9F2CFEDB5D608B241 /* SDImageCachesManager.h */, + 7B0CA5939CD80430E10A1411EFE2187D /* SDImageCachesManager.m */, + 988D6A68DD4918A73028756ADC37A58D /* SDImageCachesManagerOperation.h */, + A355A0646F71C56E8997FDFADF57C464 /* SDImageCachesManagerOperation.m */, + D353119D1CF0C2785D00B22D4252D90D /* SDImageCoder.h */, + 3FB2E75C4B6457E44603CFCA62669204 /* SDImageCoder.m */, + F4CE27C47FB88D64756D09E07CF62C74 /* SDImageCoderHelper.h */, + 7F7974BC8380083A84D9174ED340CFCB /* SDImageCoderHelper.m */, + 57E0C9B78F91FB83BC84243E988C4ACF /* SDImageCodersManager.h */, + 260519EED0EEE0D055DCC7EC5A3CD2B5 /* SDImageCodersManager.m */, + 635E2BD5493FA04103F7CFD1155ED49F /* SDImageFrame.h */, + D9ABC37EB67F5E525E9C8111A96FFFC1 /* SDImageFrame.m */, + 118F58E1B7F7D9A1EFD4A73CC435D934 /* SDImageGIFCoder.h */, + FF5965CC203FC6DE973869CCE6BBC270 /* SDImageGIFCoder.m */, + AE25E11448D3CC5CBF82BA033FA0F27B /* SDImageGraphics.h */, + B6F03BDD5B4C10813F899EBBB51E32FD /* SDImageGraphics.m */, + 261D29F1AAFC30E2F8ABA03335304579 /* SDImageHEICCoder.h */, + 0F70DED218FE80E8A856DE781D2C6EA7 /* SDImageHEICCoder.m */, + 7C7EF080C7C1F27BD59DCEAF6393B67D /* SDImageIOAnimatedCoder.h */, + 315ED0787420F87684970B96D199CEEC /* SDImageIOAnimatedCoder.m */, + 15447C7B9DB58C272C2635667B3F5E23 /* SDImageIOAnimatedCoderInternal.h */, + B0DA1B787C3CC1D16FF2C9E60FE2E480 /* SDImageIOCoder.h */, + BA961F106D921434651D6D780D8D8A23 /* SDImageIOCoder.m */, + FA26F8D6658216E9328B65C6D7807384 /* SDImageLoader.h */, + 42A5717BB91B605250A8A7DB389575E9 /* SDImageLoader.m */, + E386BA2DAAB24CAAA6C16CCEA1D7ED2F /* SDImageLoadersManager.h */, + AB29DA0771C5328C2C588B0440D7AACE /* SDImageLoadersManager.m */, + 9B00E0FFAC1FB1CE337B21E0BA362E59 /* SDImageTransformer.h */, + 9A36F4575DE2CE33ABD338EA4A391EC8 /* SDImageTransformer.m */, + 424D3DAF8FDA19B777BBB4243F391D11 /* SDInternalMacros.h */, + 4A2218DFC8DB93D6AFA42BAB078E1A93 /* SDInternalMacros.m */, + 2349D51F956065FE067820B390F2720D /* SDMemoryCache.h */, + 199E9345699B49FDC54349ED1DB496B5 /* SDMemoryCache.m */, + 639968E386E9D7C8E6939D4CFE4D26B7 /* SDmetamacros.h */, + 3B7FFF2E5B9F43DC6B7B87DC9CE3C472 /* SDWeakProxy.h */, + A4287258390B8909691A03E41CB093D5 /* SDWeakProxy.m */, + 828447C148B8246DC83EDB1A607DFB65 /* SDWebImage.h */, + F0592577DFD8156A44F4337B7C6DD1F5 /* SDWebImageCacheKeyFilter.h */, + 65D7D9C5945F4F19AE2A112F10B14A4C /* SDWebImageCacheKeyFilter.m */, + 6207E5710B48B087F886CE7BF01BA523 /* SDWebImageCacheSerializer.h */, + 1A1E648B6566C84BDB4E98C4B4314772 /* SDWebImageCacheSerializer.m */, + B49F6E5964DD917FEAF44D0133973466 /* SDWebImageCompat.h */, + 4D154CF4A9B7C691AE982AE1C28C6FD0 /* SDWebImageCompat.m */, + B17123CFD1ADD25B8187654D73E06312 /* SDWebImageDefine.h */, + 074FDAC8D9775DF408E7F877AA8CD8B9 /* SDWebImageDefine.m */, + 31D51B41A8DED7D6BA8E604C757DE0B6 /* SDWebImageDownloader.h */, + ECF54ACDF48DDD24BA5FAC139CA1D88E /* SDWebImageDownloader.m */, + FB93F270C46AFA532AFB4D59303DBC89 /* SDWebImageDownloaderConfig.h */, + 8D6DCC2FB430E15F8E009435EBFE3884 /* SDWebImageDownloaderConfig.m */, + F6A67AE5743DF6EB595B185BAA5234D6 /* SDWebImageDownloaderDecryptor.h */, + BCFF56BB044955624286A31284022D3A /* SDWebImageDownloaderDecryptor.m */, + 2A02C50262F6BC114580EBD93BD1514D /* SDWebImageDownloaderOperation.h */, + 0FA8BF319E806466E4249543C60A339B /* SDWebImageDownloaderOperation.m */, + FC3A59CAFAFD7770905CEF0C9D75D10A /* SDWebImageDownloaderRequestModifier.h */, + 4C44E28EA371C025196A4CB7918011D6 /* SDWebImageDownloaderRequestModifier.m */, + D7298C00FF5A1A57D49B2BA627F35169 /* SDWebImageDownloaderResponseModifier.h */, + BC6C1D386BA08CA936A93E3C4CCB9842 /* SDWebImageDownloaderResponseModifier.m */, + 5C5E565566D2038F562360B38D6C2537 /* SDWebImageError.h */, + 5E89D21A8EDAE7E376A70B799858C508 /* SDWebImageError.m */, + 9DE9D63E915DEDF6021F7F0286C96D26 /* SDWebImageIndicator.h */, + 8A814A3F661CA2F120AF5A723DF384BA /* SDWebImageIndicator.m */, + A58B311EA1CB700A493C508922C9127F /* SDWebImageManager.h */, + 7836EBB911801AEF9D8F2B396839ECDF /* SDWebImageManager.m */, + F52E6309565FE0CF0CFA63A7E4667DCF /* SDWebImageOperation.h */, + D08446011D516129E91DA04FF7A65374 /* SDWebImageOperation.m */, + 9C24738267D466F84218734D0C534311 /* SDWebImageOptionsProcessor.h */, + 0F1299C404AC800C4D663856B1E8BACB /* SDWebImageOptionsProcessor.m */, + B5B29A35E66CB613C265C60C37C87594 /* SDWebImagePrefetcher.h */, + FAB486655B408C78D7B1DF4A8F10A41A /* SDWebImagePrefetcher.m */, + BB7D6713E34D24DFB2AC7EDCB28F2C74 /* SDWebImageTransition.h */, + 402645E5F85A5FAF0043F06C75C31DA9 /* SDWebImageTransition.m */, + 39B1F80D2827984FDEB93BD63F4E243C /* SDWebImageTransitionInternal.h */, + 763B2A212DCA56DC520205A7A45684E2 /* UIButton+WebCache.h */, + 848B4065D38A7403C3720DF5BD73DCA6 /* UIButton+WebCache.m */, + 6DD129AB5D570E00831B6AD86A7C491C /* UIColor+SDHexString.h */, + 0BFFD0254504CE25C09591C4E2D14EAA /* UIColor+SDHexString.m */, + EFD62D5E05FF1392ABF87360FC18C6D1 /* UIImage+ExtendedCacheData.h */, + 56174EC846D710EBB2914E297D9C2535 /* UIImage+ExtendedCacheData.m */, + 9B6B5C63984E342D9BA380750DA36835 /* UIImage+ForceDecode.h */, + 3A947D2AB9920FC44D8E77DD503B88F4 /* UIImage+ForceDecode.m */, + 230D9FFEEB976E721F9FE5490FE259FD /* UIImage+GIF.h */, + 053B94F0670A3E01C4721348BFA34D22 /* UIImage+GIF.m */, + AC4B0C65322E56F8CF5BA827677F993E /* UIImage+MemoryCacheCost.h */, + F65B5C4F20A9DEBFBE2EC0B4C683AC4E /* UIImage+MemoryCacheCost.m */, + 778276C86B4E8C0022EE8494F53ACBA2 /* UIImage+Metadata.h */, + E4E1D4AB19D481860F24F62CEEC7839D /* UIImage+Metadata.m */, + A9D87F6CAD1A47D10F71ACBF43DEE596 /* UIImage+MultiFormat.h */, + B70FB80E1FECC8F023F681A5474A9A8A /* UIImage+MultiFormat.m */, + 8348EABD3A7C31513FC4D420662EA048 /* UIImage+Transform.h */, + 45BFD9C9D54CDAAA33C02ACF498D585E /* UIImage+Transform.m */, + 4FDC9EF0CC19B1676311AE8F9662D9E0 /* UIImageView+HighlightedWebCache.h */, + 07D2FAC161314E0FAD0AF64D75353E95 /* UIImageView+HighlightedWebCache.m */, + 8C4E39AB3C494384025D8DF717F420DC /* UIImageView+WebCache.h */, + AC74A63BE456EFF43EED5E529E373183 /* UIImageView+WebCache.m */, + F540372155C330041B9A6E4F78A76FBD /* UIView+WebCache.h */, + 17F2FE2B4D77CE151BB645012EF7AF6C /* UIView+WebCache.m */, + 7973658E79C7838FFCF0D5BAFB381FEF /* UIView+WebCacheOperation.h */, + 8D93D78E2E53AA6F5376ABB600650F3C /* UIView+WebCacheOperation.m */, + ); + name = Core; + sourceTree = ""; + }; + A2DAB88224A5C6E444F84116BC10553A /* iOS */ = { + isa = PBXGroup; + children = ( + 6CDC6391E3063232D20F2FFE1617B4AA /* Foundation.framework */, + 22AD885D3D57E81A6E96E0E72504B6C8 /* ImageIO.framework */, ); name = iOS; sourceTree = ""; }; - 989A6531501F0DD27440F75CC2FDE9E4 /* TMDBSwift */ = { + B41F2A47F1B3184CEDF05A9F4D620894 /* Support Files */ = { isa = PBXGroup; children = ( - 23151DC84B3AEBA73B0D526A9FF9936C /* Alternative_TitlesMDB.swift */, - 5330C1C040A8C869866E90E279BF38D5 /* ArrayObjectProtocol.swift */, - D1933EBB5AA4755FE6C511B9DFA42ECB /* CastCrewMDB.swift */, - F195D8986B72A18787FD933F68F9748D /* CertificationMDB.swift */, - FEAD7D19E4CB57B5240230C53B888330 /* ChangesMDB.swift */, - 6CB0237073FB750FD000EA43E57316CE /* Clent_Discover.swift */, - 0EE3B0B8EC96581EC5EEDD9B2920838A /* Client.swift */, - B743D7AEC2CD2D01CFE91A00447CFD6F /* Client_Certifications.swift */, - 79FB572DC4FC2E9B349168E18D249507 /* Client_Changes.swift */, - 3D52AAC0B91D9588E349168E2D47EAA7 /* Client_Collections.swift */, - 731E61625276FD2CA91553C2CDBB2EFB /* Client_Companies.swift */, - C6796A8969E2C23177954665C88E1865 /* Client_Configuration.swift */, - FAD2714F1C617A75E57FA41D5010CD91 /* Client_Credits.swift */, - DAC2F35F83C31E66864E07819835FD5B /* Client_Find.swift */, - 3FDDE9C11BFD62B412B328264A33019B /* Client_Genres.swift */, - 0C2FABE0D74688BF5E2012A73CB4089B /* Client_Keywords.swift */, - 49D867069E0F85EBFA8CCEA9E0C62796 /* Client_Lists.swift */, - 95FBA89CDB1D8F6A66D55567956545D8 /* Client_Movies.swift */, - 3146C890D18D2D1C7B405FA42BCE4C35 /* Client_Networks.swift */, - AF204FF6E57E4067611A7AC399749D83 /* Client_People.swift */, - AF5797CB43DC4603CA24241E67EB1740 /* Client_Review.swift */, - AEC717EE7ACF81CF26D9756369FD121C /* Client_Search.swift */, - DA0F999B41862A66A2C3777B078450FF /* Client_TV.swift */, - 5487B322247890C43C0E63A6683D6F99 /* Client_TVSeasonsEpisodes.swift */, - 39467FCBF986C060F3619EA6B7BA0CF1 /* CollectionsMDB.swift */, - 2F70754DEC2828153894BDE600CA71B5 /* CompaniesMDB.swift */, - AA39E2B9C879FF71ED8CF74A05D83D67 /* Config.swift */, - 059A37A8FA268997D999344578870A5A /* ConfigurationMDB.swift */, - 8095B70539EB10416B3F6C80A3B1BB19 /* CreditsMDB.swift */, - 5A99386AE1DC328593CD10E5473F01EA /* Discover.swift */, - A22C2EEC6627DDC7452D34A6C6468B56 /* DiscoverMovie.swift */, - F87ABD25143757E58763E4F98C05719B /* DiscoverTV.swift */, - 7C6FEE16583A802C266A06106FBF1210 /* ExternalIdsMDB.swift */, - C65D5776C672F3E264D7F84D7CB465CD /* FindMDB.swift */, - 8445DBDBDEDE62707DC7977D31A605A9 /* GenresMDB.swift */, - 0B2C36D6DA0B21E4F469124AA3A959B5 /* ImagesMDB.swift */, - 2C6C26925EFE5EF004902946219CFFD7 /* KeywordsMDB.swift */, - DD64C3015B4E385F2601AB3A839BAD8E /* ListsMDB.swift */, - D3EDC56017E5F999BA8913F935FBC87E /* MovieCreditsMDB.swift */, - 77E68795F9116AADA8662F6CA1E5DBED /* MovieDetailedMDB.swift */, - EEF5E73AC94F63292256A629B409736A /* MovieListMDB.swift */, - 1620D25A21B1A1C3FEC77904337170C2 /* MovieMDB.swift */, - 80BCA42E9BDD023A17AA5BEEDCD472D6 /* MovieMDBModel.swift */, - B235FD82E50FB3626E4F99AB870AF94E /* MovieReleaseDatesMDB.swift */, - 982AC43ABDF0524ADB266A0BB1BDBBDA /* MovieReviewMDB.swift */, - 375DDE1A615DF1E9F0C7A136653893B9 /* NetworksMDB.swift */, - DD64203CBB3084AEA547CB8263FA0ACE /* PageResultsMDB.swift */, - F9A5E1EEE0A4C02CF745B87B7654DC5D /* PersonMDB.swift */, - F04C44B525BE21FA8D83E95F451E6410 /* ReviewsMDB.swift */, - 41E14A52C74B98712EB291A957AD990F /* SearchMDB.swift */, - B62A45BFABFC541EE240B263015E30D5 /* SwiftyJSON.swift */, - EB601CF8E99775925D7C1515E3D9C0EF /* TranslationsMDB.swift */, - 34F1329326E3F912D76EA4B2657A742F /* TVCreditsMDB.swift */, - 7B6D2E2DFA8F737A981D2734539EF279 /* TVDetailedMDB.swift */, - 1968869884DD04E9A28FD7979D247705 /* TVEpisodesMDB.swift */, - 18849A7F5FF4EED5D0763638A0EDB982 /* TVMDB.swift */, - 5C78810F677E23A27EED88ADE016C834 /* TVMDBModel.swift */, - 1AF9EB12789629C68F8F23C093A3687B /* TVSeasonsMDB.swift */, - 218819B9500A5A674B469565A46CAEBB /* VideosMDB.swift */, - 00B5E5C299169EBE5C63030C964B2B75 /* Support Files */, + 4A66CC6503E4C4913CF97E79FA1328E4 /* TMDBSwift.modulemap */, + 669824AE01A9870A88D27578DB870945 /* TMDBSwift-dummy.m */, + DFA24801818E79A5848179DCD0A2890B /* TMDBSwift-Info.plist */, + 555F9F90B47B4FEF51AA920DA56D04CE /* TMDBSwift-prefix.pch */, + 07FEE4A81594292AB10FFBFE806B6813 /* TMDBSwift-umbrella.h */, + 8F8DC9897BDE7B2C8B9AE8CCF9D1D111 /* TMDBSwift.debug.xcconfig */, + 6E442689AD59C6F6AC239F3B12C2066F /* TMDBSwift.release.xcconfig */, ); + name = "Support Files"; + path = "../Target Support Files/TMDBSwift"; + sourceTree = ""; + }; + B847C603BF7D6353530059F1EDAF2387 /* TMDBSwift */ = { + isa = PBXGroup; + children = ( + E48532E92ADAA5E8BAF71B82366E9426 /* Alternative_TitlesMDB.swift */, + 854A8DFFA133EC626FB283087453A394 /* ArrayObjectProtocol.swift */, + E79C2709B1C112002B06C4B6CBBBA0A4 /* CastCrewMDB.swift */, + E4296A3D0D572A64B183F144CCB5B2BF /* CertificationMDB.swift */, + 07534B6F5A3589DF38E5553CEF643A64 /* ChangesMDB.swift */, + 921083316646B3DB736DA577C2C78FC0 /* Clent_Discover.swift */, + D2AEF6D763FECC70AE750E47375EABFC /* Client.swift */, + C059FF1AD5D3123A7DA435A6F5EEFF5B /* Client_Certifications.swift */, + B877E55F483FBE792D7ACD37195CBD2F /* Client_Changes.swift */, + 9071DBFBA5CE1FE7115352312C94A4F1 /* Client_Collections.swift */, + AB001BA0C1F15DA56E443AF2130F7F22 /* Client_Companies.swift */, + 2DC89E9F0BD25525AE3C146116DCF067 /* Client_Configuration.swift */, + DA58A429F846D8B2D9299C01C591E3E4 /* Client_Credits.swift */, + 754A9B7470891647AA65434C0517A4CC /* Client_Find.swift */, + 77FB29967A3C58B49D7F038E78D9F21C /* Client_Genres.swift */, + B66E97E407E57B162E6F4D9CD92EF6A9 /* Client_Keywords.swift */, + 8EC427952B5EEBA3CBFFC885105C9E68 /* Client_Lists.swift */, + 17F42EAB1E66DBEF784B40010CCF1C82 /* Client_Movies.swift */, + EAFC3D1C8D426405D666A2D144593F61 /* Client_Networks.swift */, + A47DF9A97759073EAB4067494728ED85 /* Client_People.swift */, + 9DEBF645D35D52037D54B5612F8D34C0 /* Client_Review.swift */, + 2386827B7211BC42131DFA9213B3B86E /* Client_Search.swift */, + C1BDE9B7E27457D8DE056D2AB81BE86F /* Client_TV.swift */, + CF1E137CEB2F512808DC6749A8072D3A /* Client_TVSeasonsEpisodes.swift */, + C3B89F0025630D46B405C9E376EFA4C1 /* CollectionsMDB.swift */, + 756A7DF719CB54D142A8E938917ADCFE /* CompaniesMDB.swift */, + 16D332BFEC872D08F2F300208D0C6295 /* Config.swift */, + CBACB54D48BDF9644EF5F98A840EB5BD /* ConfigurationMDB.swift */, + 67DA7577A1952A22D720FCFCDD883961 /* CreditsMDB.swift */, + FB7ACB2C7DA8AA12633FC1AA68DA69E7 /* Discover.swift */, + 4C30EFC078030A3A5108C43BA8EF980E /* DiscoverMovie.swift */, + 40F6E25F89A76BCCFA10D470B7F2E88A /* DiscoverTV.swift */, + 88FE49A37E0AD4BCC4A654CDF4731715 /* ExternalIdsMDB.swift */, + 611C8DB907A2BFACAB392E65A661C99A /* FindMDB.swift */, + ADE5AD6AC1755CDA02875A69FE7C135A /* GenresMDB.swift */, + DB9AB64D518713EB8A14B1A45ADB274F /* ImagesMDB.swift */, + 365433E30041B149CDE4AF6E35B05F36 /* KeywordsMDB.swift */, + EA9EC5C6A81CE257982C8C214FF89AF0 /* ListsMDB.swift */, + 3D187EE3CB40C5EDBB671F26D3A53CC5 /* MovieCreditsMDB.swift */, + 5FB71F86CB99F42D724FF7229BF2FBDF /* MovieDetailedMDB.swift */, + 8AD79F0044DD72FB1E1D60BEF0E90BB8 /* MovieListMDB.swift */, + A2A4AA03E06BC6590C8F8A52BBDF1849 /* MovieMDB.swift */, + 0FD272B910C778D660B582837C3683C5 /* MovieMDBModel.swift */, + B9AC5389FAE0CB614D95F719B8B0F6C9 /* MovieReleaseDatesMDB.swift */, + A277B41F7D5557D863FF285FE3258DD0 /* MovieReviewMDB.swift */, + 6451957A96686449C54B797ACCF13893 /* NetworksMDB.swift */, + BB9338AB851938F757B655AC20A0D9F9 /* PageResultsMDB.swift */, + 1FED0B73B0083D0A77E6359D484BD21D /* PersonMDB.swift */, + 3C5C39C09113E31FE804B8C8874326C2 /* ReviewsMDB.swift */, + 8E5FA8E52E94FD3521B812B9C59068FF /* SearchMDB.swift */, + 309C65F2971C893297C7911B8D3923A0 /* SwiftyJSON.swift */, + F6A0103836154E2452BC19A5428C1BCC /* TranslationsMDB.swift */, + 4DA0917ED0A9A85580B2A7593A0CFC50 /* TVCreditsMDB.swift */, + DAB07FF6690A0CDB206ED4A8F0CD09E5 /* TVDetailedMDB.swift */, + E9F02601F1289C9CEAA0B98ABC87F3A3 /* TVEpisodesMDB.swift */, + EF7DE75F48872C3DF4BF488ABA98E1A4 /* TVMDB.swift */, + DBB439A692046C3BFF7B973CC3F18D42 /* TVMDBModel.swift */, + BB084BDB4A8A18EA6D311AA77E7406FB /* TVSeasonsMDB.swift */, + 0C08EB189AEC0772406B978B922303E4 /* VideosMDB.swift */, + B41F2A47F1B3184CEDF05A9F4D620894 /* Support Files */, + ); + name = TMDBSwift; path = TMDBSwift; sourceTree = ""; }; - CF1408CF629C7361332E53B88F7BD30C = { + C37453FF6AB1784E104598C7D719F4DB /* SDWebImage */ = { isa = PBXGroup; children = ( - 9D940727FF8FB9C785EB98E56350EF41 /* Podfile */, - D210D550F4EA176C3123ED886F8F87F5 /* Frameworks */, - 1887DABF11D437A4D21845E651E305C6 /* Pods */, - E104DBCD1A45E00447BD67A679CABF7C /* Products */, - 492E2B4302B2D9A1CFE0BB25C8B389AB /* Targets Support Files */, + 90C4744D7DA537417F5C909E2E308A80 /* Core */, + 0747BEDDEB2E33D38617A38986352AE3 /* Support Files */, ); + name = SDWebImage; + path = SDWebImage; sourceTree = ""; }; - D210D550F4EA176C3123ED886F8F87F5 /* Frameworks */ = { + CF1408CF629C7361332E53B88F7BD30C = { isa = PBXGroup; children = ( - 578452D2E740E91742655AC8F1636D1F /* iOS */, + 9D940727FF8FB9C785EB98E56350EF41 /* Podfile */, + 1628BF05B4CAFDCC3549A101F5A10A17 /* Frameworks */, + 5F7B700A2EE041871270A57628BCA798 /* Pods */, + D8B826E6C377846915EF10DAA9A7A6B0 /* Products */, + 492E2B4302B2D9A1CFE0BB25C8B389AB /* Targets Support Files */, ); - name = Frameworks; sourceTree = ""; }; D750B5A3260BD8C37BFFBC1D47A58D1F /* Pods-NetflixCloneApp */ = { @@ -328,11 +915,13 @@ path = "Target Support Files/Pods-NetflixCloneApp"; sourceTree = ""; }; - E104DBCD1A45E00447BD67A679CABF7C /* Products */ = { + D8B826E6C377846915EF10DAA9A7A6B0 /* Products */ = { isa = PBXGroup; children = ( C47A19124F949B56F1E1D12C1EAF1FB1 /* Pods-NetflixCloneApp */, - 8640A514D00B06AAC252FEC4B4035228 /* TMDBSwift.framework */, + B0B214D775196BA7CA8E17E53048A493 /* SDWebImage */, + 6B1B10F952F684F6767E6903C2F5E816 /* SDWebImageSwiftUI */, + 8640A514D00B06AAC252FEC4B4035228 /* TMDBSwift */, ); name = Products; sourceTree = ""; @@ -340,11 +929,84 @@ /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ - 1E0697CB9EB52152BEAA350105180F35 /* Headers */ = { + 104737A7F2F8176AF07A40A019B4DC37 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - FBD7915669FB7E4FDAE075B5B0DEEE66 /* Pods-NetflixCloneApp-umbrella.h in Headers */, + 6C93ABDF963DDA7C78AADD9F22CD5CB1 /* NSBezierPath+SDRoundedCorners.h in Headers */, + 7E6862A73246BB1A0E7BCEBAF50FFBE1 /* NSButton+WebCache.h in Headers */, + BD074722CD72470954ADB5B1198E01C5 /* NSData+ImageContentType.h in Headers */, + E8CE28499C17965A931605D4F47AAEBF /* NSImage+Compatibility.h in Headers */, + 38CF7D5EE6C28780FE3F9C1E63CFF3D4 /* SDAnimatedImage.h in Headers */, + 57E1C476BA5F8DD1ED740FE8DBC05D8A /* SDAnimatedImagePlayer.h in Headers */, + 4FB353F2B2E7D7AE0811D7C538DA2B36 /* SDAnimatedImageRep.h in Headers */, + F463DEB020D5C466D4613947AE4BE16F /* SDAnimatedImageView.h in Headers */, + 42822E48A1441AD8E0011D37C1625B36 /* SDAnimatedImageView+WebCache.h in Headers */, + 84B624227D73D3746CEFD48E49D74635 /* SDAssociatedObject.h in Headers */, + 18303B692A81A7D708973A6B9CBA75D8 /* SDAsyncBlockOperation.h in Headers */, + F161112B04B9AC7D276D9F588BA6E313 /* SDDeviceHelper.h in Headers */, + FE0189D2FE038AD82C4CCF5A801A50A3 /* SDDiskCache.h in Headers */, + A24B4B60656BA387B9979BD877A23983 /* SDDisplayLink.h in Headers */, + F077E74D9855D0D7FCF570F8E8ED4A1E /* SDFileAttributeHelper.h in Headers */, + A2CE92DE43AB450DE1AAA129BFBADCBE /* SDGraphicsImageRenderer.h in Headers */, + 809A09224ABB6A00BEF6B72EFAB30B4E /* SDImageAPNGCoder.h in Headers */, + 336BA7F271A33087B951BA4C6C6B2C6F /* SDImageAssetManager.h in Headers */, + 33C0E2EFD1C8046A2020D25FD1F1611F /* SDImageAWebPCoder.h in Headers */, + 0F4322740A001E3D7BFD2C333BCF907D /* SDImageCache.h in Headers */, + E7FA1E1CD066D0335A95376C73E3F8ED /* SDImageCacheConfig.h in Headers */, + 5BBE7719912593F1DEFF8E763EAD4ED6 /* SDImageCacheDefine.h in Headers */, + 909CBA577868D6E976AC82340B50343E /* SDImageCachesManager.h in Headers */, + E8D519B63C2077979F799769F9A35072 /* SDImageCachesManagerOperation.h in Headers */, + 0FFA0C960F26666918569059FB8E92BC /* SDImageCoder.h in Headers */, + 519B33DCAE0FB73CC313A2C2AD434449 /* SDImageCoderHelper.h in Headers */, + 8821E3636BB86560FC2F2D2CFF545F16 /* SDImageCodersManager.h in Headers */, + 523861A018452CE8BB166B59A7872BDA /* SDImageFrame.h in Headers */, + C7E8A80BE6BE5452380D8CA71F278B8A /* SDImageGIFCoder.h in Headers */, + 80D4A72C26C2EF865F9DCA400D2F1E70 /* SDImageGraphics.h in Headers */, + 99709E1C4991C49EE5601FF9461B2969 /* SDImageHEICCoder.h in Headers */, + 11E79385CD0DA86166E63D21E7E078E9 /* SDImageIOAnimatedCoder.h in Headers */, + 168AB5EA0EBEB75D0434B55D0B97AD47 /* SDImageIOAnimatedCoderInternal.h in Headers */, + E5C6051933677CDF392BF6356271A92E /* SDImageIOCoder.h in Headers */, + 67B3DCBA30FDEDA18E0D4E3B2C16C911 /* SDImageLoader.h in Headers */, + C4A78B8FC2DC76FBCF43D9D53BF90767 /* SDImageLoadersManager.h in Headers */, + 8C5D0B2A7B52DF68D03820244993E91B /* SDImageTransformer.h in Headers */, + 8433F353F3016EFF0316F48188D6B651 /* SDInternalMacros.h in Headers */, + C2D82385F4FDB67F6613CBBE8E2BD850 /* SDMemoryCache.h in Headers */, + E556832E0C191FCFABB9E97C87D243EF /* SDmetamacros.h in Headers */, + 9C096C865369C21D252A0F4F90BE21D9 /* SDWeakProxy.h in Headers */, + E515780850EBAD40342EBF2997BFC2D2 /* SDWebImage.h in Headers */, + 48920AFFC7C0E2FEA632DAA2BD63287D /* SDWebImage-umbrella.h in Headers */, + B128DE666CCA7CF6B0F09411D8209A92 /* SDWebImageCacheKeyFilter.h in Headers */, + DECA57AF64C5C257919649ECBB75F0B9 /* SDWebImageCacheSerializer.h in Headers */, + FED292AF8AD5924263FC0A8D0B8AF26D /* SDWebImageCompat.h in Headers */, + 7D9E8F8A5D02148FCC2DBD6319BCC3D1 /* SDWebImageDefine.h in Headers */, + 5B69919844A3BD774BAABB186D6A524F /* SDWebImageDownloader.h in Headers */, + F7289F163C285103D6CCAB39447153CA /* SDWebImageDownloaderConfig.h in Headers */, + 05D76FA82DD3C37B76FFC1689CEF9981 /* SDWebImageDownloaderDecryptor.h in Headers */, + 20004B99F5050F59E747AB8DFAD7E891 /* SDWebImageDownloaderOperation.h in Headers */, + AD0CFDA140E346502935BA58225E6EF3 /* SDWebImageDownloaderRequestModifier.h in Headers */, + 2D7E7D5F025A1006C0D373B5884B6E52 /* SDWebImageDownloaderResponseModifier.h in Headers */, + 9917CEAD8CE1CEB7FEC031255AED8FA8 /* SDWebImageError.h in Headers */, + 8F88549F032EFFEA9C281860520CC879 /* SDWebImageIndicator.h in Headers */, + 07A41F67B40B3C6C6C3DB862F1F633F8 /* SDWebImageManager.h in Headers */, + 36F35669F3AFF65477B2366FC09A1B3F /* SDWebImageOperation.h in Headers */, + 6F4B172730B7293C1D988FBE34B45E20 /* SDWebImageOptionsProcessor.h in Headers */, + 8C9D609988FE2993BB116B4B00FAC57B /* SDWebImagePrefetcher.h in Headers */, + 0311D5903A8C13AE6158796BC69AD994 /* SDWebImageTransition.h in Headers */, + B04279CC3476C6D75EDE63B360B89DEC /* SDWebImageTransitionInternal.h in Headers */, + A083AAC3481062E5DE223D480757A83B /* UIButton+WebCache.h in Headers */, + F4811CFAC05932CE436CC2C32BAD91E6 /* UIColor+SDHexString.h in Headers */, + D7BA04ADFE3104907F100E9370184A65 /* UIImage+ExtendedCacheData.h in Headers */, + 4A27F890C33243C4548A25318264B375 /* UIImage+ForceDecode.h in Headers */, + DBBAC864AD405BED53782364E0F0D5F3 /* UIImage+GIF.h in Headers */, + 26BF15D648EFA59FCA18AE285AC5B2A1 /* UIImage+MemoryCacheCost.h in Headers */, + 73F2DE8B48DC2F7C87529AB3901B9E94 /* UIImage+Metadata.h in Headers */, + 278F5B2C01E923AA0C691D79BD0F321F /* UIImage+MultiFormat.h in Headers */, + D556C63635E7A83C7A9B04FB104F7339 /* UIImage+Transform.h in Headers */, + 37E3C820BC838123661E1391BEAF8092 /* UIImageView+HighlightedWebCache.h in Headers */, + 0BFA90EFCD3407716FFC60D140325188 /* UIImageView+WebCache.h in Headers */, + D975B260AB44081399BCB612916CE675 /* UIView+WebCache.h in Headers */, + 2F85FF5597762E2E3C6961C6DD690A60 /* UIView+WebCacheOperation.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -356,28 +1018,84 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 5DE5FB2DCD3EF554BEBB3D893D76DFA8 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + C91200738612F1E36114D53986DDEDFB /* Pods-NetflixCloneApp-umbrella.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 8B0FAF2C9E9574F3F5FD0DABEF1B1A4F /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + E0D1C9C85B8E3DB406BDFC2F48387F96 /* SDWebImageSwiftUI.h in Headers */, + 86FAB0E018E830833637F9793540223F /* SDWebImageSwiftUI-umbrella.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ + 3847153A6E5EEFB86565BA840768F429 /* SDWebImage */ = { + isa = PBXNativeTarget; + buildConfigurationList = BABD4A24CFCBE5B6FE4680AA062FCF04 /* Build configuration list for PBXNativeTarget "SDWebImage" */; + buildPhases = ( + 104737A7F2F8176AF07A40A019B4DC37 /* Headers */, + 4B6FB7A17469A2800E7231A1444746CB /* Sources */, + FB6A1E8A43CF1D3ADFB49BA355F0DEA1 /* Frameworks */, + DC20DB2B5A8B3C34EAC16992C6449775 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = SDWebImage; + productName = SDWebImage; + productReference = B0B214D775196BA7CA8E17E53048A493 /* SDWebImage */; + productType = "com.apple.product-type.framework"; + }; 4C2E03B9EF9A7D57B3AFC01E47DF0119 /* Pods-NetflixCloneApp */ = { isa = PBXNativeTarget; - buildConfigurationList = 282246F3F7236D458CE52F30FBAE711B /* Build configuration list for PBXNativeTarget "Pods-NetflixCloneApp" */; + buildConfigurationList = D933C84C91D46054D362B387716A5001 /* Build configuration list for PBXNativeTarget "Pods-NetflixCloneApp" */; buildPhases = ( - 1E0697CB9EB52152BEAA350105180F35 /* Headers */, - 4D2D7EA88C5C3B4CB84F3BEDB20AA6DB /* Sources */, - DA281E8D2748EBBC99BCAD444F86D691 /* Frameworks */, - 52FDEB5DED4B37CD797F1FFB49C85E14 /* Resources */, + 5DE5FB2DCD3EF554BEBB3D893D76DFA8 /* Headers */, + D4D738699F2C0F1F7EA36D586834451F /* Sources */, + 3D32F1F4832469E891E925B166828357 /* Frameworks */, + D2CB0B230402EAEFAF9950D0D5EF8BFC /* Resources */, ); buildRules = ( ); dependencies = ( - 2B24C9A68B74FE10A08BF11551B82882 /* PBXTargetDependency */, + AF8F5A70D18BF07F99FEFBF1531B6791 /* PBXTargetDependency */, + DBAA690333D531BBDAE547B872868699 /* PBXTargetDependency */, + B3715CA05F5B7515376C7F9F9FEB17DD /* PBXTargetDependency */, ); name = "Pods-NetflixCloneApp"; productName = Pods_NetflixCloneApp; productReference = C47A19124F949B56F1E1D12C1EAF1FB1 /* Pods-NetflixCloneApp */; productType = "com.apple.product-type.framework"; }; + 92EBFA3E7005B4C18A9C0B44324EB80F /* SDWebImageSwiftUI */ = { + isa = PBXNativeTarget; + buildConfigurationList = 200751771720D75DCD2386D5D465F2D3 /* Build configuration list for PBXNativeTarget "SDWebImageSwiftUI" */; + buildPhases = ( + 8B0FAF2C9E9574F3F5FD0DABEF1B1A4F /* Headers */, + 36D323E9379D9250B601492678E521D8 /* Sources */, + 03FC04A5CC14E97F74BA5BCAB4520FA1 /* Frameworks */, + 4596388295FD2DD95588A084AD5802F6 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 169838430E21CDAA4B36ECB6CE2094A5 /* PBXTargetDependency */, + ); + name = SDWebImageSwiftUI; + productName = SDWebImageSwiftUI; + productReference = 6B1B10F952F684F6767E6903C2F5E816 /* SDWebImageSwiftUI */; + productType = "com.apple.product-type.framework"; + }; CD08042101584CD51388D925427AEBAC /* TMDBSwift */ = { isa = PBXNativeTarget; buildConfigurationList = 232630FBD411E2F5AC94D5B509AF6D8E /* Build configuration list for PBXNativeTarget "TMDBSwift" */; @@ -393,7 +1111,7 @@ ); name = TMDBSwift; productName = TMDBSwift; - productReference = 8640A514D00B06AAC252FEC4B4035228 /* TMDBSwift.framework */; + productReference = 8640A514D00B06AAC252FEC4B4035228 /* TMDBSwift */; productType = "com.apple.product-type.framework"; }; /* End PBXNativeTarget section */ @@ -403,7 +1121,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 1240; - LastUpgradeCheck = 1340; + LastUpgradeCheck = 1240; }; buildConfigurationList = 4821239608C13582E20E6DA73FD5F1F9 /* Build configuration list for PBXProject "Pods" */; compatibilityVersion = "Xcode 13.0"; @@ -414,18 +1132,27 @@ en, ); mainGroup = CF1408CF629C7361332E53B88F7BD30C; - productRefGroup = E104DBCD1A45E00447BD67A679CABF7C /* Products */; + productRefGroup = D8B826E6C377846915EF10DAA9A7A6B0 /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( 4C2E03B9EF9A7D57B3AFC01E47DF0119 /* Pods-NetflixCloneApp */, + 3847153A6E5EEFB86565BA840768F429 /* SDWebImage */, + 92EBFA3E7005B4C18A9C0B44324EB80F /* SDWebImageSwiftUI */, CD08042101584CD51388D925427AEBAC /* TMDBSwift */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ - 52FDEB5DED4B37CD797F1FFB49C85E14 /* Resources */ = { + 4596388295FD2DD95588A084AD5802F6 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D2CB0B230402EAEFAF9950D0D5EF8BFC /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( @@ -439,9 +1166,113 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + DC20DB2B5A8B3C34EAC16992C6449775 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ + 36D323E9379D9250B601492678E521D8 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 67C1FB634A01239B1C24A1F1AB5FE9B5 /* ActivityIndicator.swift in Sources */, + 01518247AE5C0AAD95C02C6631588396 /* AnimatedImage.swift in Sources */, + 9514357C83E6BD50F897642320D2661B /* Image.swift in Sources */, + 46F295ABF44B05A541ADA1A51825DA4B /* ImageManager.swift in Sources */, + FB5688F39EBB6B642F2C442DA3E7D903 /* ImagePlayer.swift in Sources */, + 9642957A643D90E5A5741EF65D85D4C3 /* ImageViewWrapper.swift in Sources */, + 70CA6CF0FE0ECE29E4B93A4D29924A56 /* Indicator.swift in Sources */, + 84B62AA0E3938AFDDA7A4DE9FC610AD9 /* ProgressIndicator.swift in Sources */, + 51833F2045AD93A3D77FF8074DDD0CC6 /* SDWebImageSwiftUI.swift in Sources */, + 29A171D04BF558ED769E80CC385DEB7D /* SDWebImageSwiftUI-dummy.m in Sources */, + DDEC8B313656488F61F7BF091DB22989 /* SwiftUICompatibility.swift in Sources */, + 7ABC507AF4E384FC551A22DE93891D1D /* Transition.swift in Sources */, + CD193DB9492BC39C535A7C634A9B22B3 /* WebImage.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 4B6FB7A17469A2800E7231A1444746CB /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 21D05279AA20EE7A1707A76C11BBCC00 /* NSBezierPath+SDRoundedCorners.m in Sources */, + 474163E6CF20CA1AC3698759F2B6D51B /* NSButton+WebCache.m in Sources */, + FF66F3E7374A9398D5B08AA23273BC0E /* NSData+ImageContentType.m in Sources */, + 994327308CC7ECE7850C804FA0EA5F21 /* NSImage+Compatibility.m in Sources */, + 9CEB5B454088D6BCC3A11C759A76161A /* SDAnimatedImage.m in Sources */, + 0C76BA74E22A5CFD8207C10026401D80 /* SDAnimatedImagePlayer.m in Sources */, + 24DA814C2F7EA7C4187E2BF0B6466E9A /* SDAnimatedImageRep.m in Sources */, + D88076DA0593D2835645CA5A92FFA37C /* SDAnimatedImageView.m in Sources */, + AA3AE0DF5E35D3E0D2CAE7972D69373E /* SDAnimatedImageView+WebCache.m in Sources */, + 4F5982101CB9FB68613E826F137B5E95 /* SDAssociatedObject.m in Sources */, + 498AB54D6531F0B57EAAD113AA0CF0F9 /* SDAsyncBlockOperation.m in Sources */, + 58FAE3A59FBE896EBBDACB0808067CA5 /* SDDeviceHelper.m in Sources */, + 275F99E74511043432C892810081DCAF /* SDDiskCache.m in Sources */, + 9D7EBB3A7377C116526B8A511F8CE245 /* SDDisplayLink.m in Sources */, + 2C762E5C654B718C19CC98FEB27C2DA4 /* SDFileAttributeHelper.m in Sources */, + B88C351562CE8FA4255EA9023213BE4E /* SDGraphicsImageRenderer.m in Sources */, + 854D7A4A2872566E4D06870518053225 /* SDImageAPNGCoder.m in Sources */, + 3015C91C523C5133A639F57DE0425100 /* SDImageAssetManager.m in Sources */, + D7D077F0FA5CAC32ACB65372453C701F /* SDImageAWebPCoder.m in Sources */, + 0D2B3D451D64A5A0AE5CE51E975D7494 /* SDImageCache.m in Sources */, + 888BEE4C3B238AC407C59D2194939AB9 /* SDImageCacheConfig.m in Sources */, + 138DFC533930F784B55D9BB8AACC0E06 /* SDImageCacheDefine.m in Sources */, + 4623448C58E0E271F0DF5F4CC6CAFD0D /* SDImageCachesManager.m in Sources */, + 78AE96580BD551EB905F72C21AB81E97 /* SDImageCachesManagerOperation.m in Sources */, + 64CDB33E49BDBE16653C88756E26B8CB /* SDImageCoder.m in Sources */, + E9CF46857D61D2A8AF4C3722C27C61C6 /* SDImageCoderHelper.m in Sources */, + DB68D9AFA817850ED9EBBE7F3F378AF5 /* SDImageCodersManager.m in Sources */, + 007F57C0030B0CA201A359FD816A3CE1 /* SDImageFrame.m in Sources */, + 164DEB7B33A09DD8663942511488AD16 /* SDImageGIFCoder.m in Sources */, + F0E28CEF30861F3589A4A662CEA76D80 /* SDImageGraphics.m in Sources */, + E33A7CDF3107CD3426ADD0D906100CD4 /* SDImageHEICCoder.m in Sources */, + 96479C9C76FDC513C03ADD58168F6911 /* SDImageIOAnimatedCoder.m in Sources */, + 536E9C0D3855A6AF7CADCB9FBAFC613D /* SDImageIOCoder.m in Sources */, + ABEAA41C35A6CD25C93E622FB129C379 /* SDImageLoader.m in Sources */, + 3F567CE353442AE137B71B258409F5DA /* SDImageLoadersManager.m in Sources */, + A9A87DA629538D239C4B7401EB56AEB5 /* SDImageTransformer.m in Sources */, + 61CD5A24511DC980EFF397CF57AC50F5 /* SDInternalMacros.m in Sources */, + 0D0AF4DF934B7BE39EC6E287B003BBA6 /* SDMemoryCache.m in Sources */, + 4075297FF5A21C84EF513521FD7B34EF /* SDWeakProxy.m in Sources */, + 0DEECB4887F8ED8A8304156D1C440639 /* SDWebImage-dummy.m in Sources */, + 67B0CAAD8E88B9A2357C41E73EA2EB48 /* SDWebImageCacheKeyFilter.m in Sources */, + 05102BD9E7BCB80DC7B64A34D0E7850B /* SDWebImageCacheSerializer.m in Sources */, + E4AF87F8012F919F00E2E8698A1A3C33 /* SDWebImageCompat.m in Sources */, + 49F97D8BA4E81A5E0EF866A293392AF2 /* SDWebImageDefine.m in Sources */, + D68F08F717E95BABFB43AE705D943426 /* SDWebImageDownloader.m in Sources */, + FE05A1BF611E69C94BC7A9EADBE10B2F /* SDWebImageDownloaderConfig.m in Sources */, + DE0BA471FB4FC10C0B25BDE4F22F5B76 /* SDWebImageDownloaderDecryptor.m in Sources */, + DB61822BEA875B413C858E1166590C9F /* SDWebImageDownloaderOperation.m in Sources */, + C27BD8C6B4E713A8E7B7B76B80E45823 /* SDWebImageDownloaderRequestModifier.m in Sources */, + FB359FC2B8375E01A8A8F84D3C50EE82 /* SDWebImageDownloaderResponseModifier.m in Sources */, + 5F49C3C9A3733CD50642E0B57D405D44 /* SDWebImageError.m in Sources */, + 343B53EB998CC5B609B8DE84BAD882E0 /* SDWebImageIndicator.m in Sources */, + FE4845B6FDD260059CDF9E26965CA31B /* SDWebImageManager.m in Sources */, + BE649A29E5FB32C54FDAE55994804F6D /* SDWebImageOperation.m in Sources */, + 7A424FED21A399FE2610DCB710A4A3FB /* SDWebImageOptionsProcessor.m in Sources */, + 62A22A4C10675F9B65C7677CFD6C4676 /* SDWebImagePrefetcher.m in Sources */, + 3B72C235C1AB8944333C2322F08B6B46 /* SDWebImageTransition.m in Sources */, + C55A2D001850D3F407D968CFF1C545E2 /* UIButton+WebCache.m in Sources */, + AE89C60F9CD4D6E1400DD304CE2A2B9E /* UIColor+SDHexString.m in Sources */, + BCB7B61DB37BA3EDB8CBBF258DC66446 /* UIImage+ExtendedCacheData.m in Sources */, + F497CD01EF6568475FD363A248D78A4B /* UIImage+ForceDecode.m in Sources */, + DEE74CD0E78DE0DB4056A8A3244B6ED1 /* UIImage+GIF.m in Sources */, + 412EE262DCED176A73591124DBDBA97C /* UIImage+MemoryCacheCost.m in Sources */, + 28532908E40E423052AA43B0000028BF /* UIImage+Metadata.m in Sources */, + 5B3271A67137276C4B2CD554BAB9F4DA /* UIImage+MultiFormat.m in Sources */, + BF9A6E2CB8F67686C4B7E04538664919 /* UIImage+Transform.m in Sources */, + C4762BD85B320B9EBE199F7CDFBCED12 /* UIImageView+HighlightedWebCache.m in Sources */, + 10E9E4249C8C22A571EBFECF3C0676CC /* UIImageView+WebCache.m in Sources */, + A3BFF0CDB72BC173BEA1C8ADDBDB0D1D /* UIView+WebCache.m in Sources */, + 429E5CC928985357D07058FDEE8069FA /* UIView+WebCacheOperation.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 4C8F959BB4CD409E34F5C7CAB9D15141 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -509,27 +1340,188 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 4D2D7EA88C5C3B4CB84F3BEDB20AA6DB /* Sources */ = { + D4D738699F2C0F1F7EA36D586834451F /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 60ADE692825872313AFFE9B1904C2909 /* Pods-NetflixCloneApp-dummy.m in Sources */, + B9DC358432C0A7CFCE2630C6E4D61F6C /* Pods-NetflixCloneApp-dummy.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ - 2B24C9A68B74FE10A08BF11551B82882 /* PBXTargetDependency */ = { + 169838430E21CDAA4B36ECB6CE2094A5 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = SDWebImage; + target = 3847153A6E5EEFB86565BA840768F429 /* SDWebImage */; + targetProxy = CF469B45566AE02793689FFA3D8A5C73 /* PBXContainerItemProxy */; + }; + AF8F5A70D18BF07F99FEFBF1531B6791 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = SDWebImage; + target = 3847153A6E5EEFB86565BA840768F429 /* SDWebImage */; + targetProxy = C017CA66E6134505EB40D23A724D588F /* PBXContainerItemProxy */; + }; + B3715CA05F5B7515376C7F9F9FEB17DD /* PBXTargetDependency */ = { isa = PBXTargetDependency; name = TMDBSwift; target = CD08042101584CD51388D925427AEBAC /* TMDBSwift */; - targetProxy = 9838D13BDDBA6702AB43F8ED7432E3E4 /* PBXContainerItemProxy */; + targetProxy = 24FEAF3A507C4C32F233B6EFFBC83468 /* PBXContainerItemProxy */; + }; + DBAA690333D531BBDAE547B872868699 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = SDWebImageSwiftUI; + target = 92EBFA3E7005B4C18A9C0B44324EB80F /* SDWebImageSwiftUI */; + targetProxy = EDAC4E5D8CB7D87E30498E28039F0BFB /* PBXContainerItemProxy */; }; /* End PBXTargetDependency section */ /* Begin XCBuildConfiguration section */ - 09909ECBA13E8F70A928465E7F7A9A92 /* Debug */ = { + 00403A510F1318D67AA55C1B4DCB17FB /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 34C48738F4C471ABE5CCC1B4A77639C9 /* SDWebImage.release.xcconfig */; + buildSettings = { + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + GCC_PREFIX_HEADER = "Target Support Files/SDWebImage/SDWebImage-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/SDWebImage/SDWebImage-Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MODULEMAP_FILE = "Target Support Files/SDWebImage/SDWebImage.modulemap"; + PRODUCT_MODULE_NAME = SDWebImage; + PRODUCT_NAME = SDWebImage; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + 19F05115E6D176E8F44A4D351A78D321 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 09057BE2905EA1A27AF3AE51A4789396 /* SDWebImageSwiftUI.debug.xcconfig */; + buildSettings = { + CLANG_ENABLE_OBJC_WEAK = NO; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + GCC_PREFIX_HEADER = "Target Support Files/SDWebImageSwiftUI/SDWebImageSwiftUI-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/SDWebImageSwiftUI/SDWebImageSwiftUI-Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MODULEMAP_FILE = "Target Support Files/SDWebImageSwiftUI/SDWebImageSwiftUI.modulemap"; + PRODUCT_MODULE_NAME = SDWebImageSwiftUI; + PRODUCT_NAME = SDWebImageSwiftUI; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; + SWIFT_VERSION = 5.2; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + 2BDC8ADFCF0A68A0DA11A316365D0E0F /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = EE0F773964510DA86D66FB3921E0BC7A /* Pods-NetflixCloneApp.debug.xcconfig */; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO; + CLANG_ENABLE_OBJC_WEAK = NO; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = "Target Support Files/Pods-NetflixCloneApp/Pods-NetflixCloneApp-Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MACH_O_TYPE = staticlib; + MODULEMAP_FILE = "Target Support Files/Pods-NetflixCloneApp/Pods-NetflixCloneApp.modulemap"; + OTHER_LDFLAGS = ""; + OTHER_LIBTOOLFLAGS = ""; + PODS_ROOT = "$(SRCROOT)"; + PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + 5499CAA1230F6265F513BA06A2E08248 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7591EF0E33B82CFC494FA8DDEF42B33C /* SDWebImageSwiftUI.release.xcconfig */; + buildSettings = { + CLANG_ENABLE_OBJC_WEAK = NO; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + GCC_PREFIX_HEADER = "Target Support Files/SDWebImageSwiftUI/SDWebImageSwiftUI-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/SDWebImageSwiftUI/SDWebImageSwiftUI-Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + MODULEMAP_FILE = "Target Support Files/SDWebImageSwiftUI/SDWebImageSwiftUI.modulemap"; + PRODUCT_MODULE_NAME = SDWebImageSwiftUI; + PRODUCT_NAME = SDWebImageSwiftUI; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; + SWIFT_VERSION = 5.2; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + 90D4D09BCB6A4660E43ACBE9ECB6FE9A /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; @@ -582,7 +1574,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 15.5; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; ONLY_ACTIVE_ARCH = YES; @@ -595,7 +1587,7 @@ }; name = Debug; }; - 2DE0D8898245310716431F92FA4989FF /* Release */ = { + 9553C89E183877A5CB2F3C6801BEC129 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; @@ -645,7 +1637,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 15.5; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -657,12 +1649,10 @@ }; name = Release; }; - 80A3CE8162F57DA3B9DB6077CD82B60E /* Release */ = { + B0A83E2B33F87D1C7856C6DF93404465 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = A11B387255E344B5FAD743037E83D528 /* Pods-NetflixCloneApp.release.xcconfig */; + baseConfigurationReference = A8427414AB61A3B4BA0A76D6C1FF40E6 /* SDWebImage.debug.xcconfig */; buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO; - CLANG_ENABLE_OBJC_WEAK = NO; "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; @@ -671,33 +1661,31 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; - INFOPLIST_FILE = "Target Support Files/Pods-NetflixCloneApp/Pods-NetflixCloneApp-Info.plist"; + GCC_PREFIX_HEADER = "Target Support Files/SDWebImage/SDWebImage-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/SDWebImage/SDWebImage-Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 15.5; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", "@loader_path/Frameworks", ); - MACH_O_TYPE = staticlib; - MODULEMAP_FILE = "Target Support Files/Pods-NetflixCloneApp/Pods-NetflixCloneApp.modulemap"; - OTHER_LDFLAGS = ""; - OTHER_LIBTOOLFLAGS = ""; - PODS_ROOT = "$(SRCROOT)"; - PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; - PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + MODULEMAP_FILE = "Target Support Files/SDWebImage/SDWebImage.modulemap"; + PRODUCT_MODULE_NAME = SDWebImage; + PRODUCT_NAME = SDWebImage; SDKROOT = iphoneos; SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; - name = Release; + name = Debug; }; - A9E270F02BB686062B765E161991EEC9 /* Debug */ = { + C1B71E9D8085E417B39A79FA0317053C /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = EE0F773964510DA86D66FB3921E0BC7A /* Pods-NetflixCloneApp.debug.xcconfig */; + baseConfigurationReference = A11B387255E344B5FAD743037E83D528 /* Pods-NetflixCloneApp.release.xcconfig */; buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO; CLANG_ENABLE_OBJC_WEAK = NO; @@ -711,7 +1699,7 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = "Target Support Files/Pods-NetflixCloneApp/Pods-NetflixCloneApp-Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 15.5; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -727,14 +1715,15 @@ SDKROOT = iphoneos; SKIP_INSTALL = YES; TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; - name = Debug; + name = Release; }; CB1E425379B059DC63FD2C0BBC921D24 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = D2F7A58FA06E197A58AF664C8B5A998F /* TMDBSwift.debug.xcconfig */; + baseConfigurationReference = 8F8DC9897BDE7B2C8B9AE8CCF9D1D111 /* TMDBSwift.debug.xcconfig */; buildSettings = { "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; @@ -747,7 +1736,7 @@ GCC_PREFIX_HEADER = "Target Support Files/TMDBSwift/TMDBSwift-prefix.pch"; INFOPLIST_FILE = "Target Support Files/TMDBSwift/TMDBSwift-Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 13.0; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -768,7 +1757,7 @@ }; D7667442E4CF938B2053B1827B7D6764 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = D72CE8D91EC4F8BC4DE480BF91CC132B /* TMDBSwift.release.xcconfig */; + baseConfigurationReference = 6E442689AD59C6F6AC239F3B12C2066F /* TMDBSwift.release.xcconfig */; buildSettings = { "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; @@ -781,7 +1770,7 @@ GCC_PREFIX_HEADER = "Target Support Files/TMDBSwift/TMDBSwift-prefix.pch"; INFOPLIST_FILE = "Target Support Files/TMDBSwift/TMDBSwift-Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 13.0; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -804,6 +1793,15 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ + 200751771720D75DCD2386D5D465F2D3 /* Build configuration list for PBXNativeTarget "SDWebImageSwiftUI" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 19F05115E6D176E8F44A4D351A78D321 /* Debug */, + 5499CAA1230F6265F513BA06A2E08248 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; 232630FBD411E2F5AC94D5B509AF6D8E /* Build configuration list for PBXNativeTarget "TMDBSwift" */ = { isa = XCConfigurationList; buildConfigurations = ( @@ -813,20 +1811,29 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 282246F3F7236D458CE52F30FBAE711B /* Build configuration list for PBXNativeTarget "Pods-NetflixCloneApp" */ = { + 4821239608C13582E20E6DA73FD5F1F9 /* Build configuration list for PBXProject "Pods" */ = { isa = XCConfigurationList; buildConfigurations = ( - A9E270F02BB686062B765E161991EEC9 /* Debug */, - 80A3CE8162F57DA3B9DB6077CD82B60E /* Release */, + 90D4D09BCB6A4660E43ACBE9ECB6FE9A /* Debug */, + 9553C89E183877A5CB2F3C6801BEC129 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 4821239608C13582E20E6DA73FD5F1F9 /* Build configuration list for PBXProject "Pods" */ = { + BABD4A24CFCBE5B6FE4680AA062FCF04 /* Build configuration list for PBXNativeTarget "SDWebImage" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + B0A83E2B33F87D1C7856C6DF93404465 /* Debug */, + 00403A510F1318D67AA55C1B4DCB17FB /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + D933C84C91D46054D362B387716A5001 /* Build configuration list for PBXNativeTarget "Pods-NetflixCloneApp" */ = { isa = XCConfigurationList; buildConfigurations = ( - 09909ECBA13E8F70A928465E7F7A9A92 /* Debug */, - 2DE0D8898245310716431F92FA4989FF /* Release */, + 2BDC8ADFCF0A68A0DA11A316365D0E0F /* Debug */, + C1B71E9D8085E417B39A79FA0317053C /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; diff --git a/NetflixCloneApp/Pods/Pods.xcodeproj/xcuserdata/mangon.xcuserdatad/xcschemes/Pods-NetflixCloneApp.xcscheme b/NetflixCloneApp/Pods/Pods.xcodeproj/xcuserdata/mangon.xcuserdatad/xcschemes/Pods-NetflixCloneApp.xcscheme deleted file mode 100644 index 40dea37..0000000 --- a/NetflixCloneApp/Pods/Pods.xcodeproj/xcuserdata/mangon.xcuserdatad/xcschemes/Pods-NetflixCloneApp.xcscheme +++ /dev/null @@ -1,58 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/NetflixCloneApp/Pods/Pods.xcodeproj/xcuserdata/mangon.xcuserdatad/xcschemes/TMDBSwift.xcscheme b/NetflixCloneApp/Pods/Pods.xcodeproj/xcuserdata/mangon.xcuserdatad/xcschemes/TMDBSwift.xcscheme deleted file mode 100644 index d8300dd..0000000 --- a/NetflixCloneApp/Pods/Pods.xcodeproj/xcuserdata/mangon.xcuserdatad/xcschemes/TMDBSwift.xcscheme +++ /dev/null @@ -1,58 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/NetflixCloneApp/Pods/Pods.xcodeproj/xcuserdata/mangon.xcuserdatad/xcschemes/xcschememanagement.plist b/NetflixCloneApp/Pods/Pods.xcodeproj/xcuserdata/mangon.xcuserdatad/xcschemes/xcschememanagement.plist deleted file mode 100644 index 1e464db..0000000 --- a/NetflixCloneApp/Pods/Pods.xcodeproj/xcuserdata/mangon.xcuserdatad/xcschemes/xcschememanagement.plist +++ /dev/null @@ -1,25 +0,0 @@ - - - - - SchemeUserState - - Pods-NetflixCloneApp.xcscheme - - isShown - - orderHint - 0 - - TMDBSwift.xcscheme - - isShown - - orderHint - 1 - - - SuppressBuildableAutocreation - - - diff --git a/NetflixCloneApp/Pods/SDWebImage/LICENSE b/NetflixCloneApp/Pods/SDWebImage/LICENSE new file mode 100644 index 0000000..2f5785d --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/LICENSE @@ -0,0 +1,20 @@ +Copyright (c) 2009-2020 Olivier Poitrey rs@dailymotion.com + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + diff --git a/NetflixCloneApp/Pods/SDWebImage/README.md b/NetflixCloneApp/Pods/SDWebImage/README.md new file mode 100644 index 0000000..06e28e3 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/README.md @@ -0,0 +1,352 @@ +

+ +

+ + +[![Build Status](http://img.shields.io/travis/SDWebImage/SDWebImage/master.svg?style=flat)](https://travis-ci.org/SDWebImage/SDWebImage) +[![Pod Version](http://img.shields.io/cocoapods/v/SDWebImage.svg?style=flat)](http://cocoadocs.org/docsets/SDWebImage/) +[![Pod Platform](http://img.shields.io/cocoapods/p/SDWebImage.svg?style=flat)](http://cocoadocs.org/docsets/SDWebImage/) +[![Pod License](http://img.shields.io/cocoapods/l/SDWebImage.svg?style=flat)](https://www.apache.org/licenses/LICENSE-2.0.html) +[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-brightgreen.svg)](https://github.com/SDWebImage/SDWebImage) +[![SwiftPM compatible](https://img.shields.io/badge/SwiftPM-compatible-brightgreen.svg)](https://swift.org/package-manager/) +[![Mac Catalyst compatible](https://img.shields.io/badge/Catalyst-compatible-brightgreen.svg)](https://developer.apple.com/documentation/xcode/creating_a_mac_version_of_your_ipad_app/) +[![codecov](https://codecov.io/gh/SDWebImage/SDWebImage/branch/master/graph/badge.svg)](https://codecov.io/gh/SDWebImage/SDWebImage) + +This library provides an async image downloader with cache support. For convenience, we added categories for UI elements like `UIImageView`, `UIButton`, `MKAnnotationView`. + +## Features + +- [x] Categories for `UIImageView`, `UIButton`, `MKAnnotationView` adding web image and cache management +- [x] An asynchronous image downloader +- [x] An asynchronous memory + disk image caching with automatic cache expiration handling +- [x] A background image decompression to avoid frame rate drop +- [x] [Progressive image loading](https://github.com/SDWebImage/SDWebImage/wiki/Advanced-Usage#progressive-animation) (including animated image, like GIF showing in Web browser) +- [x] [Thumbnail image decoding](https://github.com/SDWebImage/SDWebImage/wiki/Advanced-Usage#thumbnail-decoding-550) to save CPU && Memory for large images +- [x] [Extendable image coder](https://github.com/SDWebImage/SDWebImage/wiki/Advanced-Usage#custom-coder-420) to support massive image format, like WebP +- [x] [Full-stack solution for animated images](https://github.com/SDWebImage/SDWebImage/wiki/Advanced-Usage#animated-image-50) which keep a balance between CPU && Memory +- [x] [Customizable and composable transformations](https://github.com/SDWebImage/SDWebImage/wiki/Advanced-Usage#transformer-50) can be applied to the images right after download +- [x] [Customizable and multiple caches system](https://github.com/SDWebImage/SDWebImage/wiki/Advanced-Usage#custom-cache-50) +- [x] [Customizable and multiple loaders system](https://github.com/SDWebImage/SDWebImage/wiki/Advanced-Usage#custom-loader-50) to expand the capabilities, like [Photos Library](https://github.com/SDWebImage/SDWebImagePhotosPlugin) +- [x] [Image loading indicators](https://github.com/SDWebImage/SDWebImage/wiki/How-to-use#use-view-indicator-50) +- [x] [Image loading transition animation](https://github.com/SDWebImage/SDWebImage/wiki/Advanced-Usage#image-transition-430) +- [x] A guarantee that the same URL won't be downloaded several times +- [x] A guarantee that bogus URLs won't be retried again and again +- [x] A guarantee that main thread will never be blocked +- [x] Modern Objective-C and better Swift support +- [x] Performances! + +## Supported Image Formats + +- Image formats supported by Apple system (JPEG, PNG, TIFF, BMP, ...), including [GIF](https://github.com/SDWebImage/SDWebImage/wiki/Advanced-Usage#gif-coder)/[APNG](https://github.com/SDWebImage/SDWebImage/wiki/Advanced-Usage#apng-coder) animated image +- HEIC format from iOS 11/macOS 10.13, including animated HEIC from iOS 13/macOS 10.15 via [SDWebImageHEICCoder](https://github.com/SDWebImage/SDWebImage/wiki/Advanced-Usage#heic-coder). For lower firmware, use coder plugin [SDWebImageHEIFCoder](https://github.com/SDWebImage/SDWebImageHEIFCoder) +- WebP format from iOS 14/macOS 11.0 via [SDWebImageAWebPCoder](https://github.com/SDWebImage/SDWebImage/wiki/Advanced-Usage#awebp-coder). For lower firmware, use coder plugin [SDWebImageWebPCoder](https://github.com/SDWebImage/SDWebImageWebPCoder) +- Support extendable coder plugins for new image formats like BPG, AVIF. And vector format like PDF, SVG. See all the list in [Image coder plugin List](https://github.com/SDWebImage/SDWebImage/wiki/Coder-Plugin-List) + +## Additional modules and Ecosystem + +In order to keep SDWebImage focused and limited to the core features, but also allow extensibility and custom behaviors, during the 5.0 refactoring we focused on modularizing the library. +As such, we have moved/built new modules to [SDWebImage org](https://github.com/SDWebImage). + +#### SwiftUI +[SwiftUI](https://developer.apple.com/xcode/swiftui/) is an innovative UI framework written in Swift to build user interfaces across all Apple platforms. + +We support SwiftUI by building a brand new framework called [SDWebImageSwiftUI](https://github.com/SDWebImage/SDWebImageSwiftUI), which is built on top of SDWebImage core functions (caching, loading and animation). + +The new framework introduce two View structs `WebImage` and `AnimatedImage` for SwiftUI world, `ImageIndicator` modifier for any View, `ImageManager` observable object for data source. Supports iOS 13+/macOS 10.15+/tvOS 13+/watchOS 6+ and Swift 5.1. Have a nice try and provide feedback! + +#### Coders for additional image formats +- [SDWebImageWebPCoder](https://github.com/SDWebImage/SDWebImageWebPCoder) - coder for WebP format. iOS 8+/macOS 10.10+. Based on [libwebp](https://chromium.googlesource.com/webm/libwebp) +- [SDWebImageHEIFCoder](https://github.com/SDWebImage/SDWebImageHEIFCoder) - coder for HEIF format, iOS 8+/macOS 10.10+ support. Based on [libheif](https://github.com/strukturag/libheif) +- [SDWebImageBPGCoder](https://github.com/SDWebImage/SDWebImageBPGCoder) - coder for BPG format. Based on [libbpg](https://github.com/mirrorer/libbpg) +- [SDWebImageFLIFCoder](https://github.com/SDWebImage/SDWebImageFLIFCoder) - coder for FLIF format. Based on [libflif](https://github.com/FLIF-hub/FLIF) +- [SDWebImageAVIFCoder](https://github.com/SDWebImage/SDWebImageAVIFCoder) - coder for AVIF (AV1-based) format. Based on [libavif](https://github.com/AOMediaCodec/libavif) +- [SDWebImagePDFCoder](https://github.com/SDWebImage/SDWebImagePDFCoder) - coder for PDF vector format. Using built-in frameworks +- [SDWebImageSVGCoder](https://github.com/SDWebImage/SDWebImageSVGCoder) - coder for SVG vector format. Using built-in frameworks +- [SDWebImageLottieCoder](https://github.com/SDWebImage/SDWebImageLottieCoder) - coder for Lottie animation format. Based on [rlottie](https://github.com/Samsung/rlottie) +- and more from community! + +#### Custom Caches +- [SDWebImageYYPlugin](https://github.com/SDWebImage/SDWebImageYYPlugin) - plugin to support caching images with [YYCache](https://github.com/ibireme/YYCache) +- [SDWebImagePINPlugin](https://github.com/SDWebImage/SDWebImagePINPlugin) - plugin to support caching images with [PINCache](https://github.com/pinterest/PINCache) + +#### Custom Loaders +- [SDWebImagePhotosPlugin](https://github.com/SDWebImage/SDWebImagePhotosPlugin) - plugin to support loading images from Photos (using `Photos.framework`) +- [SDWebImageLinkPlugin](https://github.com/SDWebImage/SDWebImageLinkPlugin) - plugin to support loading images from rich link url, as well as `LPLinkView` (using `LinkPresentation.framework`) + +#### Integration with 3rd party libraries +- [SDWebImageLottiePlugin](https://github.com/SDWebImage/SDWebImageLottiePlugin) - plugin to support [Lottie-iOS](https://github.com/airbnb/lottie-ios), vector animation rending with remote JSON files +- [SDWebImageSVGKitPlugin](https://github.com/SDWebImage/SDWebImageSVGKitPlugin) - plugin to support [SVGKit](https://github.com/SVGKit/SVGKit), SVG rendering using Core Animation, iOS 8+/macOS 10.10+ support +- [SDWebImageFLPlugin](https://github.com/SDWebImage/SDWebImageFLPlugin) - plugin to support [FLAnimatedImage](https://github.com/Flipboard/FLAnimatedImage) as the engine for animated GIFs +- [SDWebImageYYPlugin](https://github.com/SDWebImage/SDWebImageYYPlugin) - plugin to integrate [YYImage](https://github.com/ibireme/YYImage) & [YYCache](https://github.com/ibireme/YYCache) for image rendering & caching + +#### Community driven popular libraries +- [FirebaseUI](https://github.com/firebase/FirebaseUI-iOS) - Firebase Storage binding for query images, based on SDWebImage loader system +- [react-native-fast-image](https://github.com/DylanVann/react-native-fast-image) - React Native fast image component, based on SDWebImage Animated Image solution +- [flutter_image_compress](https://github.com/OpenFlutter/flutter_image_compress) - Flutter compresses image plugin, based on SDWebImage WebP coder plugin + +#### Make our lives easier +- [libwebp-Xcode](https://github.com/SDWebImage/libwebp-Xcode) - A wrapper for [libwebp](https://chromium.googlesource.com/webm/libwebp) + an Xcode project. +- [libheif-Xcode](https://github.com/SDWebImage/libheif-Xcode) - A wrapper for [libheif](https://github.com/strukturag/libheif) + an Xcode project. +- [libavif-Xcode](https://github.com/SDWebImage/libavif-Xcode) - A wrapper for [libavif](https://github.com/AOMediaCodec/libavif) + an Xcode project. +- and more third-party C/C++ image codec libraries with CocoaPods/Carthage/SwiftPM support. + +You can use those directly, or create similar components of your own, by using the customizable architecture of SDWebImage. + +## Requirements + +- iOS 9.0 or later +- tvOS 9.0 or later +- watchOS 2.0 or later +- macOS 10.11 or later (10.15 for Catalyst) +- Xcode 11.0 or later + +#### Backwards compatibility + +- For iOS 8, macOS 10.10 or Xcode < 11, use [any 5.x version up to 5.9.5](https://github.com/SDWebImage/SDWebImage/releases/tag/5.9.5) +- For iOS 7, macOS 10.9 or Xcode < 8, use [any 4.x version up to 4.4.6](https://github.com/SDWebImage/SDWebImage/releases/tag/4.4.6) +- For macOS 10.8, use [any 4.x version up to 4.3.0](https://github.com/SDWebImage/SDWebImage/releases/tag/4.3.0) +- For iOS 5 and 6, use [any 3.x version up to 3.7.6](https://github.com/SDWebImage/SDWebImage/releases/tag/3.7.6) +- For iOS < 5.0, please use the last [2.0 version](https://github.com/SDWebImage/SDWebImage/tree/2.0-compat). + +## Getting Started + +- Read this Readme doc +- Read the [How to use section](https://github.com/SDWebImage/SDWebImage#how-to-use) +- Read the [Latest Documentation](https://sdwebimage.github.io/) and [CocoaDocs for old version](http://cocoadocs.org/docsets/SDWebImage/) +- Try the example by downloading the project from Github or even easier using CocoaPods try `pod try SDWebImage` +- Read the [Installation Guide](https://github.com/SDWebImage/SDWebImage/wiki/Installation-Guide) +- Read the [SDWebImage 5.0 Migration Guide](https://github.com/SDWebImage/SDWebImage/blob/master/Docs/SDWebImage-5.0-Migration-guide.md) to get an idea of the changes from 4.x to 5.x +- Read the [SDWebImage 4.0 Migration Guide](https://github.com/SDWebImage/SDWebImage/blob/master/Docs/SDWebImage-4.0-Migration-guide.md) to get an idea of the changes from 3.x to 4.x +- Read the [Common Problems](https://github.com/SDWebImage/SDWebImage/wiki/Common-Problems) to find the solution for common problems +- Go to the [Wiki Page](https://github.com/SDWebImage/SDWebImage/wiki) for more information such as [Advanced Usage](https://github.com/SDWebImage/SDWebImage/wiki/Advanced-Usage) + +## Who Uses It +- Find out [who uses SDWebImage](https://github.com/SDWebImage/SDWebImage/wiki/Who-Uses-SDWebImage) and add your app to the list. + +## Communication + +- If you **need help**, use [Stack Overflow](http://stackoverflow.com/questions/tagged/sdwebimage). (Tag 'sdwebimage') +- If you'd like to **ask a general question**, use [Stack Overflow](http://stackoverflow.com/questions/tagged/sdwebimage). +- If you **found a bug**, open an issue. +- If you **have a feature request**, open an issue. +- If you **need IRC channel**, use [Gitter](https://gitter.im/SDWebImage/community). + +## Contribution + +- If you **want to contribute**, read the [Contributing Guide](https://github.com/SDWebImage/SDWebImage/blob/master/.github/CONTRIBUTING.md) +- For **development contribution guide**, read the [How-To-Contribute](https://github.com/SDWebImage/SDWebImage/wiki/How-to-Contribute) +- For **understanding code architecture**, read the [Code Architecture Analysis](https://github.com/SDWebImage/SDWebImage/wiki/5.6-Code-Architecture-Analysis) + +## How To Use + +* Objective-C + +```objective-c +#import +... +[imageView sd_setImageWithURL:[NSURL URLWithString:@"http://www.domain.com/path/to/image.jpg"] + placeholderImage:[UIImage imageNamed:@"placeholder.png"]]; +``` + +* Swift + +```swift +import SDWebImage + +imageView.sd_setImage(with: URL(string: "http://www.domain.com/path/to/image.jpg"), placeholderImage: UIImage(named: "placeholder.png")) +``` + +- For details about how to use the library and clear examples, see [The detailed How to use](https://github.com/SDWebImage/SDWebImage/blob/master/Docs/HowToUse.md) + +## Animated Images (GIF) support + +In 5.0, we introduced a brand new mechanism for supporting animated images. This includes animated image loading, rendering, decoding, and also supports customizations (for advanced users). + +This animated image solution is available for `iOS`/`tvOS`/`macOS`. The `SDAnimatedImage` is subclass of `UIImage/NSImage`, and `SDAnimatedImageView` is subclass of `UIImageView/NSImageView`, to make them compatible with the common frameworks APIs. + +The `SDAnimatedImageView` supports the familiar image loading category methods, works like drop-in replacement for `UIImageView/NSImageView`. + +Don't have `UIView` (like `WatchKit` or `CALayer`)? you can still use `SDAnimatedPlayer` the player engine for advanced playback and rendering. + +See [Animated Image](https://github.com/SDWebImage/SDWebImage/wiki/Advanced-Usage#animated-image-50) for more detailed information. + +* Objective-C + +```objective-c +SDAnimatedImageView *imageView = [SDAnimatedImageView new]; +SDAnimatedImage *animatedImage = [SDAnimatedImage imageNamed:@"image.gif"]; +imageView.image = animatedImage; +``` + +* Swift + +```swift +let imageView = SDAnimatedImageView() +let animatedImage = SDAnimatedImage(named: "image.gif") +imageView.image = animatedImage +``` + +#### FLAnimatedImage integration has its own dedicated repo +In order to clean up things and make our core project do less things, we decided that the `FLAnimatedImage` integration does not belong here. From 5.0, this will still be available, but under a dedicated repo [SDWebImageFLPlugin](https://github.com/SDWebImage/SDWebImageFLPlugin). + +## Installation + +There are four ways to use SDWebImage in your project: +- using CocoaPods +- using Carthage +- using Swift Package Manager +- manual install (build frameworks or embed Xcode Project) + +### Installation with CocoaPods + +[CocoaPods](http://cocoapods.org/) is a dependency manager for Objective-C, which automates and simplifies the process of using 3rd-party libraries in your projects. See the [Get Started](http://cocoapods.org/#get_started) section for more details. + +#### Podfile +``` +platform :ios, '8.0' +pod 'SDWebImage', '~> 5.0' +``` + +##### Swift and static framework + +Swift project previously had to use `use_frameworks!` to make all Pods into dynamic framework to let CocoaPods work. + +However, starting with `CocoaPods 1.5.0+` (with `Xcode 9+`), which supports to build both Objective-C && Swift code into static framework. You can use modular headers to use SDWebImage as static framework, without the need of `use_frameworks!`: + +``` +platform :ios, '8.0' +# Uncomment the next line when you want all Pods as static framework +# use_modular_headers! +pod 'SDWebImage', :modular_headers => true +``` + +See more on [CocoaPods 1.5.0 — Swift Static Libraries](http://blog.cocoapods.org/CocoaPods-1.5.0/) + +If not, you still need to add `use_frameworks!` to use SDWebImage as dynamic framework: + +``` +platform :ios, '8.0' +use_frameworks! +pod 'SDWebImage' +``` + +#### Subspecs + +There are 2 subspecs available now: `Core` and `MapKit` (this means you can install only some of the SDWebImage modules. By default, you get just `Core`, so if you need `MapKit`, you need to specify it). + +Podfile example: + +``` +pod 'SDWebImage/MapKit' +``` + +### Installation with Carthage + +[Carthage](https://github.com/Carthage/Carthage) is a lightweight dependency manager for Swift and Objective-C. It leverages CocoaTouch modules and is less invasive than CocoaPods. + +To install with carthage, follow the instruction on [Carthage](https://github.com/Carthage/Carthage) + +Carthage users can point to this repository and use whichever generated framework they'd like: SDWebImage, SDWebImageMapKit or both. + +Make the following entry in your Cartfile: `github "SDWebImage/SDWebImage"` +Then run `carthage update` +If this is your first time using Carthage in the project, you'll need to go through some additional steps as explained [over at Carthage](https://github.com/Carthage/Carthage#adding-frameworks-to-an-application). + +> NOTE: At this time, Carthage does not provide a way to build only specific repository subcomponents (or equivalent of CocoaPods's subspecs). All components and their dependencies will be built with the above command. However, you don't need to copy frameworks you aren't using into your project. For instance, if you aren't using `SDWebImageMapKit`, feel free to delete that framework from the Carthage Build directory after `carthage update` completes. + +### Installation with Swift Package Manager (Xcode 11+) + +[Swift Package Manager](https://swift.org/package-manager/) (SwiftPM) is a tool for managing the distribution of Swift code as well as C-family dependency. From Xcode 11, SwiftPM got natively integrated with Xcode. + +SDWebImage support SwiftPM from version 5.1.0. To use SwiftPM, you should use Xcode 11 to open your project. Click `File` -> `Swift Packages` -> `Add Package Dependency`, enter [SDWebImage repo's URL](https://github.com/SDWebImage/SDWebImage.git). Or you can login Xcode with your GitHub account and just type `SDWebImage` to search. + +After select the package, you can choose the dependency type (tagged version, branch or commit). Then Xcode will setup all the stuff for you. + +If you're a framework author and use SDWebImage as a dependency, update your `Package.swift` file: + +```swift +let package = Package( + // 5.1.0 ..< 6.0.0 + dependencies: [ + .package(url: "https://github.com/SDWebImage/SDWebImage.git", from: "5.1.0") + ], + // ... +) +``` + +### Manual Installation Guide + +See more on [Manual install Guide](https://github.com/SDWebImage/SDWebImage/wiki/Installation-Guide#manual-installation-guide) + +### Import headers in your source files + +In the source files where you need to use the library, import the umbrella header file: + +```objective-c +#import +``` + +It's also recommend to use the module import syntax, available for CocoaPods(enable `modular_headers`)/Carthage/SwiftPM. + +```objecitivec +@import SDWebImage; +``` + +### Build Project + +At this point your workspace should build without error. If you are having problem, post to the Issue and the +community can help you solve it. + +## Data Collection Practices +As required by the [App privacy details on the App Store](https://developer.apple.com/app-store/app-privacy-details/), here's SDWebImage's list of [Data Collection Practices](https://sdwebimage.github.io/DataCollection/index.html). + +## Author +- [Olivier Poitrey](https://github.com/rs) + +## Collaborators +- [Konstantinos K.](https://github.com/mythodeia) +- [Bogdan Poplauschi](https://github.com/bpoplauschi) +- [Chester Liu](https://github.com/skyline75489) +- [DreamPiggy](https://github.com/dreampiggy) +- [Wu Zhong](https://github.com/zhongwuzw) + +## Credits + +Thank you to all the people who have already contributed to SDWebImage. + +[![Contributors](https://opencollective.com/SDWebImage/contributors.svg?width=890)](https://github.com/SDWebImage/SDWebImage/graphs/contributors) + +## Licenses + +All source code is licensed under the [MIT License](https://github.com/SDWebImage/SDWebImage/blob/master/LICENSE). + +## Architecture + +To learn about SDWebImage's architecture design for contribution, read [The Core of SDWebImage v5.6 Architecture](https://github.com/SDWebImage/SDWebImage/wiki/5.6-Code-Architecture-Analysis). Thanks @looseyi for the post and translation. + +#### High Level Diagram +

+ +

+ +#### Overall Class Diagram +

+ +

+ +#### Top Level API Diagram +

+ +

+ +#### Main Sequence Diagram +

+ +

+ +#### More detailed diagrams +- [Manager API Diagram](https://raw.githubusercontent.com/SDWebImage/SDWebImage/master/Docs/Diagrams/SDWebImageManagerClassDiagram.png) +- [Coders API Diagram](https://raw.githubusercontent.com/SDWebImage/SDWebImage/master/Docs/Diagrams/SDWebImageCodersClassDiagram.png) +- [Loader API Diagram](https://raw.githubusercontent.com/SDWebImage/SDWebImage/master/Docs/Diagrams/SDWebImageLoaderClassDiagram.png) +- [Cache API Diagram](https://raw.githubusercontent.com/SDWebImage/SDWebImage/master/Docs/Diagrams/SDWebImageCacheClassDiagram.png) + diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/NSButton+WebCache.h b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/NSButton+WebCache.h new file mode 100644 index 0000000..5b8035b --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/NSButton+WebCache.h @@ -0,0 +1,340 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageCompat.h" + +#if SD_MAC + +#import "SDWebImageManager.h" + +/** + * Integrates SDWebImage async downloading and caching of remote images with NSButton. + */ +@interface NSButton (WebCache) + +#pragma mark - Image + +/** + * Get the current image URL. + */ +@property (nonatomic, strong, readonly, nullable) NSURL *sd_currentImageURL; + +/** + * Set the button `image` with an `url`. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + */ +- (void)sd_setImageWithURL:(nullable NSURL *)url NS_REFINED_FOR_SWIFT; + +/** + * Set the button `image` with an `url` and a placeholder. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param placeholder The image to be set initially, until the image request finishes. + * @see sd_setImageWithURL:placeholderImage:options: + */ +- (void)sd_setImageWithURL:(nullable NSURL *)url + placeholderImage:(nullable UIImage *)placeholder NS_REFINED_FOR_SWIFT; + +/** + * Set the button `image` with an `url`, placeholder and custom options. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param placeholder The image to be set initially, until the image request finishes. + * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. + */ +- (void)sd_setImageWithURL:(nullable NSURL *)url + placeholderImage:(nullable UIImage *)placeholder + options:(SDWebImageOptions)options NS_REFINED_FOR_SWIFT; + +/** + * Set the button `image` with an `url`, placeholder and custom options. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param placeholder The image to be set initially, until the image request finishes. + * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. + * @param context A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold. + */ +- (void)sd_setImageWithURL:(nullable NSURL *)url + placeholderImage:(nullable UIImage *)placeholder + options:(SDWebImageOptions)options + context:(nullable SDWebImageContext *)context; + +/** + * Set the button `image` with an `url`. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param completedBlock A block called when operation has been completed. This block has no return value + * and takes the requested UIImage as first parameter. In case of error the image parameter + * is nil and the second parameter may contain an NSError. The third parameter is a Boolean + * indicating if the image was retrieved from the local cache or from the network. + * The fourth parameter is the original image url. + */ +- (void)sd_setImageWithURL:(nullable NSURL *)url + completed:(nullable SDExternalCompletionBlock)completedBlock; + +/** + * Set the button `image` with an `url`, placeholder. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param placeholder The image to be set initially, until the image request finishes. + * @param completedBlock A block called when operation has been completed. This block has no return value + * and takes the requested UIImage as first parameter. In case of error the image parameter + * is nil and the second parameter may contain an NSError. The third parameter is a Boolean + * indicating if the image was retrieved from the local cache or from the network. + * The fourth parameter is the original image url. + */ +- (void)sd_setImageWithURL:(nullable NSURL *)url + placeholderImage:(nullable UIImage *)placeholder + completed:(nullable SDExternalCompletionBlock)completedBlock NS_REFINED_FOR_SWIFT; + +/** + * Set the button `image` with an `url`, placeholder and custom options. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param placeholder The image to be set initially, until the image request finishes. + * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. + * @param completedBlock A block called when operation has been completed. This block has no return value + * and takes the requested UIImage as first parameter. In case of error the image parameter + * is nil and the second parameter may contain an NSError. The third parameter is a Boolean + * indicating if the image was retrieved from the local cache or from the network. + * The fourth parameter is the original image url. + */ +- (void)sd_setImageWithURL:(nullable NSURL *)url + placeholderImage:(nullable UIImage *)placeholder + options:(SDWebImageOptions)options + completed:(nullable SDExternalCompletionBlock)completedBlock; + +/** + * Set the button `image` with an `url`, placeholder and custom options. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param placeholder The image to be set initially, until the image request finishes. + * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. + * @param progressBlock A block called while image is downloading + * @note the progress block is executed on a background queue + * @param completedBlock A block called when operation has been completed. This block has no return value + * and takes the requested UIImage as first parameter. In case of error the image parameter + * is nil and the second parameter may contain an NSError. The third parameter is a Boolean + * indicating if the image was retrieved from the local cache or from the network. + * The fourth parameter is the original image url. + */ +- (void)sd_setImageWithURL:(nullable NSURL *)url + placeholderImage:(nullable UIImage *)placeholder + options:(SDWebImageOptions)options + progress:(nullable SDImageLoaderProgressBlock)progressBlock + completed:(nullable SDExternalCompletionBlock)completedBlock; + +/** + * Set the button `image` with an `url`, placeholder and custom options. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param placeholder The image to be set initially, until the image request finishes. + * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. + * @param context A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold. + * @param progressBlock A block called while image is downloading + * @note the progress block is executed on a background queue + * @param completedBlock A block called when operation has been completed. This block has no return value + * and takes the requested UIImage as first parameter. In case of error the image parameter + * is nil and the second parameter may contain an NSError. The third parameter is a Boolean + * indicating if the image was retrieved from the local cache or from the network. + * The fourth parameter is the original image url. + */ +- (void)sd_setImageWithURL:(nullable NSURL *)url + placeholderImage:(nullable UIImage *)placeholder + options:(SDWebImageOptions)options + context:(nullable SDWebImageContext *)context + progress:(nullable SDImageLoaderProgressBlock)progressBlock + completed:(nullable SDExternalCompletionBlock)completedBlock; + +#pragma mark - Alternate Image + +/** + * Get the current alternateImage URL. + */ +@property (nonatomic, strong, readonly, nullable) NSURL *sd_currentAlternateImageURL; + +/** + * Set the button `alternateImage` with an `url`. + * + * The download is asynchronous and cached. + * + * @param url The url for the alternateImage. + */ +- (void)sd_setAlternateImageWithURL:(nullable NSURL *)url NS_REFINED_FOR_SWIFT; + +/** + * Set the button `alternateImage` with an `url` and a placeholder. + * + * The download is asynchronous and cached. + * + * @param url The url for the alternateImage. + * @param placeholder The alternateImage to be set initially, until the alternateImage request finishes. + * @see sd_setAlternateImageWithURL:placeholderImage:options: + */ +- (void)sd_setAlternateImageWithURL:(nullable NSURL *)url + placeholderImage:(nullable UIImage *)placeholder NS_REFINED_FOR_SWIFT; + +/** + * Set the button `alternateImage` with an `url`, placeholder and custom options. + * + * The download is asynchronous and cached. + * + * @param url The url for the alternateImage. + * @param placeholder The alternateImage to be set initially, until the alternateImage request finishes. + * @param options The options to use when downloading the alternateImage. @see SDWebImageOptions for the possible values. + */ +- (void)sd_setAlternateImageWithURL:(nullable NSURL *)url + placeholderImage:(nullable UIImage *)placeholder + options:(SDWebImageOptions)options NS_REFINED_FOR_SWIFT; + +/** + * Set the button `alternateImage` with an `url`, placeholder, custom options and context. + * + * The download is asynchronous and cached. + * + * @param url The url for the alternateImage. + * @param placeholder The alternateImage to be set initially, until the alternateImage request finishes. + * @param options The options to use when downloading the alternateImage. @see SDWebImageOptions for the possible values. + * @param context A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold. + */ +- (void)sd_setAlternateImageWithURL:(nullable NSURL *)url + placeholderImage:(nullable UIImage *)placeholder + options:(SDWebImageOptions)options + context:(nullable SDWebImageContext *)context; + +/** + * Set the button `alternateImage` with an `url`. + * + * The download is asynchronous and cached. + * + * @param url The url for the alternateImage. + * @param completedBlock A block called when operation has been completed. This block has no return value + * and takes the requested UIImage as first parameter. In case of error the alternateImage parameter + * is nil and the second parameter may contain an NSError. The third parameter is a Boolean + * indicating if the alternateImage was retrieved from the local cache or from the network. + * The fourth parameter is the original alternateImage url. + */ +- (void)sd_setAlternateImageWithURL:(nullable NSURL *)url + completed:(nullable SDExternalCompletionBlock)completedBlock; + +/** + * Set the button `alternateImage` with an `url`, placeholder. + * + * The download is asynchronous and cached. + * + * @param url The url for the alternateImage. + * @param placeholder The alternateImage to be set initially, until the alternateImage request finishes. + * @param completedBlock A block called when operation has been completed. This block has no return value + * and takes the requested UIImage as first parameter. In case of error the alternateImage parameter + * is nil and the second parameter may contain an NSError. The third parameter is a Boolean + * indicating if the alternateImage was retrieved from the local cache or from the network. + * The fourth parameter is the original alternateImage url. + */ +- (void)sd_setAlternateImageWithURL:(nullable NSURL *)url + placeholderImage:(nullable UIImage *)placeholder + completed:(nullable SDExternalCompletionBlock)completedBlock NS_REFINED_FOR_SWIFT; + +/** + * Set the button `alternateImage` with an `url`, placeholder and custom options. + * + * The download is asynchronous and cached. + * + * @param url The url for the alternateImage. + * @param placeholder The alternateImage to be set initially, until the alternateImage request finishes. + * @param options The options to use when downloading the alternateImage. @see SDWebImageOptions for the possible values. + * @param completedBlock A block called when operation has been completed. This block has no return value + * and takes the requested UIImage as first parameter. In case of error the alternateImage parameter + * is nil and the second parameter may contain an NSError. The third parameter is a Boolean + * indicating if the alternateImage was retrieved from the local cache or from the network. + * The fourth parameter is the original alternateImage url. + */ +- (void)sd_setAlternateImageWithURL:(nullable NSURL *)url + placeholderImage:(nullable UIImage *)placeholder + options:(SDWebImageOptions)options + completed:(nullable SDExternalCompletionBlock)completedBlock; + +/** + * Set the button `alternateImage` with an `url`, placeholder and custom options. + * + * The download is asynchronous and cached. + * + * @param url The url for the alternateImage. + * @param placeholder The alternateImage to be set initially, until the alternateImage request finishes. + * @param options The options to use when downloading the alternateImage. @see SDWebImageOptions for the possible values. + * @param progressBlock A block called while alternateImage is downloading + * @note the progress block is executed on a background queue + * @param completedBlock A block called when operation has been completed. This block has no return value + * and takes the requested UIImage as first parameter. In case of error the alternateImage parameter + * is nil and the second parameter may contain an NSError. The third parameter is a Boolean + * indicating if the alternateImage was retrieved from the local cache or from the network. + * The fourth parameter is the original alternateImage url. + */ +- (void)sd_setAlternateImageWithURL:(nullable NSURL *)url + placeholderImage:(nullable UIImage *)placeholder + options:(SDWebImageOptions)options + progress:(nullable SDImageLoaderProgressBlock)progressBlock + completed:(nullable SDExternalCompletionBlock)completedBlock; + +/** + * Set the button `alternateImage` with an `url`, placeholder, custom options and context. + * + * The download is asynchronous and cached. + * + * @param url The url for the alternateImage. + * @param placeholder The alternateImage to be set initially, until the alternateImage request finishes. + * @param options The options to use when downloading the alternateImage. @see SDWebImageOptions for the possible values. + * @param context A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold. + * @param progressBlock A block called while alternateImage is downloading + * @note the progress block is executed on a background queue + * @param completedBlock A block called when operation has been completed. This block has no return value + * and takes the requested UIImage as first parameter. In case of error the alternateImage parameter + * is nil and the second parameter may contain an NSError. The third parameter is a Boolean + * indicating if the alternateImage was retrieved from the local cache or from the network. + * The fourth parameter is the original alternateImage url. + */ +- (void)sd_setAlternateImageWithURL:(nullable NSURL *)url + placeholderImage:(nullable UIImage *)placeholder + options:(SDWebImageOptions)options + context:(nullable SDWebImageContext *)context + progress:(nullable SDImageLoaderProgressBlock)progressBlock + completed:(nullable SDExternalCompletionBlock)completedBlock; + +#pragma mark - Cancel + +/** + * Cancel the current image download + */ +- (void)sd_cancelCurrentImageLoad; + +/** + * Cancel the current alternateImage download + */ +- (void)sd_cancelCurrentAlternateImageLoad; + +@end + +#endif diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/NSButton+WebCache.m b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/NSButton+WebCache.m new file mode 100644 index 0000000..0c083e5 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/NSButton+WebCache.m @@ -0,0 +1,172 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "NSButton+WebCache.h" + +#if SD_MAC + +#import "objc/runtime.h" +#import "UIView+WebCacheOperation.h" +#import "UIView+WebCache.h" +#import "SDInternalMacros.h" + +static NSString * const SDAlternateImageOperationKey = @"NSButtonAlternateImageOperation"; + +@implementation NSButton (WebCache) + +#pragma mark - Image + +- (void)sd_setImageWithURL:(nullable NSURL *)url { + [self sd_setImageWithURL:url placeholderImage:nil options:0 progress:nil completed:nil]; +} + +- (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder { + [self sd_setImageWithURL:url placeholderImage:placeholder options:0 progress:nil completed:nil]; +} + +- (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options { + [self sd_setImageWithURL:url placeholderImage:placeholder options:options progress:nil completed:nil]; +} + +- (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options context:(nullable SDWebImageContext *)context { + [self sd_setImageWithURL:url placeholderImage:placeholder options:options context:context progress:nil completed:nil]; +} + +- (void)sd_setImageWithURL:(nullable NSURL *)url completed:(nullable SDExternalCompletionBlock)completedBlock { + [self sd_setImageWithURL:url placeholderImage:nil options:0 progress:nil completed:completedBlock]; +} + +- (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder completed:(nullable SDExternalCompletionBlock)completedBlock { + [self sd_setImageWithURL:url placeholderImage:placeholder options:0 progress:nil completed:completedBlock]; +} + +- (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options completed:(nullable SDExternalCompletionBlock)completedBlock { + [self sd_setImageWithURL:url placeholderImage:placeholder options:options progress:nil completed:completedBlock]; +} + +- (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options progress:(nullable SDImageLoaderProgressBlock)progressBlock completed:(nullable SDExternalCompletionBlock)completedBlock { + [self sd_setImageWithURL:url placeholderImage:placeholder options:options context:nil progress:progressBlock completed:completedBlock]; +} + +- (void)sd_setImageWithURL:(nullable NSURL *)url + placeholderImage:(nullable UIImage *)placeholder + options:(SDWebImageOptions)options + context:(nullable SDWebImageContext *)context + progress:(nullable SDImageLoaderProgressBlock)progressBlock + completed:(nullable SDExternalCompletionBlock)completedBlock { + self.sd_currentImageURL = url; + [self sd_internalSetImageWithURL:url + placeholderImage:placeholder + options:options + context:context + setImageBlock:nil + progress:progressBlock + completed:^(NSImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL) { + if (completedBlock) { + completedBlock(image, error, cacheType, imageURL); + } + }]; +} + +#pragma mark - Alternate Image + +- (void)sd_setAlternateImageWithURL:(nullable NSURL *)url { + [self sd_setAlternateImageWithURL:url placeholderImage:nil options:0 progress:nil completed:nil]; +} + +- (void)sd_setAlternateImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder { + [self sd_setAlternateImageWithURL:url placeholderImage:placeholder options:0 progress:nil completed:nil]; +} + +- (void)sd_setAlternateImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options { + [self sd_setAlternateImageWithURL:url placeholderImage:placeholder options:options progress:nil completed:nil]; +} + +- (void)sd_setAlternateImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options context:(nullable SDWebImageContext *)context { + [self sd_setAlternateImageWithURL:url placeholderImage:placeholder options:options context:context progress:nil completed:nil]; +} + +- (void)sd_setAlternateImageWithURL:(nullable NSURL *)url completed:(nullable SDExternalCompletionBlock)completedBlock { + [self sd_setAlternateImageWithURL:url placeholderImage:nil options:0 progress:nil completed:completedBlock]; +} + +- (void)sd_setAlternateImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder completed:(nullable SDExternalCompletionBlock)completedBlock { + [self sd_setAlternateImageWithURL:url placeholderImage:placeholder options:0 progress:nil completed:completedBlock]; +} + +- (void)sd_setAlternateImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options completed:(nullable SDExternalCompletionBlock)completedBlock { + [self sd_setAlternateImageWithURL:url placeholderImage:placeholder options:options progress:nil completed:completedBlock]; +} + +- (void)sd_setAlternateImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options progress:(nullable SDImageLoaderProgressBlock)progressBlock completed:(nullable SDExternalCompletionBlock)completedBlock { + [self sd_setAlternateImageWithURL:url placeholderImage:placeholder options:options context:nil progress:progressBlock completed:completedBlock]; +} + +- (void)sd_setAlternateImageWithURL:(nullable NSURL *)url + placeholderImage:(nullable UIImage *)placeholder + options:(SDWebImageOptions)options + context:(nullable SDWebImageContext *)context + progress:(nullable SDImageLoaderProgressBlock)progressBlock + completed:(nullable SDExternalCompletionBlock)completedBlock { + self.sd_currentAlternateImageURL = url; + + SDWebImageMutableContext *mutableContext; + if (context) { + mutableContext = [context mutableCopy]; + } else { + mutableContext = [NSMutableDictionary dictionary]; + } + mutableContext[SDWebImageContextSetImageOperationKey] = SDAlternateImageOperationKey; + @weakify(self); + [self sd_internalSetImageWithURL:url + placeholderImage:placeholder + options:options + context:mutableContext + setImageBlock:^(NSImage * _Nullable image, NSData * _Nullable imageData, SDImageCacheType cacheType, NSURL * _Nullable imageURL) { + @strongify(self); + self.alternateImage = image; + } + progress:progressBlock + completed:^(NSImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL) { + if (completedBlock) { + completedBlock(image, error, cacheType, imageURL); + } + }]; +} + +#pragma mark - Cancel + +- (void)sd_cancelCurrentImageLoad { + [self sd_cancelImageLoadOperationWithKey:NSStringFromClass([self class])]; +} + +- (void)sd_cancelCurrentAlternateImageLoad { + [self sd_cancelImageLoadOperationWithKey:SDAlternateImageOperationKey]; +} + +#pragma mark - Private + +- (NSURL *)sd_currentImageURL { + return objc_getAssociatedObject(self, @selector(sd_currentImageURL)); +} + +- (void)setSd_currentImageURL:(NSURL *)sd_currentImageURL { + objc_setAssociatedObject(self, @selector(sd_currentImageURL), sd_currentImageURL, OBJC_ASSOCIATION_RETAIN_NONATOMIC); +} + +- (NSURL *)sd_currentAlternateImageURL { + return objc_getAssociatedObject(self, @selector(sd_currentAlternateImageURL)); +} + +- (void)setSd_currentAlternateImageURL:(NSURL *)sd_currentAlternateImageURL { + objc_setAssociatedObject(self, @selector(sd_currentAlternateImageURL), sd_currentAlternateImageURL, OBJC_ASSOCIATION_RETAIN_NONATOMIC); +} + +@end + +#endif diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/NSData+ImageContentType.h b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/NSData+ImageContentType.h new file mode 100644 index 0000000..fb5ba60 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/NSData+ImageContentType.h @@ -0,0 +1,61 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * (c) Fabrice Aneche + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import +#import "SDWebImageCompat.h" + +/** + You can use switch case like normal enum. It's also recommended to add a default case. You should not assume anything about the raw value. + For custom coder plugin, it can also extern the enum for supported format. See `SDImageCoder` for more detailed information. + */ +typedef NSInteger SDImageFormat NS_TYPED_EXTENSIBLE_ENUM; +static const SDImageFormat SDImageFormatUndefined = -1; +static const SDImageFormat SDImageFormatJPEG = 0; +static const SDImageFormat SDImageFormatPNG = 1; +static const SDImageFormat SDImageFormatGIF = 2; +static const SDImageFormat SDImageFormatTIFF = 3; +static const SDImageFormat SDImageFormatWebP = 4; +static const SDImageFormat SDImageFormatHEIC = 5; +static const SDImageFormat SDImageFormatHEIF = 6; +static const SDImageFormat SDImageFormatPDF = 7; +static const SDImageFormat SDImageFormatSVG = 8; + +/** + NSData category about the image content type and UTI. + */ +@interface NSData (ImageContentType) + +/** + * Return image format + * + * @param data the input image data + * + * @return the image format as `SDImageFormat` (enum) + */ ++ (SDImageFormat)sd_imageFormatForImageData:(nullable NSData *)data; + +/** + * Convert SDImageFormat to UTType + * + * @param format Format as SDImageFormat + * @return The UTType as CFStringRef + * @note For unknown format, `kSDUTTypeImage` abstract type will return + */ ++ (nonnull CFStringRef)sd_UTTypeFromImageFormat:(SDImageFormat)format CF_RETURNS_NOT_RETAINED NS_SWIFT_NAME(sd_UTType(from:)); + +/** + * Convert UTType to SDImageFormat + * + * @param uttype The UTType as CFStringRef + * @return The Format as SDImageFormat + * @note For unknown type, `SDImageFormatUndefined` will return + */ ++ (SDImageFormat)sd_imageFormatFromUTType:(nonnull CFStringRef)uttype; + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/NSData+ImageContentType.m b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/NSData+ImageContentType.m new file mode 100644 index 0000000..070dfdf --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/NSData+ImageContentType.m @@ -0,0 +1,153 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * (c) Fabrice Aneche + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "NSData+ImageContentType.h" +#if SD_MAC +#import +#else +#import +#endif +#import "SDImageIOAnimatedCoderInternal.h" + +#define kSVGTagEnd @"" + +@implementation NSData (ImageContentType) + ++ (SDImageFormat)sd_imageFormatForImageData:(nullable NSData *)data { + if (!data) { + return SDImageFormatUndefined; + } + + // File signatures table: http://www.garykessler.net/library/file_sigs.html + uint8_t c; + [data getBytes:&c length:1]; + switch (c) { + case 0xFF: + return SDImageFormatJPEG; + case 0x89: + return SDImageFormatPNG; + case 0x47: + return SDImageFormatGIF; + case 0x49: + case 0x4D: + return SDImageFormatTIFF; + case 0x52: { + if (data.length >= 12) { + //RIFF....WEBP + NSString *testString = [[NSString alloc] initWithData:[data subdataWithRange:NSMakeRange(0, 12)] encoding:NSASCIIStringEncoding]; + if ([testString hasPrefix:@"RIFF"] && [testString hasSuffix:@"WEBP"]) { + return SDImageFormatWebP; + } + } + break; + } + case 0x00: { + if (data.length >= 12) { + //....ftypheic ....ftypheix ....ftyphevc ....ftyphevx + NSString *testString = [[NSString alloc] initWithData:[data subdataWithRange:NSMakeRange(4, 8)] encoding:NSASCIIStringEncoding]; + if ([testString isEqualToString:@"ftypheic"] + || [testString isEqualToString:@"ftypheix"] + || [testString isEqualToString:@"ftyphevc"] + || [testString isEqualToString:@"ftyphevx"]) { + return SDImageFormatHEIC; + } + //....ftypmif1 ....ftypmsf1 + if ([testString isEqualToString:@"ftypmif1"] || [testString isEqualToString:@"ftypmsf1"]) { + return SDImageFormatHEIF; + } + } + break; + } + case 0x25: { + if (data.length >= 4) { + //%PDF + NSString *testString = [[NSString alloc] initWithData:[data subdataWithRange:NSMakeRange(1, 3)] encoding:NSASCIIStringEncoding]; + if ([testString isEqualToString:@"PDF"]) { + return SDImageFormatPDF; + } + } + } + case 0x3C: { + // Check end with SVG tag + if ([data rangeOfData:[kSVGTagEnd dataUsingEncoding:NSUTF8StringEncoding] options:NSDataSearchBackwards range: NSMakeRange(data.length - MIN(100, data.length), MIN(100, data.length))].location != NSNotFound) { + return SDImageFormatSVG; + } + } + } + return SDImageFormatUndefined; +} + ++ (nonnull CFStringRef)sd_UTTypeFromImageFormat:(SDImageFormat)format { + CFStringRef UTType; + switch (format) { + case SDImageFormatJPEG: + UTType = kSDUTTypeJPEG; + break; + case SDImageFormatPNG: + UTType = kSDUTTypePNG; + break; + case SDImageFormatGIF: + UTType = kSDUTTypeGIF; + break; + case SDImageFormatTIFF: + UTType = kSDUTTypeTIFF; + break; + case SDImageFormatWebP: + UTType = kSDUTTypeWebP; + break; + case SDImageFormatHEIC: + UTType = kSDUTTypeHEIC; + break; + case SDImageFormatHEIF: + UTType = kSDUTTypeHEIF; + break; + case SDImageFormatPDF: + UTType = kSDUTTypePDF; + break; + case SDImageFormatSVG: + UTType = kSDUTTypeSVG; + break; + default: + // default is kUTTypeImage abstract type + UTType = kSDUTTypeImage; + break; + } + return UTType; +} + ++ (SDImageFormat)sd_imageFormatFromUTType:(CFStringRef)uttype { + if (!uttype) { + return SDImageFormatUndefined; + } + SDImageFormat imageFormat; + if (CFStringCompare(uttype, kSDUTTypeJPEG, 0) == kCFCompareEqualTo) { + imageFormat = SDImageFormatJPEG; + } else if (CFStringCompare(uttype, kSDUTTypePNG, 0) == kCFCompareEqualTo) { + imageFormat = SDImageFormatPNG; + } else if (CFStringCompare(uttype, kSDUTTypeGIF, 0) == kCFCompareEqualTo) { + imageFormat = SDImageFormatGIF; + } else if (CFStringCompare(uttype, kSDUTTypeTIFF, 0) == kCFCompareEqualTo) { + imageFormat = SDImageFormatTIFF; + } else if (CFStringCompare(uttype, kSDUTTypeWebP, 0) == kCFCompareEqualTo) { + imageFormat = SDImageFormatWebP; + } else if (CFStringCompare(uttype, kSDUTTypeHEIC, 0) == kCFCompareEqualTo) { + imageFormat = SDImageFormatHEIC; + } else if (CFStringCompare(uttype, kSDUTTypeHEIF, 0) == kCFCompareEqualTo) { + imageFormat = SDImageFormatHEIF; + } else if (CFStringCompare(uttype, kSDUTTypePDF, 0) == kCFCompareEqualTo) { + imageFormat = SDImageFormatPDF; + } else if (CFStringCompare(uttype, kSDUTTypeSVG, 0) == kCFCompareEqualTo) { + imageFormat = SDImageFormatSVG; + } else { + imageFormat = SDImageFormatUndefined; + } + return imageFormat; +} + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/NSImage+Compatibility.h b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/NSImage+Compatibility.h new file mode 100644 index 0000000..0a562cc --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/NSImage+Compatibility.h @@ -0,0 +1,67 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageCompat.h" + +#if SD_MAC + +/** + This category is provided to easily write cross-platform(AppKit/UIKit) code. For common usage, see `UIImage+Metadata.h`. + */ +@interface NSImage (Compatibility) + +/** +The underlying Core Graphics image object. This will actually use `CGImageForProposedRect` with the image size. + */ +@property (nonatomic, readonly, nullable) CGImageRef CGImage; +/** + The underlying Core Image data. This will actually use `bestRepresentationForRect` with the image size to find the `NSCIImageRep`. + */ +@property (nonatomic, readonly, nullable) CIImage *CIImage; +/** + The scale factor of the image. This wil actually use `bestRepresentationForRect` with image size and pixel size to calculate the scale factor. If failed, use the default value 1.0. Should be greater than or equal to 1.0. + */ +@property (nonatomic, readonly) CGFloat scale; + +// These are convenience methods to make AppKit's `NSImage` match UIKit's `UIImage` behavior. The scale factor should be greater than or equal to 1.0. + +/** + Returns an image object with the scale factor and orientation. The representation is created from the Core Graphics image object. + @note The difference between this and `initWithCGImage:size` is that `initWithCGImage:size` will actually create a `NSCGImageSnapshotRep` representation and always use `backingScaleFactor` as scale factor. So we should avoid it and use `NSBitmapImageRep` with `initWithCGImage:` instead. + @note The difference between this and UIKit's `UIImage` equivalent method is the way to process orientation. If the provided image orientation is not equal to Up orientation, this method will firstly rotate the CGImage to the correct orientation to work compatible with `NSImageView`. However, UIKit will not actually rotate CGImage and just store it as `imageOrientation` property. + + @param cgImage A Core Graphics image object + @param scale The image scale factor + @param orientation The orientation of the image data + @return The image object + */ +- (nonnull instancetype)initWithCGImage:(nonnull CGImageRef)cgImage scale:(CGFloat)scale orientation:(CGImagePropertyOrientation)orientation; + +/** + Initializes and returns an image object with the specified Core Image object. The representation is `NSCIImageRep`. + + @param ciImage A Core Image image object + @param scale The image scale factor + @param orientation The orientation of the image data + @return The image object + */ +- (nonnull instancetype)initWithCIImage:(nonnull CIImage *)ciImage scale:(CGFloat)scale orientation:(CGImagePropertyOrientation)orientation; + +/** + Returns an image object with the scale factor. The representation is created from the image data. + @note The difference between these this and `initWithData:` is that `initWithData:` will always use `backingScaleFactor` as scale factor. + + @param data The image data + @param scale The image scale factor + @return The image object + */ +- (nullable instancetype)initWithData:(nonnull NSData *)data scale:(CGFloat)scale; + +@end + +#endif diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/NSImage+Compatibility.m b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/NSImage+Compatibility.m new file mode 100644 index 0000000..ce67151 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/NSImage+Compatibility.m @@ -0,0 +1,120 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "NSImage+Compatibility.h" + +#if SD_MAC + +#import "SDImageCoderHelper.h" + +@implementation NSImage (Compatibility) + +- (nullable CGImageRef)CGImage { + NSRect imageRect = NSMakeRect(0, 0, self.size.width, self.size.height); + CGImageRef cgImage = [self CGImageForProposedRect:&imageRect context:nil hints:nil]; + return cgImage; +} + +- (nullable CIImage *)CIImage { + NSRect imageRect = NSMakeRect(0, 0, self.size.width, self.size.height); + NSImageRep *imageRep = [self bestRepresentationForRect:imageRect context:nil hints:nil]; + if (![imageRep isKindOfClass:NSCIImageRep.class]) { + return nil; + } + return ((NSCIImageRep *)imageRep).CIImage; +} + +- (CGFloat)scale { + CGFloat scale = 1; + NSRect imageRect = NSMakeRect(0, 0, self.size.width, self.size.height); + NSImageRep *imageRep = [self bestRepresentationForRect:imageRect context:nil hints:nil]; + CGFloat width = imageRep.size.width; + CGFloat height = imageRep.size.height; + CGFloat pixelWidth = (CGFloat)imageRep.pixelsWide; + CGFloat pixelHeight = (CGFloat)imageRep.pixelsHigh; + if (width > 0 && height > 0) { + CGFloat widthScale = pixelWidth / width; + CGFloat heightScale = pixelHeight / height; + if (widthScale == heightScale && widthScale >= 1) { + // Protect because there may be `NSImageRepMatchesDevice` (0) + scale = widthScale; + } + } + + return scale; +} + +- (instancetype)initWithCGImage:(nonnull CGImageRef)cgImage scale:(CGFloat)scale orientation:(CGImagePropertyOrientation)orientation { + NSBitmapImageRep *imageRep; + if (orientation != kCGImagePropertyOrientationUp) { + // AppKit design is different from UIKit. Where CGImage based image rep does not respect to any orientation. Only data based image rep which contains the EXIF metadata can automatically detect orientation. + // This should be nonnull, until the memory is exhausted cause `CGBitmapContextCreate` failed. + CGImageRef rotatedCGImage = [SDImageCoderHelper CGImageCreateDecoded:cgImage orientation:orientation]; + imageRep = [[NSBitmapImageRep alloc] initWithCGImage:rotatedCGImage]; + CGImageRelease(rotatedCGImage); + } else { + imageRep = [[NSBitmapImageRep alloc] initWithCGImage:cgImage]; + } + if (scale < 1) { + scale = 1; + } + CGFloat pixelWidth = imageRep.pixelsWide; + CGFloat pixelHeight = imageRep.pixelsHigh; + NSSize size = NSMakeSize(pixelWidth / scale, pixelHeight / scale); + self = [self initWithSize:size]; + if (self) { + imageRep.size = size; + [self addRepresentation:imageRep]; + } + return self; +} + +- (instancetype)initWithCIImage:(nonnull CIImage *)ciImage scale:(CGFloat)scale orientation:(CGImagePropertyOrientation)orientation { + NSCIImageRep *imageRep; + if (orientation != kCGImagePropertyOrientationUp) { + CIImage *rotatedCIImage = [ciImage imageByApplyingOrientation:orientation]; + imageRep = [[NSCIImageRep alloc] initWithCIImage:rotatedCIImage]; + } else { + imageRep = [[NSCIImageRep alloc] initWithCIImage:ciImage]; + } + if (scale < 1) { + scale = 1; + } + CGFloat pixelWidth = imageRep.pixelsWide; + CGFloat pixelHeight = imageRep.pixelsHigh; + NSSize size = NSMakeSize(pixelWidth / scale, pixelHeight / scale); + self = [self initWithSize:size]; + if (self) { + imageRep.size = size; + [self addRepresentation:imageRep]; + } + return self; +} + +- (instancetype)initWithData:(nonnull NSData *)data scale:(CGFloat)scale { + NSBitmapImageRep *imageRep = [[NSBitmapImageRep alloc] initWithData:data]; + if (!imageRep) { + return nil; + } + if (scale < 1) { + scale = 1; + } + CGFloat pixelWidth = imageRep.pixelsWide; + CGFloat pixelHeight = imageRep.pixelsHigh; + NSSize size = NSMakeSize(pixelWidth / scale, pixelHeight / scale); + self = [self initWithSize:size]; + if (self) { + imageRep.size = size; + [self addRepresentation:imageRep]; + } + return self; +} + +@end + +#endif diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImage.h b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImage.h new file mode 100644 index 0000000..2e208cd --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImage.h @@ -0,0 +1,114 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageCompat.h" +#import "SDImageCoder.h" + + +/** + This is the protocol for SDAnimatedImage class only but not for SDAnimatedImageCoder. If you want to provide a custom animated image class with full advanced function, you can conform to this instead of the base protocol. + */ +@protocol SDAnimatedImage + +@required +/** + Initializes and returns the image object with the specified data, scale factor and possible animation decoding options. + @note We use this to create animated image instance for normal animation decoding. + + @param data The data object containing the image data. + @param scale The scale factor to assume when interpreting the image data. Applying a scale factor of 1.0 results in an image whose size matches the pixel-based dimensions of the image. Applying a different scale factor changes the size of the image as reported by the `size` property. + @param options A dictionary containing any animation decoding options. + @return An initialized object + */ +- (nullable instancetype)initWithData:(nonnull NSData *)data scale:(CGFloat)scale options:(nullable SDImageCoderOptions *)options; + +/** + Initializes the image with an animated coder. You can use the coder to decode the image frame later. + @note We use this with animated coder which conforms to `SDProgressiveImageCoder` for progressive animation decoding. + + @param animatedCoder An animated coder which conform `SDAnimatedImageCoder` protocol + @param scale The scale factor to assume when interpreting the image data. Applying a scale factor of 1.0 results in an image whose size matches the pixel-based dimensions of the image. Applying a different scale factor changes the size of the image as reported by the `size` property. + @return An initialized object + */ +- (nullable instancetype)initWithAnimatedCoder:(nonnull id)animatedCoder scale:(CGFloat)scale; + +@optional +// These methods are used for optional advanced feature, like image frame preloading. +/** + Pre-load all animated image frame into memory. Then later frame image request can directly return the frame for index without decoding. + This method may be called on background thread. + + @note If one image instance is shared by lots of imageViews, the CPU performance for large animated image will drop down because the request frame index will be random (not in order) and the decoder should take extra effort to keep it re-entrant. You can use this to reduce CPU usage if need. Attention this will consume more memory usage. + */ +- (void)preloadAllFrames; + +/** + Unload all animated image frame from memory if are already pre-loaded. Then later frame image request need decoding. You can use this to free up the memory usage if need. + */ +- (void)unloadAllFrames; + +/** + Returns a Boolean value indicating whether all animated image frames are already pre-loaded into memory. + */ +@property (nonatomic, assign, readonly, getter=isAllFramesLoaded) BOOL allFramesLoaded; + +/** + Return the animated image coder if the image is created with `initWithAnimatedCoder:scale:` method. + @note We use this with animated coder which conforms to `SDProgressiveImageCoder` for progressive animation decoding. + */ +@property (nonatomic, strong, readonly, nullable) id animatedCoder; + +@end + +/** + The image class which supports animating on `SDAnimatedImageView`. You can also use it on normal UIImageView/NSImageView. + */ +@interface SDAnimatedImage : UIImage + +// This class override these methods from UIImage(NSImage), and it supports NSSecureCoding. +// You should use these methods to create a new animated image. Use other methods just call super instead. +// Pay attention, when the animated image frame count <= 1, all the `SDAnimatedImageProvider` protocol methods will return nil or 0 value, you'd better check the frame count before usage and keep fallback. ++ (nullable instancetype)imageNamed:(nonnull NSString *)name; // Cache in memory, no Asset Catalog support +#if __has_include() ++ (nullable instancetype)imageNamed:(nonnull NSString *)name inBundle:(nullable NSBundle *)bundle compatibleWithTraitCollection:(nullable UITraitCollection *)traitCollection; // Cache in memory, no Asset Catalog support +#else ++ (nullable instancetype)imageNamed:(nonnull NSString *)name inBundle:(nullable NSBundle *)bundle; // Cache in memory, no Asset Catalog support +#endif ++ (nullable instancetype)imageWithContentsOfFile:(nonnull NSString *)path; ++ (nullable instancetype)imageWithData:(nonnull NSData *)data; ++ (nullable instancetype)imageWithData:(nonnull NSData *)data scale:(CGFloat)scale; +- (nullable instancetype)initWithContentsOfFile:(nonnull NSString *)path; +- (nullable instancetype)initWithData:(nonnull NSData *)data; +- (nullable instancetype)initWithData:(nonnull NSData *)data scale:(CGFloat)scale; + +/** + Current animated image format. + */ +@property (nonatomic, assign, readonly) SDImageFormat animatedImageFormat; + +/** + Current animated image data, you can use this to grab the compressed format data and create another animated image instance. + If this image instance is an animated image created by using animated image coder (which means using the API listed above or using `initWithAnimatedCoder:scale:`), this property is non-nil. + */ +@property (nonatomic, copy, readonly, nullable) NSData *animatedImageData; + +/** + The scale factor of the image. + + @note For UIKit, this just call super instead. + @note For AppKit, `NSImage` can contains multiple image representations with different scales. However, this class does not do that from the design. We process the scale like UIKit. This will actually be calculated from image size and pixel size. + */ +@property (nonatomic, readonly) CGFloat scale; + +// By default, animated image frames are returned by decoding just in time without keeping into memory. But you can choose to preload them into memory as well, See the description in `SDAnimatedImage` protocol. +// After preloaded, there is no huge difference on performance between this and UIImage's `animatedImageWithImages:duration:`. But UIImage's animation have some issues such like blanking and pausing during segue when using in `UIImageView`. It's recommend to use only if need. +- (void)preloadAllFrames; +- (void)unloadAllFrames; +@property (nonatomic, assign, readonly, getter=isAllFramesLoaded) BOOL allFramesLoaded; + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImage.m b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImage.m new file mode 100644 index 0000000..f98c492 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImage.m @@ -0,0 +1,392 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDAnimatedImage.h" +#import "NSImage+Compatibility.h" +#import "SDImageCoder.h" +#import "SDImageCodersManager.h" +#import "SDImageFrame.h" +#import "UIImage+MemoryCacheCost.h" +#import "UIImage+Metadata.h" +#import "UIImage+MultiFormat.h" +#import "SDImageCoderHelper.h" +#import "SDImageAssetManager.h" +#import "objc/runtime.h" + +static CGFloat SDImageScaleFromPath(NSString *string) { + if (string.length == 0 || [string hasSuffix:@"/"]) return 1; + NSString *name = string.stringByDeletingPathExtension; + __block CGFloat scale = 1; + + NSRegularExpression *pattern = [NSRegularExpression regularExpressionWithPattern:@"@[0-9]+\\.?[0-9]*x$" options:NSRegularExpressionAnchorsMatchLines error:nil]; + [pattern enumerateMatchesInString:name options:kNilOptions range:NSMakeRange(0, name.length) usingBlock:^(NSTextCheckingResult *result, NSMatchingFlags flags, BOOL *stop) { + scale = [string substringWithRange:NSMakeRange(result.range.location + 1, result.range.length - 2)].doubleValue; + }]; + + return scale; +} + +@interface SDAnimatedImage () + +@property (nonatomic, strong) id animatedCoder; +@property (nonatomic, assign, readwrite) SDImageFormat animatedImageFormat; +@property (atomic, copy) NSArray *loadedAnimatedImageFrames; // Mark as atomic to keep thread-safe +@property (nonatomic, assign, getter=isAllFramesLoaded) BOOL allFramesLoaded; + +@end + +@implementation SDAnimatedImage +@dynamic scale; // call super + +#pragma mark - UIImage override method ++ (instancetype)imageNamed:(NSString *)name { +#if __has_include() + return [self imageNamed:name inBundle:nil compatibleWithTraitCollection:nil]; +#else + return [self imageNamed:name inBundle:nil]; +#endif +} + +#if __has_include() ++ (instancetype)imageNamed:(NSString *)name inBundle:(NSBundle *)bundle compatibleWithTraitCollection:(UITraitCollection *)traitCollection { + if (!traitCollection) { + traitCollection = UIScreen.mainScreen.traitCollection; + } + CGFloat scale = traitCollection.displayScale; + return [self imageNamed:name inBundle:bundle scale:scale]; +} +#else ++ (instancetype)imageNamed:(NSString *)name inBundle:(NSBundle *)bundle { + return [self imageNamed:name inBundle:bundle scale:0]; +} +#endif + +// 0 scale means automatically check ++ (instancetype)imageNamed:(NSString *)name inBundle:(NSBundle *)bundle scale:(CGFloat)scale { + if (!name) { + return nil; + } + if (!bundle) { + bundle = [NSBundle mainBundle]; + } + SDImageAssetManager *assetManager = [SDImageAssetManager sharedAssetManager]; + SDAnimatedImage *image = (SDAnimatedImage *)[assetManager imageForName:name]; + if ([image isKindOfClass:[SDAnimatedImage class]]) { + return image; + } + NSString *path = [assetManager getPathForName:name bundle:bundle preferredScale:&scale]; + if (!path) { + return image; + } + NSData *data = [NSData dataWithContentsOfFile:path]; + if (!data) { + return image; + } + image = [[self alloc] initWithData:data scale:scale]; + if (image) { + [assetManager storeImage:image forName:name]; + } + + return image; +} + ++ (instancetype)imageWithContentsOfFile:(NSString *)path { + return [[self alloc] initWithContentsOfFile:path]; +} + ++ (instancetype)imageWithData:(NSData *)data { + return [[self alloc] initWithData:data]; +} + ++ (instancetype)imageWithData:(NSData *)data scale:(CGFloat)scale { + return [[self alloc] initWithData:data scale:scale]; +} + +- (instancetype)initWithContentsOfFile:(NSString *)path { + NSData *data = [NSData dataWithContentsOfFile:path]; + return [self initWithData:data scale:SDImageScaleFromPath(path)]; +} + +- (instancetype)initWithData:(NSData *)data { + return [self initWithData:data scale:1]; +} + +- (instancetype)initWithData:(NSData *)data scale:(CGFloat)scale { + return [self initWithData:data scale:scale options:nil]; +} + +- (instancetype)initWithData:(NSData *)data scale:(CGFloat)scale options:(SDImageCoderOptions *)options { + if (!data || data.length == 0) { + return nil; + } + data = [data copy]; // avoid mutable data + id animatedCoder = nil; + for (idcoder in [SDImageCodersManager sharedManager].coders.reverseObjectEnumerator) { + if ([coder conformsToProtocol:@protocol(SDAnimatedImageCoder)]) { + if ([coder canDecodeFromData:data]) { + if (!options) { + options = @{SDImageCoderDecodeScaleFactor : @(scale)}; + } + animatedCoder = [[[coder class] alloc] initWithAnimatedImageData:data options:options]; + break; + } + } + } + if (!animatedCoder) { + return nil; + } + return [self initWithAnimatedCoder:animatedCoder scale:scale]; +} + +- (instancetype)initWithAnimatedCoder:(id)animatedCoder scale:(CGFloat)scale { + if (!animatedCoder) { + return nil; + } + UIImage *image = [animatedCoder animatedImageFrameAtIndex:0]; + if (!image) { + return nil; + } +#if SD_MAC + self = [super initWithCGImage:image.CGImage scale:MAX(scale, 1) orientation:kCGImagePropertyOrientationUp]; +#else + self = [super initWithCGImage:image.CGImage scale:MAX(scale, 1) orientation:image.imageOrientation]; +#endif + if (self) { + // Only keep the animated coder if frame count > 1, save RAM usage for non-animated image format (APNG/WebP) + if (animatedCoder.animatedImageFrameCount > 1) { + _animatedCoder = animatedCoder; + } + NSData *data = [animatedCoder animatedImageData]; + SDImageFormat format = [NSData sd_imageFormatForImageData:data]; + _animatedImageFormat = format; + } + return self; +} + +#pragma mark - Preload +- (void)preloadAllFrames { + if (!_animatedCoder) { + return; + } + if (!self.isAllFramesLoaded) { + NSMutableArray *frames = [NSMutableArray arrayWithCapacity:self.animatedImageFrameCount]; + for (size_t i = 0; i < self.animatedImageFrameCount; i++) { + UIImage *image = [self animatedImageFrameAtIndex:i]; + NSTimeInterval duration = [self animatedImageDurationAtIndex:i]; + SDImageFrame *frame = [SDImageFrame frameWithImage:image duration:duration]; // through the image should be nonnull, used as nullable for `animatedImageFrameAtIndex:` + [frames addObject:frame]; + } + self.loadedAnimatedImageFrames = frames; + self.allFramesLoaded = YES; + } +} + +- (void)unloadAllFrames { + if (!_animatedCoder) { + return; + } + if (self.isAllFramesLoaded) { + self.loadedAnimatedImageFrames = nil; + self.allFramesLoaded = NO; + } +} + +#pragma mark - NSSecureCoding +- (instancetype)initWithCoder:(NSCoder *)aDecoder { + self = [super initWithCoder:aDecoder]; + if (self) { + _animatedImageFormat = [aDecoder decodeIntegerForKey:NSStringFromSelector(@selector(animatedImageFormat))]; + NSData *animatedImageData = [aDecoder decodeObjectOfClass:[NSData class] forKey:NSStringFromSelector(@selector(animatedImageData))]; + if (!animatedImageData) { + return self; + } + CGFloat scale = self.scale; + id animatedCoder = nil; + for (idcoder in [SDImageCodersManager sharedManager].coders.reverseObjectEnumerator) { + if ([coder conformsToProtocol:@protocol(SDAnimatedImageCoder)]) { + if ([coder canDecodeFromData:animatedImageData]) { + animatedCoder = [[[coder class] alloc] initWithAnimatedImageData:animatedImageData options:@{SDImageCoderDecodeScaleFactor : @(scale)}]; + break; + } + } + } + if (!animatedCoder) { + return self; + } + if (animatedCoder.animatedImageFrameCount > 1) { + _animatedCoder = animatedCoder; + } + } + return self; +} + +- (void)encodeWithCoder:(NSCoder *)aCoder { + [super encodeWithCoder:aCoder]; + [aCoder encodeInteger:self.animatedImageFormat forKey:NSStringFromSelector(@selector(animatedImageFormat))]; + NSData *animatedImageData = self.animatedImageData; + if (animatedImageData) { + [aCoder encodeObject:animatedImageData forKey:NSStringFromSelector(@selector(animatedImageData))]; + } +} + ++ (BOOL)supportsSecureCoding { + return YES; +} + +#pragma mark - SDAnimatedImageProvider + +- (NSData *)animatedImageData { + return [self.animatedCoder animatedImageData]; +} + +- (NSUInteger)animatedImageLoopCount { + return [self.animatedCoder animatedImageLoopCount]; +} + +- (NSUInteger)animatedImageFrameCount { + return [self.animatedCoder animatedImageFrameCount]; +} + +- (UIImage *)animatedImageFrameAtIndex:(NSUInteger)index { + if (index >= self.animatedImageFrameCount) { + return nil; + } + if (self.isAllFramesLoaded) { + SDImageFrame *frame = [self.loadedAnimatedImageFrames objectAtIndex:index]; + return frame.image; + } + return [self.animatedCoder animatedImageFrameAtIndex:index]; +} + +- (NSTimeInterval)animatedImageDurationAtIndex:(NSUInteger)index { + if (index >= self.animatedImageFrameCount) { + return 0; + } + if (self.isAllFramesLoaded) { + SDImageFrame *frame = [self.loadedAnimatedImageFrames objectAtIndex:index]; + return frame.duration; + } + return [self.animatedCoder animatedImageDurationAtIndex:index]; +} + +@end + +@implementation SDAnimatedImage (MemoryCacheCost) + +- (NSUInteger)sd_memoryCost { + NSNumber *value = objc_getAssociatedObject(self, @selector(sd_memoryCost)); + if (value != nil) { + return value.unsignedIntegerValue; + } + + CGImageRef imageRef = self.CGImage; + if (!imageRef) { + return 0; + } + NSUInteger bytesPerFrame = CGImageGetBytesPerRow(imageRef) * CGImageGetHeight(imageRef); + NSUInteger frameCount = 1; + if (self.isAllFramesLoaded) { + frameCount = self.animatedImageFrameCount; + } + frameCount = frameCount > 0 ? frameCount : 1; + NSUInteger cost = bytesPerFrame * frameCount; + return cost; +} + +@end + +@implementation SDAnimatedImage (Metadata) + +- (BOOL)sd_isAnimated { + return YES; +} + +- (NSUInteger)sd_imageLoopCount { + return self.animatedImageLoopCount; +} + +- (void)setSd_imageLoopCount:(NSUInteger)sd_imageLoopCount { + return; +} + +- (NSUInteger)sd_imageFrameCount { + return self.animatedImageFrameCount; +} + +- (SDImageFormat)sd_imageFormat { + return self.animatedImageFormat; +} + +- (void)setSd_imageFormat:(SDImageFormat)sd_imageFormat { + return; +} + +- (BOOL)sd_isVector { + return NO; +} + +@end + +@implementation SDAnimatedImage (MultiFormat) + ++ (nullable UIImage *)sd_imageWithData:(nullable NSData *)data { + return [self sd_imageWithData:data scale:1]; +} + ++ (nullable UIImage *)sd_imageWithData:(nullable NSData *)data scale:(CGFloat)scale { + return [self sd_imageWithData:data scale:scale firstFrameOnly:NO]; +} + ++ (nullable UIImage *)sd_imageWithData:(nullable NSData *)data scale:(CGFloat)scale firstFrameOnly:(BOOL)firstFrameOnly { + if (!data) { + return nil; + } + return [[self alloc] initWithData:data scale:scale options:@{SDImageCoderDecodeFirstFrameOnly : @(firstFrameOnly)}]; +} + +- (nullable NSData *)sd_imageData { + NSData *imageData = self.animatedImageData; + if (imageData) { + return imageData; + } else { + return [self sd_imageDataAsFormat:self.animatedImageFormat]; + } +} + +- (nullable NSData *)sd_imageDataAsFormat:(SDImageFormat)imageFormat { + return [self sd_imageDataAsFormat:imageFormat compressionQuality:1]; +} + +- (nullable NSData *)sd_imageDataAsFormat:(SDImageFormat)imageFormat compressionQuality:(double)compressionQuality { + return [self sd_imageDataAsFormat:imageFormat compressionQuality:compressionQuality firstFrameOnly:NO]; +} + +- (nullable NSData *)sd_imageDataAsFormat:(SDImageFormat)imageFormat compressionQuality:(double)compressionQuality firstFrameOnly:(BOOL)firstFrameOnly { + if (firstFrameOnly) { + // First frame, use super implementation + return [super sd_imageDataAsFormat:imageFormat compressionQuality:compressionQuality firstFrameOnly:firstFrameOnly]; + } + NSUInteger frameCount = self.animatedImageFrameCount; + if (frameCount <= 1) { + // Static image, use super implementation + return [super sd_imageDataAsFormat:imageFormat compressionQuality:compressionQuality firstFrameOnly:firstFrameOnly]; + } + // Keep animated image encoding, loop each frame. + NSMutableArray *frames = [NSMutableArray arrayWithCapacity:frameCount]; + for (size_t i = 0; i < frameCount; i++) { + UIImage *image = [self animatedImageFrameAtIndex:i]; + NSTimeInterval duration = [self animatedImageDurationAtIndex:i]; + SDImageFrame *frame = [SDImageFrame frameWithImage:image duration:duration]; + [frames addObject:frame]; + } + UIImage *animatedImage = [SDImageCoderHelper animatedImageWithFrames:frames]; + NSData *imageData = [animatedImage sd_imageDataAsFormat:imageFormat compressionQuality:compressionQuality firstFrameOnly:firstFrameOnly]; + return imageData; +} + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImagePlayer.h b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImagePlayer.h new file mode 100644 index 0000000..e71e239 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImagePlayer.h @@ -0,0 +1,112 @@ +/* +* This file is part of the SDWebImage package. +* (c) Olivier Poitrey +* +* For the full copyright and license information, please view the LICENSE +* file that was distributed with this source code. +*/ + +#import +#import "SDWebImageCompat.h" +#import "SDImageCoder.h" + +typedef NS_ENUM(NSUInteger, SDAnimatedImagePlaybackMode) { + /** + * From first to last frame and stop or next loop. + */ + SDAnimatedImagePlaybackModeNormal = 0, + /** + * From last frame to first frame and stop or next loop. + */ + SDAnimatedImagePlaybackModeReverse, + /** + * From first frame to last frame and reverse again, like reciprocating. + */ + SDAnimatedImagePlaybackModeBounce, + /** + * From last frame to first frame and reverse again, like reversed reciprocating. + */ + SDAnimatedImagePlaybackModeReversedBounce, +}; + +/// A player to control the playback of animated image, which can be used to drive Animated ImageView or any rendering usage, like CALayer/WatchKit/SwiftUI rendering. +@interface SDAnimatedImagePlayer : NSObject + +/// Current playing frame image. This value is KVO Compliance. +@property (nonatomic, readonly, nullable) UIImage *currentFrame; + +/// Current frame index, zero based. This value is KVO Compliance. +@property (nonatomic, readonly) NSUInteger currentFrameIndex; + +/// Current loop count since its latest animating. This value is KVO Compliance. +@property (nonatomic, readonly) NSUInteger currentLoopCount; + +/// Total frame count for animated image rendering. Defaults is animated image's frame count. +/// @note For progressive animation, you can update this value when your provider receive more frames. +@property (nonatomic, assign) NSUInteger totalFrameCount; + +/// Total loop count for animated image rendering. Default is animated image's loop count. +@property (nonatomic, assign) NSUInteger totalLoopCount; + +/// The animation playback rate. Default is 1.0 +/// `1.0` means the normal speed. +/// `0.0` means stopping the animation. +/// `0.0-1.0` means the slow speed. +/// `> 1.0` means the fast speed. +/// `< 0.0` is not supported currently and stop animation. (may support reverse playback in the future) +@property (nonatomic, assign) double playbackRate; + +/// Asynchronous setup animation playback mode. Default mode is SDAnimatedImagePlaybackModeNormal. +@property (nonatomic, assign) SDAnimatedImagePlaybackMode playbackMode; + +/// Provide a max buffer size by bytes. This is used to adjust frame buffer count and can be useful when the decoding cost is expensive (such as Animated WebP software decoding). Default is 0. +/// `0` means automatically adjust by calculating current memory usage. +/// `1` means without any buffer cache, each of frames will be decoded and then be freed after rendering. (Lowest Memory and Highest CPU) +/// `NSUIntegerMax` means cache all the buffer. (Lowest CPU and Highest Memory) +@property (nonatomic, assign) NSUInteger maxBufferSize; + +/// You can specify a runloop mode to let it rendering. +/// Default is NSRunLoopCommonModes on multi-core device, NSDefaultRunLoopMode on single-core device +@property (nonatomic, copy, nonnull) NSRunLoopMode runLoopMode; + +/// Create a player with animated image provider. If the provider's `animatedImageFrameCount` is less than 1, returns nil. +/// The provider can be any protocol implementation, like `SDAnimatedImage`, `SDImageGIFCoder`, etc. +/// @note This provider can represent mutable content, like progressive animated loading. But you need to update the frame count by yourself +/// @param provider The animated provider +- (nullable instancetype)initWithProvider:(nonnull id)provider; + +/// Create a player with animated image provider. If the provider's `animatedImageFrameCount` is less than 1, returns nil. +/// The provider can be any protocol implementation, like `SDAnimatedImage` or `SDImageGIFCoder`, etc. +/// @note This provider can represent mutable content, like progressive animated loading. But you need to update the frame count by yourself +/// @param provider The animated provider ++ (nullable instancetype)playerWithProvider:(nonnull id)provider; + +/// The handler block when current frame and index changed. +@property (nonatomic, copy, nullable) void (^animationFrameHandler)(NSUInteger index, UIImage * _Nonnull frame); + +/// The handler block when one loop count finished. +@property (nonatomic, copy, nullable) void (^animationLoopHandler)(NSUInteger loopCount); + +/// Return the status whether animation is playing. +@property (nonatomic, readonly) BOOL isPlaying; + +/// Start the animation. Or resume the previously paused animation. +- (void)startPlaying; + +/// Pause the animation. Keep the current frame index and loop count. +- (void)pausePlaying; + +/// Stop the animation. Reset the current frame index and loop count. +- (void)stopPlaying; + +/// Seek to the desired frame index and loop count. +/// @note This can be used for advanced control like progressive loading, or skipping specify frames. +/// @param index The frame index +/// @param loopCount The loop count +- (void)seekToFrameAtIndex:(NSUInteger)index loopCount:(NSUInteger)loopCount; + +/// Clear the frame cache buffer. The frame cache buffer size can be controlled by `maxBufferSize`. +/// By default, when stop or pause the animation, the frame buffer is still kept to ready for the next restart +- (void)clearFrameBuffer; + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImagePlayer.m b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImagePlayer.m new file mode 100644 index 0000000..a03f78b --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImagePlayer.m @@ -0,0 +1,406 @@ +/* +* This file is part of the SDWebImage package. +* (c) Olivier Poitrey +* +* For the full copyright and license information, please view the LICENSE +* file that was distributed with this source code. +*/ + +#import "SDAnimatedImagePlayer.h" +#import "NSImage+Compatibility.h" +#import "SDDisplayLink.h" +#import "SDDeviceHelper.h" +#import "SDInternalMacros.h" + +@interface SDAnimatedImagePlayer () { + SD_LOCK_DECLARE(_lock); + NSRunLoopMode _runLoopMode; +} + +@property (nonatomic, strong, readwrite) UIImage *currentFrame; +@property (nonatomic, assign, readwrite) NSUInteger currentFrameIndex; +@property (nonatomic, assign, readwrite) NSUInteger currentLoopCount; +@property (nonatomic, strong) id animatedProvider; +@property (nonatomic, strong) NSMutableDictionary *frameBuffer; +@property (nonatomic, assign) NSTimeInterval currentTime; +@property (nonatomic, assign) BOOL bufferMiss; +@property (nonatomic, assign) BOOL needsDisplayWhenImageBecomesAvailable; +@property (nonatomic, assign) BOOL shouldReverse; +@property (nonatomic, assign) NSUInteger maxBufferCount; +@property (nonatomic, strong) NSOperationQueue *fetchQueue; +@property (nonatomic, strong) SDDisplayLink *displayLink; + +@end + +@implementation SDAnimatedImagePlayer + +- (instancetype)initWithProvider:(id)provider { + self = [super init]; + if (self) { + NSUInteger animatedImageFrameCount = provider.animatedImageFrameCount; + // Check the frame count + if (animatedImageFrameCount <= 1) { + return nil; + } + self.totalFrameCount = animatedImageFrameCount; + // Get the current frame and loop count. + self.totalLoopCount = provider.animatedImageLoopCount; + self.animatedProvider = provider; + self.playbackRate = 1.0; + SD_LOCK_INIT(_lock); +#if SD_UIKIT + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didReceiveMemoryWarning:) name:UIApplicationDidReceiveMemoryWarningNotification object:nil]; +#endif + } + return self; +} + ++ (instancetype)playerWithProvider:(id)provider { + SDAnimatedImagePlayer *player = [[SDAnimatedImagePlayer alloc] initWithProvider:provider]; + return player; +} + +#pragma mark - Life Cycle + +- (void)dealloc { +#if SD_UIKIT + [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidReceiveMemoryWarningNotification object:nil]; +#endif +} + +- (void)didReceiveMemoryWarning:(NSNotification *)notification { + [_fetchQueue cancelAllOperations]; + [_fetchQueue addOperationWithBlock:^{ + NSNumber *currentFrameIndex = @(self.currentFrameIndex); + SD_LOCK(self->_lock); + NSArray *keys = self.frameBuffer.allKeys; + // only keep the next frame for later rendering + for (NSNumber * key in keys) { + if (![key isEqualToNumber:currentFrameIndex]) { + [self.frameBuffer removeObjectForKey:key]; + } + } + SD_UNLOCK(self->_lock); + }]; +} + +#pragma mark - Private +- (NSOperationQueue *)fetchQueue { + if (!_fetchQueue) { + _fetchQueue = [[NSOperationQueue alloc] init]; + _fetchQueue.maxConcurrentOperationCount = 1; + } + return _fetchQueue; +} + +- (NSMutableDictionary *)frameBuffer { + if (!_frameBuffer) { + _frameBuffer = [NSMutableDictionary dictionary]; + } + return _frameBuffer; +} + +- (SDDisplayLink *)displayLink { + if (!_displayLink) { + _displayLink = [SDDisplayLink displayLinkWithTarget:self selector:@selector(displayDidRefresh:)]; + [_displayLink addToRunLoop:[NSRunLoop mainRunLoop] forMode:self.runLoopMode]; + [_displayLink stop]; + } + return _displayLink; +} + +- (void)setRunLoopMode:(NSRunLoopMode)runLoopMode { + if ([_runLoopMode isEqual:runLoopMode]) { + return; + } + if (_displayLink) { + if (_runLoopMode) { + [_displayLink removeFromRunLoop:[NSRunLoop mainRunLoop] forMode:_runLoopMode]; + } + if (runLoopMode.length > 0) { + [_displayLink addToRunLoop:[NSRunLoop mainRunLoop] forMode:runLoopMode]; + } + } + _runLoopMode = [runLoopMode copy]; +} + +- (NSRunLoopMode)runLoopMode { + if (!_runLoopMode) { + _runLoopMode = [[self class] defaultRunLoopMode]; + } + return _runLoopMode; +} + +#pragma mark - State Control + +- (void)setupCurrentFrame { + if (self.currentFrameIndex != 0) { + return; + } + if (self.playbackMode == SDAnimatedImagePlaybackModeReverse || + self.playbackMode == SDAnimatedImagePlaybackModeReversedBounce) { + self.currentFrameIndex = self.totalFrameCount - 1; + } + + if (!self.currentFrame && [self.animatedProvider isKindOfClass:[UIImage class]]) { + UIImage *image = (UIImage *)self.animatedProvider; + // Use the poster image if available + #if SD_MAC + UIImage *posterFrame = [[NSImage alloc] initWithCGImage:image.CGImage scale:image.scale orientation:kCGImagePropertyOrientationUp]; + #else + UIImage *posterFrame = [[UIImage alloc] initWithCGImage:image.CGImage scale:image.scale orientation:image.imageOrientation]; + #endif + if (posterFrame) { + self.currentFrame = posterFrame; + SD_LOCK(self->_lock); + self.frameBuffer[@(self.currentFrameIndex)] = self.currentFrame; + SD_UNLOCK(self->_lock); + [self handleFrameChange]; + } + } + +} + +- (void)resetCurrentFrameStatus { + // These should not trigger KVO, user don't need to receive an `index == 0, image == nil` callback. + _currentFrame = nil; + _currentFrameIndex = 0; + _currentLoopCount = 0; + _currentTime = 0; + _bufferMiss = NO; + _needsDisplayWhenImageBecomesAvailable = NO; +} + +- (void)clearFrameBuffer { + SD_LOCK(_lock); + [_frameBuffer removeAllObjects]; + SD_UNLOCK(_lock); +} + +#pragma mark - Animation Control +- (void)startPlaying { + [self.displayLink start]; + // Setup frame + [self setupCurrentFrame]; + // Calculate max buffer size + [self calculateMaxBufferCount]; +} + +- (void)stopPlaying { + [_fetchQueue cancelAllOperations]; + // Using `_displayLink` here because when UIImageView dealloc, it may trigger `[self stopAnimating]`, we already release the display link in SDAnimatedImageView's dealloc method. + [_displayLink stop]; + // We need to reset the frame status, but not trigger any handle. This can ensure next time's playing status correct. + [self resetCurrentFrameStatus]; +} + +- (void)pausePlaying { + [_fetchQueue cancelAllOperations]; + [_displayLink stop]; +} + +- (BOOL)isPlaying { + return _displayLink.isRunning; +} + +- (void)seekToFrameAtIndex:(NSUInteger)index loopCount:(NSUInteger)loopCount { + if (index >= self.totalFrameCount) { + return; + } + self.currentFrameIndex = index; + self.currentLoopCount = loopCount; + self.currentFrame = [self.animatedProvider animatedImageFrameAtIndex:index]; + [self handleFrameChange]; +} + +#pragma mark - Core Render +- (void)displayDidRefresh:(SDDisplayLink *)displayLink { + // If for some reason a wild call makes it through when we shouldn't be animating, bail. + // Early return! + if (!self.isPlaying) { + return; + } + + NSUInteger totalFrameCount = self.totalFrameCount; + if (totalFrameCount <= 1) { + // Total frame count less than 1, wrong configuration and stop animating + [self stopPlaying]; + return; + } + + NSTimeInterval playbackRate = self.playbackRate; + if (playbackRate <= 0) { + // Does not support <= 0 play rate + [self stopPlaying]; + return; + } + + // Calculate refresh duration + NSTimeInterval duration = self.displayLink.duration; + + NSUInteger currentFrameIndex = self.currentFrameIndex; + NSUInteger nextFrameIndex = (currentFrameIndex + 1) % totalFrameCount; + + if (self.playbackMode == SDAnimatedImagePlaybackModeReverse) { + nextFrameIndex = currentFrameIndex == 0 ? (totalFrameCount - 1) : (currentFrameIndex - 1) % totalFrameCount; + + } else if (self.playbackMode == SDAnimatedImagePlaybackModeBounce || + self.playbackMode == SDAnimatedImagePlaybackModeReversedBounce) { + if (currentFrameIndex == 0) { + self.shouldReverse = false; + } else if (currentFrameIndex == totalFrameCount - 1) { + self.shouldReverse = true; + } + nextFrameIndex = self.shouldReverse ? (currentFrameIndex - 1) : (currentFrameIndex + 1); + nextFrameIndex %= totalFrameCount; + } + + + // Check if we need to display new frame firstly + BOOL bufferFull = NO; + if (self.needsDisplayWhenImageBecomesAvailable) { + UIImage *currentFrame; + SD_LOCK(_lock); + currentFrame = self.frameBuffer[@(currentFrameIndex)]; + SD_UNLOCK(_lock); + + // Update the current frame + if (currentFrame) { + SD_LOCK(_lock); + // Remove the frame buffer if need + if (self.frameBuffer.count > self.maxBufferCount) { + self.frameBuffer[@(currentFrameIndex)] = nil; + } + // Check whether we can stop fetch + if (self.frameBuffer.count == totalFrameCount) { + bufferFull = YES; + } + SD_UNLOCK(_lock); + + // Update the current frame immediately + self.currentFrame = currentFrame; + [self handleFrameChange]; + + self.bufferMiss = NO; + self.needsDisplayWhenImageBecomesAvailable = NO; + } + else { + self.bufferMiss = YES; + } + } + + // Check if we have the frame buffer + if (!self.bufferMiss) { + // Then check if timestamp is reached + self.currentTime += duration; + NSTimeInterval currentDuration = [self.animatedProvider animatedImageDurationAtIndex:currentFrameIndex]; + currentDuration = currentDuration / playbackRate; + if (self.currentTime < currentDuration) { + // Current frame timestamp not reached, return + return; + } + + // Otherwise, we should be ready to display next frame + self.needsDisplayWhenImageBecomesAvailable = YES; + self.currentFrameIndex = nextFrameIndex; + self.currentTime -= currentDuration; + NSTimeInterval nextDuration = [self.animatedProvider animatedImageDurationAtIndex:nextFrameIndex]; + nextDuration = nextDuration / playbackRate; + if (self.currentTime > nextDuration) { + // Do not skip frame + self.currentTime = nextDuration; + } + + // Update the loop count when last frame rendered + if (nextFrameIndex == 0) { + // Update the loop count + self.currentLoopCount++; + [self handleLoopChange]; + + // if reached the max loop count, stop animating, 0 means loop indefinitely + NSUInteger maxLoopCount = self.totalLoopCount; + if (maxLoopCount != 0 && (self.currentLoopCount >= maxLoopCount)) { + [self stopPlaying]; + return; + } + } + } + + // Since we support handler, check animating state again + if (!self.isPlaying) { + return; + } + + // Check if we should prefetch next frame or current frame + // When buffer miss, means the decode speed is slower than render speed, we fetch current miss frame + // Or, most cases, the decode speed is faster than render speed, we fetch next frame + NSUInteger fetchFrameIndex = self.bufferMiss? currentFrameIndex : nextFrameIndex; + UIImage *fetchFrame; + SD_LOCK(_lock); + fetchFrame = self.bufferMiss? nil : self.frameBuffer[@(nextFrameIndex)]; + SD_UNLOCK(_lock); + + if (!fetchFrame && !bufferFull && self.fetchQueue.operationCount == 0) { + // Prefetch next frame in background queue + id animatedProvider = self.animatedProvider; + @weakify(self); + NSOperation *operation = [NSBlockOperation blockOperationWithBlock:^{ + @strongify(self); + if (!self) { + return; + } + UIImage *frame = [animatedProvider animatedImageFrameAtIndex:fetchFrameIndex]; + + BOOL isAnimating = self.displayLink.isRunning; + if (isAnimating) { + SD_LOCK(self->_lock); + self.frameBuffer[@(fetchFrameIndex)] = frame; + SD_UNLOCK(self->_lock); + } + }]; + [self.fetchQueue addOperation:operation]; + } +} + +- (void)handleFrameChange { + if (self.animationFrameHandler) { + self.animationFrameHandler(self.currentFrameIndex, self.currentFrame); + } +} + +- (void)handleLoopChange { + if (self.animationLoopHandler) { + self.animationLoopHandler(self.currentLoopCount); + } +} + +#pragma mark - Util +- (void)calculateMaxBufferCount { + NSUInteger bytes = CGImageGetBytesPerRow(self.currentFrame.CGImage) * CGImageGetHeight(self.currentFrame.CGImage); + if (bytes == 0) bytes = 1024; + + NSUInteger max = 0; + if (self.maxBufferSize > 0) { + max = self.maxBufferSize; + } else { + // Calculate based on current memory, these factors are by experience + NSUInteger total = [SDDeviceHelper totalMemory]; + NSUInteger free = [SDDeviceHelper freeMemory]; + max = MIN(total * 0.2, free * 0.6); + } + + NSUInteger maxBufferCount = (double)max / (double)bytes; + if (!maxBufferCount) { + // At least 1 frame + maxBufferCount = 1; + } + + self.maxBufferCount = maxBufferCount; +} + ++ (NSString *)defaultRunLoopMode { + // Key off `activeProcessorCount` (as opposed to `processorCount`) since the system could shut down cores in certain situations. + return [NSProcessInfo processInfo].activeProcessorCount > 1 ? NSRunLoopCommonModes : NSDefaultRunLoopMode; +} + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImageRep.h b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImageRep.h new file mode 100644 index 0000000..be52f8c --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImageRep.h @@ -0,0 +1,23 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageCompat.h" + +#if SD_MAC + +/** + A subclass of `NSBitmapImageRep` to fix that GIF duration issue because `NSBitmapImageRep` will reset `NSImageCurrentFrameDuration` by using `kCGImagePropertyGIFDelayTime` but not `kCGImagePropertyGIFUnclampedDelayTime`. + This also fix the GIF loop count issue, which will use the Netscape standard (See http://www6.uniovi.es/gifanim/gifabout.htm) to only place once when the `kCGImagePropertyGIFLoopCount` is nil. This is what modern browser's behavior. + Built in GIF coder use this instead of `NSBitmapImageRep` for better GIF rendering. If you do not want this, only enable `SDImageIOCoder`, which just call `NSImage` API and actually use `NSBitmapImageRep` for GIF image. + This also support APNG format using `SDImageAPNGCoder`. Which provide full alpha-channel support and the correct duration match the `kCGImagePropertyAPNGUnclampedDelayTime`. + */ +@interface SDAnimatedImageRep : NSBitmapImageRep + +@end + +#endif diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImageRep.m b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImageRep.m new file mode 100644 index 0000000..2ef3a88 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImageRep.m @@ -0,0 +1,133 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDAnimatedImageRep.h" + +#if SD_MAC + +#import "SDImageIOAnimatedCoderInternal.h" +#import "SDImageGIFCoder.h" +#import "SDImageAPNGCoder.h" +#import "SDImageHEICCoder.h" +#import "SDImageAWebPCoder.h" + +@implementation SDAnimatedImageRep { + CGImageSourceRef _imageSource; +} + +- (void)dealloc { + if (_imageSource) { + CFRelease(_imageSource); + _imageSource = NULL; + } +} + +- (instancetype)copyWithZone:(NSZone *)zone { + SDAnimatedImageRep *imageRep = [super copyWithZone:zone]; + CFRetain(imageRep->_imageSource); + return imageRep; +} + +// `NSBitmapImageRep`'s `imageRepWithData:` is not designed initializer ++ (instancetype)imageRepWithData:(NSData *)data { + SDAnimatedImageRep *imageRep = [[SDAnimatedImageRep alloc] initWithData:data]; + return imageRep; +} + +// We should override init method for `NSBitmapImageRep` to do initialize about animated image format +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunguarded-availability" +- (instancetype)initWithData:(NSData *)data { + self = [super initWithData:data]; + if (self) { + CGImageSourceRef imageSource = CGImageSourceCreateWithData((__bridge CFDataRef) data, NULL); + if (!imageSource) { + return self; + } + _imageSource = imageSource; + NSUInteger frameCount = CGImageSourceGetCount(imageSource); + if (frameCount <= 1) { + return self; + } + CFStringRef type = CGImageSourceGetType(imageSource); + if (!type) { + return self; + } + if (CFStringCompare(type, kSDUTTypeGIF, 0) == kCFCompareEqualTo) { + // GIF + // Fix the `NSBitmapImageRep` GIF loop count calculation issue + // Which will use 0 when there are no loop count information metadata in GIF data + NSUInteger loopCount = [SDImageGIFCoder imageLoopCountWithSource:imageSource]; + [self setProperty:NSImageLoopCount withValue:@(loopCount)]; + } else if (CFStringCompare(type, kSDUTTypePNG, 0) == kCFCompareEqualTo) { + // APNG + // Do initialize about frame count, current frame/duration and loop count + [self setProperty:NSImageFrameCount withValue:@(frameCount)]; + [self setProperty:NSImageCurrentFrame withValue:@(0)]; + NSUInteger loopCount = [SDImageAPNGCoder imageLoopCountWithSource:imageSource]; + [self setProperty:NSImageLoopCount withValue:@(loopCount)]; + } else if (CFStringCompare(type, kSDUTTypeHEICS, 0) == kCFCompareEqualTo) { + // HEIC + // Do initialize about frame count, current frame/duration and loop count + [self setProperty:NSImageFrameCount withValue:@(frameCount)]; + [self setProperty:NSImageCurrentFrame withValue:@(0)]; + NSUInteger loopCount = [SDImageHEICCoder imageLoopCountWithSource:imageSource]; + [self setProperty:NSImageLoopCount withValue:@(loopCount)]; + } else if (CFStringCompare(type, kSDUTTypeWebP, 0) == kCFCompareEqualTo) { + // WebP + // Do initialize about frame count, current frame/duration and loop count + [self setProperty:NSImageFrameCount withValue:@(frameCount)]; + [self setProperty:NSImageCurrentFrame withValue:@(0)]; + NSUInteger loopCount = [SDImageAWebPCoder imageLoopCountWithSource:imageSource]; + [self setProperty:NSImageLoopCount withValue:@(loopCount)]; + } + } + return self; +} + +// `NSBitmapImageRep` will use `kCGImagePropertyGIFDelayTime` whenever you call `setProperty:withValue:` with `NSImageCurrentFrame` to change the current frame. We override it and use the actual `kCGImagePropertyGIFUnclampedDelayTime` if need. +- (void)setProperty:(NSBitmapImageRepPropertyKey)property withValue:(id)value { + [super setProperty:property withValue:value]; + if ([property isEqualToString:NSImageCurrentFrame]) { + // Access the image source + CGImageSourceRef imageSource = _imageSource; + if (!imageSource) { + return; + } + // Check format type + CFStringRef type = CGImageSourceGetType(imageSource); + if (!type) { + return; + } + NSUInteger index = [value unsignedIntegerValue]; + NSTimeInterval frameDuration = 0; + if (CFStringCompare(type, kSDUTTypeGIF, 0) == kCFCompareEqualTo) { + // GIF + frameDuration = [SDImageGIFCoder frameDurationAtIndex:index source:imageSource]; + } else if (CFStringCompare(type, kSDUTTypePNG, 0) == kCFCompareEqualTo) { + // APNG + frameDuration = [SDImageAPNGCoder frameDurationAtIndex:index source:imageSource]; + } else if (CFStringCompare(type, kSDUTTypeHEICS, 0) == kCFCompareEqualTo) { + // HEIC + frameDuration = [SDImageHEICCoder frameDurationAtIndex:index source:imageSource]; + } else if (CFStringCompare(type, kSDUTTypeWebP, 0) == kCFCompareEqualTo) { + // WebP + frameDuration = [SDImageAWebPCoder frameDurationAtIndex:index source:imageSource]; + } + if (!frameDuration) { + return; + } + // Reset super frame duration with the actual frame duration + [super setProperty:NSImageCurrentFrameDuration withValue:@(frameDuration)]; + } +} +#pragma clang diagnostic pop + +@end + +#endif diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImageView+WebCache.h b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImageView+WebCache.h new file mode 100644 index 0000000..af46476 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImageView+WebCache.h @@ -0,0 +1,168 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDAnimatedImageView.h" + +#if SD_UIKIT || SD_MAC + +#import "SDWebImageManager.h" + +/** + Integrates SDWebImage async downloading and caching of remote images with SDAnimatedImageView. + */ +@interface SDAnimatedImageView (WebCache) + +/** + * Set the imageView `image` with an `url`. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + */ +- (void)sd_setImageWithURL:(nullable NSURL *)url NS_REFINED_FOR_SWIFT; + +/** + * Set the imageView `image` with an `url` and a placeholder. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param placeholder The image to be set initially, until the image request finishes. + * @see sd_setImageWithURL:placeholderImage:options: + */ +- (void)sd_setImageWithURL:(nullable NSURL *)url + placeholderImage:(nullable UIImage *)placeholder NS_REFINED_FOR_SWIFT; + +/** + * Set the imageView `image` with an `url`, placeholder and custom options. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param placeholder The image to be set initially, until the image request finishes. + * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. + */ +- (void)sd_setImageWithURL:(nullable NSURL *)url + placeholderImage:(nullable UIImage *)placeholder + options:(SDWebImageOptions)options NS_REFINED_FOR_SWIFT; + +/** + * Set the imageView `image` with an `url`, placeholder, custom options and context. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param placeholder The image to be set initially, until the image request finishes. + * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. + * @param context A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold. + */ +- (void)sd_setImageWithURL:(nullable NSURL *)url + placeholderImage:(nullable UIImage *)placeholder + options:(SDWebImageOptions)options + context:(nullable SDWebImageContext *)context; + +/** + * Set the imageView `image` with an `url`. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param completedBlock A block called when operation has been completed. This block has no return value + * and takes the requested UIImage as first parameter. In case of error the image parameter + * is nil and the second parameter may contain an NSError. The third parameter is a Boolean + * indicating if the image was retrieved from the local cache or from the network. + * The fourth parameter is the original image url. + */ +- (void)sd_setImageWithURL:(nullable NSURL *)url + completed:(nullable SDExternalCompletionBlock)completedBlock; + +/** + * Set the imageView `image` with an `url`, placeholder. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param placeholder The image to be set initially, until the image request finishes. + * @param completedBlock A block called when operation has been completed. This block has no return value + * and takes the requested UIImage as first parameter. In case of error the image parameter + * is nil and the second parameter may contain an NSError. The third parameter is a Boolean + * indicating if the image was retrieved from the local cache or from the network. + * The fourth parameter is the original image url. + */ +- (void)sd_setImageWithURL:(nullable NSURL *)url + placeholderImage:(nullable UIImage *)placeholder + completed:(nullable SDExternalCompletionBlock)completedBlock NS_REFINED_FOR_SWIFT; + +/** + * Set the imageView `image` with an `url`, placeholder and custom options. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param placeholder The image to be set initially, until the image request finishes. + * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. + * @param completedBlock A block called when operation has been completed. This block has no return value + * and takes the requested UIImage as first parameter. In case of error the image parameter + * is nil and the second parameter may contain an NSError. The third parameter is a Boolean + * indicating if the image was retrieved from the local cache or from the network. + * The fourth parameter is the original image url. + */ +- (void)sd_setImageWithURL:(nullable NSURL *)url + placeholderImage:(nullable UIImage *)placeholder + options:(SDWebImageOptions)options + completed:(nullable SDExternalCompletionBlock)completedBlock; + +/** + * Set the imageView `image` with an `url`, placeholder and custom options. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param placeholder The image to be set initially, until the image request finishes. + * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. + * @param progressBlock A block called while image is downloading + * @note the progress block is executed on a background queue + * @param completedBlock A block called when operation has been completed. This block has no return value + * and takes the requested UIImage as first parameter. In case of error the image parameter + * is nil and the second parameter may contain an NSError. The third parameter is a Boolean + * indicating if the image was retrieved from the local cache or from the network. + * The fourth parameter is the original image url. + */ +- (void)sd_setImageWithURL:(nullable NSURL *)url + placeholderImage:(nullable UIImage *)placeholder + options:(SDWebImageOptions)options + progress:(nullable SDImageLoaderProgressBlock)progressBlock + completed:(nullable SDExternalCompletionBlock)completedBlock; + +/** + * Set the imageView `image` with an `url`, placeholder, custom options and context. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param placeholder The image to be set initially, until the image request finishes. + * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. + * @param context A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold. + * @param progressBlock A block called while image is downloading + * @note the progress block is executed on a background queue + * @param completedBlock A block called when operation has been completed. This block has no return value + * and takes the requested UIImage as first parameter. In case of error the image parameter + * is nil and the second parameter may contain an NSError. The third parameter is a Boolean + * indicating if the image was retrieved from the local cache or from the network. + * The fourth parameter is the original image url. + */ +- (void)sd_setImageWithURL:(nullable NSURL *)url + placeholderImage:(nullable UIImage *)placeholder + options:(SDWebImageOptions)options + context:(nullable SDWebImageContext *)context + progress:(nullable SDImageLoaderProgressBlock)progressBlock + completed:(nullable SDExternalCompletionBlock)completedBlock; + +@end + +#endif diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImageView+WebCache.m b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImageView+WebCache.m new file mode 100644 index 0000000..beb56b2 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImageView+WebCache.m @@ -0,0 +1,79 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDAnimatedImageView+WebCache.h" + +#if SD_UIKIT || SD_MAC + +#import "UIView+WebCache.h" +#import "SDAnimatedImage.h" + +@implementation SDAnimatedImageView (WebCache) + +- (void)sd_setImageWithURL:(nullable NSURL *)url { + [self sd_setImageWithURL:url placeholderImage:nil options:0 progress:nil completed:nil]; +} + +- (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder { + [self sd_setImageWithURL:url placeholderImage:placeholder options:0 progress:nil completed:nil]; +} + +- (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options { + [self sd_setImageWithURL:url placeholderImage:placeholder options:options progress:nil completed:nil]; +} + +- (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options context:(nullable SDWebImageContext *)context { + [self sd_setImageWithURL:url placeholderImage:placeholder options:options context:context progress:nil completed:nil]; +} + +- (void)sd_setImageWithURL:(nullable NSURL *)url completed:(nullable SDExternalCompletionBlock)completedBlock { + [self sd_setImageWithURL:url placeholderImage:nil options:0 progress:nil completed:completedBlock]; +} + +- (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder completed:(nullable SDExternalCompletionBlock)completedBlock { + [self sd_setImageWithURL:url placeholderImage:placeholder options:0 progress:nil completed:completedBlock]; +} + +- (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options completed:(nullable SDExternalCompletionBlock)completedBlock { + [self sd_setImageWithURL:url placeholderImage:placeholder options:options progress:nil completed:completedBlock]; +} + +- (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options progress:(nullable SDImageLoaderProgressBlock)progressBlock completed:(nullable SDExternalCompletionBlock)completedBlock { + [self sd_setImageWithURL:url placeholderImage:placeholder options:options context:nil progress:progressBlock completed:completedBlock]; +} + +- (void)sd_setImageWithURL:(nullable NSURL *)url + placeholderImage:(nullable UIImage *)placeholder + options:(SDWebImageOptions)options + context:(nullable SDWebImageContext *)context + progress:(nullable SDImageLoaderProgressBlock)progressBlock + completed:(nullable SDExternalCompletionBlock)completedBlock { + Class animatedImageClass = [SDAnimatedImage class]; + SDWebImageMutableContext *mutableContext; + if (context) { + mutableContext = [context mutableCopy]; + } else { + mutableContext = [NSMutableDictionary dictionary]; + } + mutableContext[SDWebImageContextAnimatedImageClass] = animatedImageClass; + [self sd_internalSetImageWithURL:url + placeholderImage:placeholder + options:options + context:mutableContext + setImageBlock:nil + progress:progressBlock + completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL) { + if (completedBlock) { + completedBlock(image, error, cacheType, imageURL); + } + }]; +} + +@end + +#endif diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImageView.h b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImageView.h new file mode 100644 index 0000000..f5f541b --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImageView.h @@ -0,0 +1,110 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageCompat.h" + +#if SD_UIKIT || SD_MAC + +#import "SDAnimatedImage.h" +#import "SDAnimatedImagePlayer.h" + +/** + A drop-in replacement for UIImageView/NSImageView, you can use this for animated image rendering. + Call `setImage:` with `UIImage(NSImage)` which conforms to `SDAnimatedImage` protocol will start animated image rendering. Call with normal UIImage(NSImage) will back to normal UIImageView(NSImageView) rendering + For UIKit: use `-startAnimating`, `-stopAnimating` to control animating. `isAnimating` to check animation state. + For AppKit: use `-setAnimates:` to control animating, `animates` to check animation state. This view is layer-backed. + */ +@interface SDAnimatedImageView : UIImageView +/** + The internal animation player. + This property is only used for advanced usage, like inspecting/debugging animation status, control progressive loading, complicated animation frame index control, etc. + @warning Pay attention if you directly update the player's property like `totalFrameCount`, `totalLoopCount`, the same property on `SDAnimatedImageView` may not get synced. + */ +@property (nonatomic, strong, readonly, nullable) SDAnimatedImagePlayer *player; + +/** + Current display frame image. This value is KVO Compliance. + */ +@property (nonatomic, strong, readonly, nullable) UIImage *currentFrame; +/** + Current frame index, zero based. This value is KVO Compliance. + */ +@property (nonatomic, assign, readonly) NSUInteger currentFrameIndex; +/** + Current loop count since its latest animating. This value is KVO Compliance. + */ +@property (nonatomic, assign, readonly) NSUInteger currentLoopCount; +/** + YES to choose `animationRepeatCount` property for animation loop count. No to use animated image's `animatedImageLoopCount` instead. + Default is NO. + */ +@property (nonatomic, assign) BOOL shouldCustomLoopCount; +/** + Total loop count for animated image rendering. Default is animated image's loop count. + If you need to set custom loop count, set `shouldCustomLoopCount` to YES and change this value. + This class override UIImageView's `animationRepeatCount` property on iOS, use this property as well. + */ +@property (nonatomic, assign) NSInteger animationRepeatCount; +/** + The animation playback rate. Default is 1.0. + `1.0` means the normal speed. + `0.0` means stopping the animation. + `0.0-1.0` means the slow speed. + `> 1.0` means the fast speed. + `< 0.0` is not supported currently and stop animation. (may support reverse playback in the future) + */ +@property (nonatomic, assign) double playbackRate; + +/// Asynchronous setup animation playback mode. Default mode is SDAnimatedImagePlaybackModeNormal. +@property (nonatomic, assign) SDAnimatedImagePlaybackMode playbackMode; + +/** + Provide a max buffer size by bytes. This is used to adjust frame buffer count and can be useful when the decoding cost is expensive (such as Animated WebP software decoding). Default is 0. + `0` means automatically adjust by calculating current memory usage. + `1` means without any buffer cache, each of frames will be decoded and then be freed after rendering. (Lowest Memory and Highest CPU) + `NSUIntegerMax` means cache all the buffer. (Lowest CPU and Highest Memory) + */ +@property (nonatomic, assign) NSUInteger maxBufferSize; +/** + Whehter or not to enable incremental image load for animated image. This is for the animated image which `sd_isIncremental` is YES (See `UIImage+Metadata.h`). If enable, animated image rendering will stop at the last frame available currently, and continue when another `setImage:` trigger, where the new animated image's `animatedImageData` should be updated from the previous one. If the `sd_isIncremental` is NO. The incremental image load stop. + @note If you are confused about this description, open Chrome browser to view some large GIF images with low network speed to see the animation behavior. + @note The best practice to use incremental load is using `initWithAnimatedCoder:scale:` in `SDAnimatedImage` with animated coder which conform to `SDProgressiveImageCoder` as well. Then call incremental update and incremental decode method to produce the image. + Default is YES. Set to NO to only render the static poster for incremental animated image. + */ +@property (nonatomic, assign) BOOL shouldIncrementalLoad; + +/** + Whether or not to clear the frame buffer cache when animation stopped. See `maxBufferSize` + This is useful when you want to limit the memory usage during frequently visibility changes (such as image view inside a list view, then push and pop) + Default is NO. + */ +@property (nonatomic, assign) BOOL clearBufferWhenStopped; + +/** + Whether or not to reset the current frame index when animation stopped. + For some of use case, you may want to reset the frame index to 0 when stop, but some other want to keep the current frame index. + Default is NO. + */ +@property (nonatomic, assign) BOOL resetFrameIndexWhenStopped; + +/** + If the image which conforms to `SDAnimatedImage` protocol has more than one frame, set this value to `YES` will automatically + play/stop the animation when the view become visible/invisible. + Default is YES. + */ +@property (nonatomic, assign) BOOL autoPlayAnimatedImage; + +/** + You can specify a runloop mode to let it rendering. + Default is NSRunLoopCommonModes on multi-core device, NSDefaultRunLoopMode on single-core device + @note This is useful for some cases, for example, always specify NSDefaultRunLoopMode, if you want to pause the animation when user scroll (for Mac user, drag the mouse or touchpad) + */ +@property (nonatomic, copy, nonnull) NSRunLoopMode runLoopMode; +@end + +#endif diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImageView.m b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImageView.m new file mode 100644 index 0000000..53d697f --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDAnimatedImageView.m @@ -0,0 +1,536 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDAnimatedImageView.h" + +#if SD_UIKIT || SD_MAC + +#import "UIImage+Metadata.h" +#import "NSImage+Compatibility.h" +#import "SDInternalMacros.h" +#import "objc/runtime.h" + +@interface UIImageView () +@end + +@interface SDAnimatedImageView () { + BOOL _initFinished; // Extra flag to mark the `commonInit` is called + NSRunLoopMode _runLoopMode; + NSUInteger _maxBufferSize; + double _playbackRate; + SDAnimatedImagePlaybackMode _playbackMode; +} + +@property (nonatomic, strong, readwrite) SDAnimatedImagePlayer *player; +@property (nonatomic, strong, readwrite) UIImage *currentFrame; +@property (nonatomic, assign, readwrite) NSUInteger currentFrameIndex; +@property (nonatomic, assign, readwrite) NSUInteger currentLoopCount; +@property (nonatomic, assign) BOOL shouldAnimate; +@property (nonatomic, assign) BOOL isProgressive; +@property (nonatomic) CALayer *imageViewLayer; // The actual rendering layer. + +@end + +@implementation SDAnimatedImageView +#if SD_UIKIT +@dynamic animationRepeatCount; // we re-use this property from `UIImageView` super class on iOS. +#endif + +#pragma mark - Initializers + +#if SD_MAC ++ (instancetype)imageViewWithImage:(NSImage *)image +{ + NSRect frame = NSMakeRect(0, 0, image.size.width, image.size.height); + SDAnimatedImageView *imageView = [[SDAnimatedImageView alloc] initWithFrame:frame]; + [imageView setImage:image]; + return imageView; +} +#else +// -initWithImage: isn't documented as a designated initializer of UIImageView, but it actually seems to be. +// Using -initWithImage: doesn't call any of the other designated initializers. +- (instancetype)initWithImage:(UIImage *)image +{ + self = [super initWithImage:image]; + if (self) { + [self commonInit]; + } + return self; +} + +// -initWithImage:highlightedImage: also isn't documented as a designated initializer of UIImageView, but it doesn't call any other designated initializers. +- (instancetype)initWithImage:(UIImage *)image highlightedImage:(UIImage *)highlightedImage +{ + self = [super initWithImage:image highlightedImage:highlightedImage]; + if (self) { + [self commonInit]; + } + return self; +} +#endif + +- (instancetype)initWithFrame:(CGRect)frame +{ + self = [super initWithFrame:frame]; + if (self) { + [self commonInit]; + } + return self; +} + +- (instancetype)initWithCoder:(NSCoder *)aDecoder +{ + self = [super initWithCoder:aDecoder]; + if (self) { + [self commonInit]; + } + return self; +} + +- (void)commonInit +{ + // Pay attention that UIKit's `initWithImage:` will trigger a `setImage:` during initialization before this `commonInit`. + // So the properties which rely on this order, should using lazy-evaluation or do extra check in `setImage:`. + self.autoPlayAnimatedImage = YES; + self.shouldCustomLoopCount = NO; + self.shouldIncrementalLoad = YES; + self.playbackRate = 1.0; +#if SD_MAC + self.wantsLayer = YES; +#endif + // Mark commonInit finished + _initFinished = YES; +} + +#pragma mark - Accessors +#pragma mark Public + +- (void)setImage:(UIImage *)image +{ + if (self.image == image) { + return; + } + + // Check Progressive rendering + [self updateIsProgressiveWithImage:image]; + + if (!self.isProgressive) { + // Stop animating + self.player = nil; + self.currentFrame = nil; + self.currentFrameIndex = 0; + self.currentLoopCount = 0; + } + + // We need call super method to keep function. This will impliedly call `setNeedsDisplay`. But we have no way to avoid this when using animated image. So we call `setNeedsDisplay` again at the end. + super.image = image; + if ([image.class conformsToProtocol:@protocol(SDAnimatedImage)]) { + if (!self.player) { + id provider; + // Check progressive loading + if (self.isProgressive) { + provider = [self progressiveAnimatedCoderForImage:image]; + } else { + provider = (id)image; + } + // Create animated player + self.player = [SDAnimatedImagePlayer playerWithProvider:provider]; + } else { + // Update Frame Count + self.player.totalFrameCount = [(id)image animatedImageFrameCount]; + } + + if (!self.player) { + // animated player nil means the image format is not supported, or frame count <= 1 + return; + } + + // Custom Loop Count + if (self.shouldCustomLoopCount) { + self.player.totalLoopCount = self.animationRepeatCount; + } + + // RunLoop Mode + self.player.runLoopMode = self.runLoopMode; + + // Max Buffer Size + self.player.maxBufferSize = self.maxBufferSize; + + // Play Rate + self.player.playbackRate = self.playbackRate; + + // Play Mode + self.player.playbackMode = self.playbackMode; + + // Setup handler + @weakify(self); + self.player.animationFrameHandler = ^(NSUInteger index, UIImage * frame) { + @strongify(self); + self.currentFrameIndex = index; + self.currentFrame = frame; + [self.imageViewLayer setNeedsDisplay]; + }; + self.player.animationLoopHandler = ^(NSUInteger loopCount) { + @strongify(self); + // Progressive image reach the current last frame index. Keep the state and pause animating. Wait for later restart + if (self.isProgressive) { + NSUInteger lastFrameIndex = self.player.totalFrameCount - 1; + [self.player seekToFrameAtIndex:lastFrameIndex loopCount:0]; + [self.player pausePlaying]; + } else { + self.currentLoopCount = loopCount; + } + }; + + // Ensure disabled highlighting; it's not supported (see `-setHighlighted:`). + super.highlighted = NO; + + [self stopAnimating]; + [self checkPlay]; + + [self.imageViewLayer setNeedsDisplay]; + } +} + +#pragma mark - Configuration + +- (void)setRunLoopMode:(NSRunLoopMode)runLoopMode +{ + _runLoopMode = [runLoopMode copy]; + self.player.runLoopMode = runLoopMode; +} + +- (NSRunLoopMode)runLoopMode +{ + if (!_runLoopMode) { + _runLoopMode = [[self class] defaultRunLoopMode]; + } + return _runLoopMode; +} + ++ (NSString *)defaultRunLoopMode { + // Key off `activeProcessorCount` (as opposed to `processorCount`) since the system could shut down cores in certain situations. + return [NSProcessInfo processInfo].activeProcessorCount > 1 ? NSRunLoopCommonModes : NSDefaultRunLoopMode; +} + +- (void)setMaxBufferSize:(NSUInteger)maxBufferSize +{ + _maxBufferSize = maxBufferSize; + self.player.maxBufferSize = maxBufferSize; +} + +- (NSUInteger)maxBufferSize { + return _maxBufferSize; // Defaults to 0 +} + +- (void)setPlaybackRate:(double)playbackRate +{ + _playbackRate = playbackRate; + self.player.playbackRate = playbackRate; +} + +- (double)playbackRate +{ + if (!_initFinished) { + return 1.0; // Defaults to 1.0 + } + return _playbackRate; +} + +- (void)setPlaybackMode:(SDAnimatedImagePlaybackMode)playbackMode { + _playbackMode = playbackMode; + self.player.playbackMode = playbackMode; +} + +- (SDAnimatedImagePlaybackMode)playbackMode { + if (!_initFinished) { + return SDAnimatedImagePlaybackModeNormal; // Default mode is normal + } + return _playbackMode; +} + + +- (BOOL)shouldIncrementalLoad +{ + if (!_initFinished) { + return YES; // Defaults to YES + } + return _initFinished; +} + +#pragma mark - UIView Method Overrides +#pragma mark Observing View-Related Changes + +#if SD_MAC +- (void)viewDidMoveToSuperview +#else +- (void)didMoveToSuperview +#endif +{ +#if SD_MAC + [super viewDidMoveToSuperview]; +#else + [super didMoveToSuperview]; +#endif + + [self checkPlay]; +} + +#if SD_MAC +- (void)viewDidMoveToWindow +#else +- (void)didMoveToWindow +#endif +{ +#if SD_MAC + [super viewDidMoveToWindow]; +#else + [super didMoveToWindow]; +#endif + + [self checkPlay]; +} + +#if SD_MAC +- (void)setAlphaValue:(CGFloat)alphaValue +#else +- (void)setAlpha:(CGFloat)alpha +#endif +{ +#if SD_MAC + [super setAlphaValue:alphaValue]; +#else + [super setAlpha:alpha]; +#endif + + [self checkPlay]; +} + +- (void)setHidden:(BOOL)hidden +{ + [super setHidden:hidden]; + + [self checkPlay]; +} + +#pragma mark - UIImageView Method Overrides +#pragma mark Image Data + +- (void)setAnimationRepeatCount:(NSInteger)animationRepeatCount +{ +#if SD_UIKIT + [super setAnimationRepeatCount:animationRepeatCount]; +#else + _animationRepeatCount = animationRepeatCount; +#endif + + if (self.shouldCustomLoopCount) { + self.player.totalLoopCount = animationRepeatCount; + } +} + +- (void)startAnimating +{ + if (self.player) { + [self updateShouldAnimate]; + if (self.shouldAnimate) { + [self.player startPlaying]; + } + } else { +#if SD_UIKIT + [super startAnimating]; +#else + [super setAnimates:YES]; +#endif + } +} + +- (void)stopAnimating +{ + if (self.player) { + if (self.resetFrameIndexWhenStopped) { + [self.player stopPlaying]; + } else { + [self.player pausePlaying]; + } + if (self.clearBufferWhenStopped) { + [self.player clearFrameBuffer]; + } + } else { +#if SD_UIKIT + [super stopAnimating]; +#else + [super setAnimates:NO]; +#endif + } +} + +#if SD_UIKIT +- (BOOL)isAnimating +{ + if (self.player) { + return self.player.isPlaying; + } else { + return [super isAnimating]; + } +} +#endif + +#if SD_MAC +- (BOOL)animates +{ + if (self.player) { + return self.player.isPlaying; + } else { + return [super animates]; + } +} + +- (void)setAnimates:(BOOL)animates +{ + if (animates) { + [self startAnimating]; + } else { + [self stopAnimating]; + } +} +#endif + +#pragma mark Highlighted Image Unsupport + +- (void)setHighlighted:(BOOL)highlighted +{ + // Highlighted image is unsupported for animated images, but implementing it breaks the image view when embedded in a UICollectionViewCell. + if (!self.player) { + [super setHighlighted:highlighted]; + } +} + + +#pragma mark - Private Methods +#pragma mark Animation + +/// Check if it should be played +- (void)checkPlay +{ + // Only handle for SDAnimatedImage, leave UIAnimatedImage or animationImages for super implementation control + if (self.player && self.autoPlayAnimatedImage) { + [self updateShouldAnimate]; + if (self.shouldAnimate) { + [self startAnimating]; + } else { + [self stopAnimating]; + } + } +} + +// Don't repeatedly check our window & superview in `-displayDidRefresh:` for performance reasons. +// Just update our cached value whenever the animated image or visibility (window, superview, hidden, alpha) is changed. +- (void)updateShouldAnimate +{ +#if SD_MAC + BOOL isVisible = self.window && self.superview && ![self isHidden] && self.alphaValue > 0.0; +#else + BOOL isVisible = self.window && self.superview && ![self isHidden] && self.alpha > 0.0; +#endif + self.shouldAnimate = self.player && isVisible; +} + +// Update progressive status only after `setImage:` call. +- (void)updateIsProgressiveWithImage:(UIImage *)image +{ + self.isProgressive = NO; + if (!self.shouldIncrementalLoad) { + // Early return + return; + } + // We must use `image.class conformsToProtocol:` instead of `image conformsToProtocol:` here + // Because UIKit on macOS, using internal hard-coded override method, which returns NO + id currentAnimatedCoder = [self progressiveAnimatedCoderForImage:image]; + if (currentAnimatedCoder) { + UIImage *previousImage = self.image; + if (!previousImage) { + // If current animated coder supports progressive, and no previous image to check, start progressive loading + self.isProgressive = YES; + } else { + id previousAnimatedCoder = [self progressiveAnimatedCoderForImage:previousImage]; + if (previousAnimatedCoder == currentAnimatedCoder) { + // If current animated coder is the same as previous, start progressive loading + self.isProgressive = YES; + } + } + } +} + +// Check if image can represent a `Progressive Animated Image` during loading +- (id)progressiveAnimatedCoderForImage:(UIImage *)image +{ + if ([image.class conformsToProtocol:@protocol(SDAnimatedImage)] && image.sd_isIncremental && [image respondsToSelector:@selector(animatedCoder)]) { + id animatedCoder = [(id)image animatedCoder]; + if ([animatedCoder conformsToProtocol:@protocol(SDProgressiveImageCoder)]) { + return (id)animatedCoder; + } + } + return nil; +} + + +#pragma mark Providing the Layer's Content +#pragma mark - CALayerDelegate + +- (void)displayLayer:(CALayer *)layer +{ + UIImage *currentFrame = self.currentFrame; + if (currentFrame) { + layer.contentsScale = currentFrame.scale; + layer.contents = (__bridge id)currentFrame.CGImage; + } else { + // If we have no animation frames, call super implementation. iOS 14+ UIImageView use this delegate method for rendering. + if ([UIImageView instancesRespondToSelector:@selector(displayLayer:)]) { + [super displayLayer:layer]; + } + } +} + +#if SD_MAC +// NSImageView use a subview. We need this subview's layer for actual rendering. +// Why using this design may because of properties like `imageAlignment` and `imageScaling`, which it's not available for UIImageView.contentMode (it's impossible to align left and keep aspect ratio at the same time) +- (NSView *)imageView { + NSImageView *imageView = objc_getAssociatedObject(self, SD_SEL_SPI(imageView)); + if (!imageView) { + // macOS 10.14 + imageView = objc_getAssociatedObject(self, SD_SEL_SPI(imageSubview)); + } + return imageView; +} + +// on macOS, it's the imageView subview's layer (we use layer-hosting view to let CALayerDelegate works) +- (CALayer *)imageViewLayer { + NSView *imageView = self.imageView; + if (!imageView) { + return nil; + } + if (!_imageViewLayer) { + _imageViewLayer = [CALayer new]; + _imageViewLayer.delegate = self; + imageView.layer = _imageViewLayer; + imageView.wantsLayer = YES; + } + return _imageViewLayer; +} +#else +// on iOS, it's the imageView itself's layer +- (CALayer *)imageViewLayer { + return self.layer; +} + +#endif + +@end + +#endif diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDDiskCache.h b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDDiskCache.h new file mode 100644 index 0000000..dc5e1fa --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDDiskCache.h @@ -0,0 +1,145 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageCompat.h" + +@class SDImageCacheConfig; +/** + A protocol to allow custom disk cache used in SDImageCache. + */ +@protocol SDDiskCache + +// All of these method are called from the same global queue to avoid blocking on main queue and thread-safe problem. But it's also recommend to ensure thread-safe yourself using lock or other ways. +@required +/** + Create a new disk cache based on the specified path. You can check `maxDiskSize` and `maxDiskAge` used for disk cache. + + @param cachePath Full path of a directory in which the cache will write data. + Once initialized you should not read and write to this directory. + @param config The cache config to be used to create the cache. + + @return A new cache object, or nil if an error occurs. + */ +- (nullable instancetype)initWithCachePath:(nonnull NSString *)cachePath config:(nonnull SDImageCacheConfig *)config; + +/** + Returns a boolean value that indicates whether a given key is in cache. + This method may blocks the calling thread until file read finished. + + @param key A string identifying the data. If nil, just return NO. + @return Whether the key is in cache. + */ +- (BOOL)containsDataForKey:(nonnull NSString *)key; + +/** + Returns the data associated with a given key. + This method may blocks the calling thread until file read finished. + + @param key A string identifying the data. If nil, just return nil. + @return The value associated with key, or nil if no value is associated with key. + */ +- (nullable NSData *)dataForKey:(nonnull NSString *)key; + +/** + Sets the value of the specified key in the cache. + This method may blocks the calling thread until file write finished. + + @param data The data to be stored in the cache. + @param key The key with which to associate the value. If nil, this method has no effect. + */ +- (void)setData:(nullable NSData *)data forKey:(nonnull NSString *)key; + +/** + Returns the extended data associated with a given key. + This method may blocks the calling thread until file read finished. + + @param key A string identifying the data. If nil, just return nil. + @return The value associated with key, or nil if no value is associated with key. + */ +- (nullable NSData *)extendedDataForKey:(nonnull NSString *)key; + +/** + Set extended data with a given key. + + @discussion You can set any extended data to exist cache key. Without override the exist disk file data. + on UNIX, the common way for this is to use the Extended file attributes (xattr) + + @param extendedData The extended data (pass nil to remove). + @param key The key with which to associate the value. If nil, this method has no effect. +*/ +- (void)setExtendedData:(nullable NSData *)extendedData forKey:(nonnull NSString *)key; + +/** + Removes the value of the specified key in the cache. + This method may blocks the calling thread until file delete finished. + + @param key The key identifying the value to be removed. If nil, this method has no effect. + */ +- (void)removeDataForKey:(nonnull NSString *)key; + +/** + Empties the cache. + This method may blocks the calling thread until file delete finished. + */ +- (void)removeAllData; + +/** + Removes the expired data from the cache. You can choose the data to remove base on `ageLimit`, `countLimit` and `sizeLimit` options. + */ +- (void)removeExpiredData; + +/** + The cache path for key + + @param key A string identifying the value + @return The cache path for key. Or nil if the key can not associate to a path + */ +- (nullable NSString *)cachePathForKey:(nonnull NSString *)key; + +/** + Returns the number of data in this cache. + This method may blocks the calling thread until file read finished. + + @return The total data count. + */ +- (NSUInteger)totalCount; + +/** + Returns the total size (in bytes) of data in this cache. + This method may blocks the calling thread until file read finished. + + @return The total data size in bytes. + */ +- (NSUInteger)totalSize; + +@end + +/** + The built-in disk cache. + */ +@interface SDDiskCache : NSObject +/** + Cache Config object - storing all kind of settings. + */ +@property (nonatomic, strong, readonly, nonnull) SDImageCacheConfig *config; + +- (nonnull instancetype)init NS_UNAVAILABLE; + +/** + Move the cache directory from old location to new location, the old location will be removed after finish. + If the old location does not exist, does nothing. + If the new location does not exist, only do a movement of directory. + If the new location does exist, will move and merge the files from old location. + If the new location does exist, but is not a directory, will remove it and do a movement of directory. + + @param srcPath old location of cache directory + @param dstPath new location of cache directory + */ +- (void)moveCacheDirectoryFromPath:(nonnull NSString *)srcPath toPath:(nonnull NSString *)dstPath; + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDDiskCache.m b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDDiskCache.m new file mode 100644 index 0000000..2cdb766 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDDiskCache.m @@ -0,0 +1,326 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDDiskCache.h" +#import "SDImageCacheConfig.h" +#import "SDFileAttributeHelper.h" +#import + +static NSString * const SDDiskCacheExtendedAttributeName = @"com.hackemist.SDDiskCache"; + +@interface SDDiskCache () + +@property (nonatomic, copy) NSString *diskCachePath; +@property (nonatomic, strong, nonnull) NSFileManager *fileManager; + +@end + +@implementation SDDiskCache + +- (instancetype)init { + NSAssert(NO, @"Use `initWithCachePath:` with the disk cache path"); + return nil; +} + +#pragma mark - SDcachePathForKeyDiskCache Protocol +- (instancetype)initWithCachePath:(NSString *)cachePath config:(nonnull SDImageCacheConfig *)config { + if (self = [super init]) { + _diskCachePath = cachePath; + _config = config; + [self commonInit]; + } + return self; +} + +- (void)commonInit { + if (self.config.fileManager) { + self.fileManager = self.config.fileManager; + } else { + self.fileManager = [NSFileManager new]; + } +} + +- (BOOL)containsDataForKey:(NSString *)key { + NSParameterAssert(key); + NSString *filePath = [self cachePathForKey:key]; + BOOL exists = [self.fileManager fileExistsAtPath:filePath]; + + // fallback because of https://github.com/rs/SDWebImage/pull/976 that added the extension to the disk file name + // checking the key with and without the extension + if (!exists) { + exists = [self.fileManager fileExistsAtPath:filePath.stringByDeletingPathExtension]; + } + + return exists; +} + +- (NSData *)dataForKey:(NSString *)key { + NSParameterAssert(key); + NSString *filePath = [self cachePathForKey:key]; + NSData *data = [NSData dataWithContentsOfFile:filePath options:self.config.diskCacheReadingOptions error:nil]; + if (data) { + return data; + } + + // fallback because of https://github.com/rs/SDWebImage/pull/976 that added the extension to the disk file name + // checking the key with and without the extension + data = [NSData dataWithContentsOfFile:filePath.stringByDeletingPathExtension options:self.config.diskCacheReadingOptions error:nil]; + if (data) { + return data; + } + + return nil; +} + +- (void)setData:(NSData *)data forKey:(NSString *)key { + NSParameterAssert(data); + NSParameterAssert(key); + if (![self.fileManager fileExistsAtPath:self.diskCachePath]) { + [self.fileManager createDirectoryAtPath:self.diskCachePath withIntermediateDirectories:YES attributes:nil error:NULL]; + } + + // get cache Path for image key + NSString *cachePathForKey = [self cachePathForKey:key]; + // transform to NSURL + NSURL *fileURL = [NSURL fileURLWithPath:cachePathForKey isDirectory:NO]; + + [data writeToURL:fileURL options:self.config.diskCacheWritingOptions error:nil]; + + // disable iCloud backup + if (self.config.shouldDisableiCloud) { + // ignore iCloud backup resource value error + [fileURL setResourceValue:@YES forKey:NSURLIsExcludedFromBackupKey error:nil]; + } +} + +- (NSData *)extendedDataForKey:(NSString *)key { + NSParameterAssert(key); + + // get cache Path for image key + NSString *cachePathForKey = [self cachePathForKey:key]; + + NSData *extendedData = [SDFileAttributeHelper extendedAttribute:SDDiskCacheExtendedAttributeName atPath:cachePathForKey traverseLink:NO error:nil]; + + return extendedData; +} + +- (void)setExtendedData:(NSData *)extendedData forKey:(NSString *)key { + NSParameterAssert(key); + // get cache Path for image key + NSString *cachePathForKey = [self cachePathForKey:key]; + + if (!extendedData) { + // Remove + [SDFileAttributeHelper removeExtendedAttribute:SDDiskCacheExtendedAttributeName atPath:cachePathForKey traverseLink:NO error:nil]; + } else { + // Override + [SDFileAttributeHelper setExtendedAttribute:SDDiskCacheExtendedAttributeName value:extendedData atPath:cachePathForKey traverseLink:NO overwrite:YES error:nil]; + } +} + +- (void)removeDataForKey:(NSString *)key { + NSParameterAssert(key); + NSString *filePath = [self cachePathForKey:key]; + [self.fileManager removeItemAtPath:filePath error:nil]; +} + +- (void)removeAllData { + [self.fileManager removeItemAtPath:self.diskCachePath error:nil]; + [self.fileManager createDirectoryAtPath:self.diskCachePath + withIntermediateDirectories:YES + attributes:nil + error:NULL]; +} + +- (void)removeExpiredData { + NSURL *diskCacheURL = [NSURL fileURLWithPath:self.diskCachePath isDirectory:YES]; + + // Compute content date key to be used for tests + NSURLResourceKey cacheContentDateKey = NSURLContentModificationDateKey; + switch (self.config.diskCacheExpireType) { + case SDImageCacheConfigExpireTypeAccessDate: + cacheContentDateKey = NSURLContentAccessDateKey; + break; + case SDImageCacheConfigExpireTypeModificationDate: + cacheContentDateKey = NSURLContentModificationDateKey; + break; + case SDImageCacheConfigExpireTypeCreationDate: + cacheContentDateKey = NSURLCreationDateKey; + break; + case SDImageCacheConfigExpireTypeChangeDate: + cacheContentDateKey = NSURLAttributeModificationDateKey; + break; + default: + break; + } + + NSArray *resourceKeys = @[NSURLIsDirectoryKey, cacheContentDateKey, NSURLTotalFileAllocatedSizeKey]; + + // This enumerator prefetches useful properties for our cache files. + NSDirectoryEnumerator *fileEnumerator = [self.fileManager enumeratorAtURL:diskCacheURL + includingPropertiesForKeys:resourceKeys + options:NSDirectoryEnumerationSkipsHiddenFiles + errorHandler:NULL]; + + NSDate *expirationDate = (self.config.maxDiskAge < 0) ? nil: [NSDate dateWithTimeIntervalSinceNow:-self.config.maxDiskAge]; + NSMutableDictionary *> *cacheFiles = [NSMutableDictionary dictionary]; + NSUInteger currentCacheSize = 0; + + // Enumerate all of the files in the cache directory. This loop has two purposes: + // + // 1. Removing files that are older than the expiration date. + // 2. Storing file attributes for the size-based cleanup pass. + NSMutableArray *urlsToDelete = [[NSMutableArray alloc] init]; + for (NSURL *fileURL in fileEnumerator) { + NSError *error; + NSDictionary *resourceValues = [fileURL resourceValuesForKeys:resourceKeys error:&error]; + + // Skip directories and errors. + if (error || !resourceValues || [resourceValues[NSURLIsDirectoryKey] boolValue]) { + continue; + } + + // Remove files that are older than the expiration date; + NSDate *modifiedDate = resourceValues[cacheContentDateKey]; + if (expirationDate && [[modifiedDate laterDate:expirationDate] isEqualToDate:expirationDate]) { + [urlsToDelete addObject:fileURL]; + continue; + } + + // Store a reference to this file and account for its total size. + NSNumber *totalAllocatedSize = resourceValues[NSURLTotalFileAllocatedSizeKey]; + currentCacheSize += totalAllocatedSize.unsignedIntegerValue; + cacheFiles[fileURL] = resourceValues; + } + + for (NSURL *fileURL in urlsToDelete) { + [self.fileManager removeItemAtURL:fileURL error:nil]; + } + + // If our remaining disk cache exceeds a configured maximum size, perform a second + // size-based cleanup pass. We delete the oldest files first. + NSUInteger maxDiskSize = self.config.maxDiskSize; + if (maxDiskSize > 0 && currentCacheSize > maxDiskSize) { + // Target half of our maximum cache size for this cleanup pass. + const NSUInteger desiredCacheSize = maxDiskSize / 2; + + // Sort the remaining cache files by their last modification time or last access time (oldest first). + NSArray *sortedFiles = [cacheFiles keysSortedByValueWithOptions:NSSortConcurrent + usingComparator:^NSComparisonResult(id obj1, id obj2) { + return [obj1[cacheContentDateKey] compare:obj2[cacheContentDateKey]]; + }]; + + // Delete files until we fall below our desired cache size. + for (NSURL *fileURL in sortedFiles) { + if ([self.fileManager removeItemAtURL:fileURL error:nil]) { + NSDictionary *resourceValues = cacheFiles[fileURL]; + NSNumber *totalAllocatedSize = resourceValues[NSURLTotalFileAllocatedSizeKey]; + currentCacheSize -= totalAllocatedSize.unsignedIntegerValue; + + if (currentCacheSize < desiredCacheSize) { + break; + } + } + } + } +} + +- (nullable NSString *)cachePathForKey:(NSString *)key { + NSParameterAssert(key); + return [self cachePathForKey:key inPath:self.diskCachePath]; +} + +- (NSUInteger)totalSize { + NSUInteger size = 0; + NSDirectoryEnumerator *fileEnumerator = [self.fileManager enumeratorAtPath:self.diskCachePath]; + for (NSString *fileName in fileEnumerator) { + NSString *filePath = [self.diskCachePath stringByAppendingPathComponent:fileName]; + NSDictionary *attrs = [self.fileManager attributesOfItemAtPath:filePath error:nil]; + size += [attrs fileSize]; + } + return size; +} + +- (NSUInteger)totalCount { + NSUInteger count = 0; + NSDirectoryEnumerator *fileEnumerator = [self.fileManager enumeratorAtPath:self.diskCachePath]; + count = fileEnumerator.allObjects.count; + return count; +} + +#pragma mark - Cache paths + +- (nullable NSString *)cachePathForKey:(nullable NSString *)key inPath:(nonnull NSString *)path { + NSString *filename = SDDiskCacheFileNameForKey(key); + return [path stringByAppendingPathComponent:filename]; +} + +- (void)moveCacheDirectoryFromPath:(nonnull NSString *)srcPath toPath:(nonnull NSString *)dstPath { + NSParameterAssert(srcPath); + NSParameterAssert(dstPath); + // Check if old path is equal to new path + if ([srcPath isEqualToString:dstPath]) { + return; + } + BOOL isDirectory; + // Check if old path is directory + if (![self.fileManager fileExistsAtPath:srcPath isDirectory:&isDirectory] || !isDirectory) { + return; + } + // Check if new path is directory + if (![self.fileManager fileExistsAtPath:dstPath isDirectory:&isDirectory] || !isDirectory) { + if (!isDirectory) { + // New path is not directory, remove file + [self.fileManager removeItemAtPath:dstPath error:nil]; + } + NSString *dstParentPath = [dstPath stringByDeletingLastPathComponent]; + // Creates any non-existent parent directories as part of creating the directory in path + if (![self.fileManager fileExistsAtPath:dstParentPath]) { + [self.fileManager createDirectoryAtPath:dstParentPath withIntermediateDirectories:YES attributes:nil error:NULL]; + } + // New directory does not exist, rename directory + [self.fileManager moveItemAtPath:srcPath toPath:dstPath error:nil]; + } else { + // New directory exist, merge the files + NSDirectoryEnumerator *dirEnumerator = [self.fileManager enumeratorAtPath:srcPath]; + NSString *file; + while ((file = [dirEnumerator nextObject])) { + [self.fileManager moveItemAtPath:[srcPath stringByAppendingPathComponent:file] toPath:[dstPath stringByAppendingPathComponent:file] error:nil]; + } + // Remove the old path + [self.fileManager removeItemAtPath:srcPath error:nil]; + } +} + +#pragma mark - Hash + +#define SD_MAX_FILE_EXTENSION_LENGTH (NAME_MAX - CC_MD5_DIGEST_LENGTH * 2 - 1) + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" +static inline NSString * _Nonnull SDDiskCacheFileNameForKey(NSString * _Nullable key) { + const char *str = key.UTF8String; + if (str == NULL) { + str = ""; + } + unsigned char r[CC_MD5_DIGEST_LENGTH]; + CC_MD5(str, (CC_LONG)strlen(str), r); + NSURL *keyURL = [NSURL URLWithString:key]; + NSString *ext = keyURL ? keyURL.pathExtension : key.pathExtension; + // File system has file name length limit, we need to check if ext is too long, we don't add it to the filename + if (ext.length > SD_MAX_FILE_EXTENSION_LENGTH) { + ext = nil; + } + NSString *filename = [NSString stringWithFormat:@"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%@", + r[0], r[1], r[2], r[3], r[4], r[5], r[6], r[7], r[8], r[9], r[10], + r[11], r[12], r[13], r[14], r[15], ext.length == 0 ? @"" : [NSString stringWithFormat:@".%@", ext]]; + return filename; +} +#pragma clang diagnostic pop + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDGraphicsImageRenderer.h b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDGraphicsImageRenderer.h new file mode 100644 index 0000000..900acd7 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDGraphicsImageRenderer.h @@ -0,0 +1,73 @@ +/* +* This file is part of the SDWebImage package. +* (c) Olivier Poitrey +* +* For the full copyright and license information, please view the LICENSE +* file that was distributed with this source code. +*/ + +#import "SDWebImageCompat.h" + +/** + These following class are provided to use `UIGraphicsImageRenderer` with polyfill, which allows write cross-platform(AppKit/UIKit) code and avoid runtime version check. + Compared to `UIGraphicsBeginImageContext`, `UIGraphicsImageRenderer` use dynamic bitmap from your draw code to generate CGContext, not always use ARGB8888, which is more performant on RAM usage. + Which means, if you draw CGImage/CIImage which contains grayscale only, the underlaying bitmap context use grayscale, it's managed by system and not a fixed type. (actually, the `kCGContextTypeAutomatic`) + For usage, See more in Apple's documentation: https://developer.apple.com/documentation/uikit/uigraphicsimagerenderer + For UIKit on iOS/tvOS 10+, these method just use the same `UIGraphicsImageRenderer` API. + For others (macOS/watchOS or iOS/tvOS 10-), these method use the `SDImageGraphics.h` to implements the same behavior (but without dynamic bitmap support) +*/ + +typedef void (^SDGraphicsImageDrawingActions)(CGContextRef _Nonnull context); +typedef NS_ENUM(NSInteger, SDGraphicsImageRendererFormatRange) { + SDGraphicsImageRendererFormatRangeUnspecified = -1, + SDGraphicsImageRendererFormatRangeAutomatic = 0, + SDGraphicsImageRendererFormatRangeExtended, + SDGraphicsImageRendererFormatRangeStandard +}; + +/// A set of drawing attributes that represent the configuration of an image renderer context. +@interface SDGraphicsImageRendererFormat : NSObject + +/// The display scale of the image renderer context. +/// The default value is equal to the scale of the main screen. +@property (nonatomic) CGFloat scale; + +/// A Boolean value indicating whether the underlying Core Graphics context has an alpha channel. +/// The default value is NO. +@property (nonatomic) BOOL opaque; + +/// Specifying whether the bitmap context should use extended color. +/// For iOS 12+, the value is from system `preferredRange` property +/// For iOS 10-11, the value is from system `prefersExtendedRange` property +/// For iOS 9-, the value is `.standard` +@property (nonatomic) SDGraphicsImageRendererFormatRange preferredRange; + +/// Init the default format. See each properties's default value. +- (nonnull instancetype)init; + +/// Returns a new format best suited for the main screen’s current configuration. ++ (nonnull instancetype)preferredFormat; + +@end + +/// A graphics renderer for creating Core Graphics-backed images. +@interface SDGraphicsImageRenderer : NSObject + +/// Creates an image renderer for drawing images of a given size. +/// @param size The size of images output from the renderer, specified in points. +/// @return An initialized image renderer. +- (nonnull instancetype)initWithSize:(CGSize)size; + +/// Creates a new image renderer with a given size and format. +/// @param size The size of images output from the renderer, specified in points. +/// @param format A SDGraphicsImageRendererFormat object that encapsulates the format used to create the renderer context. +/// @return An initialized image renderer. +- (nonnull instancetype)initWithSize:(CGSize)size format:(nonnull SDGraphicsImageRendererFormat *)format; + +/// Creates an image by following a set of drawing instructions. +/// @param actions A SDGraphicsImageDrawingActions block that, when invoked by the renderer, executes a set of drawing instructions to create the output image. +/// @note You should not retain or use the context outside the block, it's non-escaping. +/// @return A UIImage object created by the supplied drawing actions. +- (nonnull UIImage *)imageWithActions:(nonnull NS_NOESCAPE SDGraphicsImageDrawingActions)actions; + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDGraphicsImageRenderer.m b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDGraphicsImageRenderer.m new file mode 100644 index 0000000..aeda97b --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDGraphicsImageRenderer.m @@ -0,0 +1,256 @@ +/* +* This file is part of the SDWebImage package. +* (c) Olivier Poitrey +* +* For the full copyright and license information, please view the LICENSE +* file that was distributed with this source code. +*/ + +#import "SDGraphicsImageRenderer.h" +#import "SDImageGraphics.h" + +@interface SDGraphicsImageRendererFormat () +#if SD_UIKIT +@property (nonatomic, strong) UIGraphicsImageRendererFormat *uiformat API_AVAILABLE(ios(10.0), tvos(10.0)); +#endif +@end + +@implementation SDGraphicsImageRendererFormat +@synthesize scale = _scale; +@synthesize opaque = _opaque; +@synthesize preferredRange = _preferredRange; + +#pragma mark - Property +- (CGFloat)scale { +#if SD_UIKIT + if (@available(iOS 10.0, tvOS 10.10, *)) { + return self.uiformat.scale; + } else { + return _scale; + } +#else + return _scale; +#endif +} + +- (void)setScale:(CGFloat)scale { +#if SD_UIKIT + if (@available(iOS 10.0, tvOS 10.10, *)) { + self.uiformat.scale = scale; + } else { + _scale = scale; + } +#else + _scale = scale; +#endif +} + +- (BOOL)opaque { +#if SD_UIKIT + if (@available(iOS 10.0, tvOS 10.10, *)) { + return self.uiformat.opaque; + } else { + return _opaque; + } +#else + return _opaque; +#endif +} + +- (void)setOpaque:(BOOL)opaque { +#if SD_UIKIT + if (@available(iOS 10.0, tvOS 10.10, *)) { + self.uiformat.opaque = opaque; + } else { + _opaque = opaque; + } +#else + _opaque = opaque; +#endif +} + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" +- (SDGraphicsImageRendererFormatRange)preferredRange { +#if SD_UIKIT + if (@available(iOS 10.0, tvOS 10.10, *)) { + if (@available(iOS 12.0, tvOS 12.0, *)) { + return (SDGraphicsImageRendererFormatRange)self.uiformat.preferredRange; + } else { + BOOL prefersExtendedRange = self.uiformat.prefersExtendedRange; + if (prefersExtendedRange) { + return SDGraphicsImageRendererFormatRangeExtended; + } else { + return SDGraphicsImageRendererFormatRangeStandard; + } + } + } else { + return _preferredRange; + } +#else + return _preferredRange; +#endif +} + +- (void)setPreferredRange:(SDGraphicsImageRendererFormatRange)preferredRange { +#if SD_UIKIT + if (@available(iOS 10.0, tvOS 10.10, *)) { + if (@available(iOS 12.0, tvOS 12.0, *)) { + self.uiformat.preferredRange = (UIGraphicsImageRendererFormatRange)preferredRange; + } else { + switch (preferredRange) { + case SDGraphicsImageRendererFormatRangeExtended: + self.uiformat.prefersExtendedRange = YES; + break; + case SDGraphicsImageRendererFormatRangeStandard: + self.uiformat.prefersExtendedRange = NO; + default: + // Automatic means default + break; + } + } + } else { + _preferredRange = preferredRange; + } +#else + _preferredRange = preferredRange; +#endif +} +#pragma clang diagnostic pop + +- (instancetype)init { + self = [super init]; + if (self) { +#if SD_UIKIT + if (@available(iOS 10.0, tvOS 10.10, *)) { + UIGraphicsImageRendererFormat *uiformat = [[UIGraphicsImageRendererFormat alloc] init]; + self.uiformat = uiformat; + } else { +#endif +#if SD_WATCH + CGFloat screenScale = [WKInterfaceDevice currentDevice].screenScale; +#elif SD_UIKIT + CGFloat screenScale = [UIScreen mainScreen].scale; +#elif SD_MAC + NSScreen *mainScreen = nil; + if (@available(macOS 10.12, *)) { + mainScreen = [NSScreen mainScreen]; + } else { + mainScreen = [NSScreen screens].firstObject; + } + CGFloat screenScale = mainScreen.backingScaleFactor ?: 1.0f; +#endif + self.scale = screenScale; + self.opaque = NO; + self.preferredRange = SDGraphicsImageRendererFormatRangeStandard; +#if SD_UIKIT + } +#endif + } + return self; +} + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunguarded-availability" +- (instancetype)initForMainScreen { + self = [super init]; + if (self) { +#if SD_UIKIT + if (@available(iOS 10.0, tvOS 10.0, *)) { + UIGraphicsImageRendererFormat *uiformat; + // iOS 11.0.0 GM does have `preferredFormat`, but iOS 11 betas did not (argh!) + if ([UIGraphicsImageRenderer respondsToSelector:@selector(preferredFormat)]) { + uiformat = [UIGraphicsImageRendererFormat preferredFormat]; + } else { + uiformat = [UIGraphicsImageRendererFormat defaultFormat]; + } + self.uiformat = uiformat; + } else { +#endif +#if SD_WATCH + CGFloat screenScale = [WKInterfaceDevice currentDevice].screenScale; +#elif SD_UIKIT + CGFloat screenScale = [UIScreen mainScreen].scale; +#elif SD_MAC + NSScreen *mainScreen = nil; + if (@available(macOS 10.12, *)) { + mainScreen = [NSScreen mainScreen]; + } else { + mainScreen = [NSScreen screens].firstObject; + } + CGFloat screenScale = mainScreen.backingScaleFactor ?: 1.0f; +#endif + self.scale = screenScale; + self.opaque = NO; + self.preferredRange = SDGraphicsImageRendererFormatRangeStandard; +#if SD_UIKIT + } +#endif + } + return self; +} +#pragma clang diagnostic pop + ++ (instancetype)preferredFormat { + SDGraphicsImageRendererFormat *format = [[SDGraphicsImageRendererFormat alloc] initForMainScreen]; + return format; +} + +@end + +@interface SDGraphicsImageRenderer () +@property (nonatomic, assign) CGSize size; +@property (nonatomic, strong) SDGraphicsImageRendererFormat *format; +#if SD_UIKIT +@property (nonatomic, strong) UIGraphicsImageRenderer *uirenderer API_AVAILABLE(ios(10.0), tvos(10.0)); +#endif +@end + +@implementation SDGraphicsImageRenderer + +- (instancetype)initWithSize:(CGSize)size { + return [self initWithSize:size format:SDGraphicsImageRendererFormat.preferredFormat]; +} + +- (instancetype)initWithSize:(CGSize)size format:(SDGraphicsImageRendererFormat *)format { + NSParameterAssert(format); + self = [super init]; + if (self) { + self.size = size; + self.format = format; +#if SD_UIKIT + if (@available(iOS 10.0, tvOS 10.0, *)) { + UIGraphicsImageRendererFormat *uiformat = format.uiformat; + self.uirenderer = [[UIGraphicsImageRenderer alloc] initWithSize:size format:uiformat]; + } +#endif + } + return self; +} + +- (UIImage *)imageWithActions:(NS_NOESCAPE SDGraphicsImageDrawingActions)actions { + NSParameterAssert(actions); +#if SD_UIKIT + if (@available(iOS 10.0, tvOS 10.0, *)) { + UIGraphicsImageDrawingActions uiactions = ^(UIGraphicsImageRendererContext *rendererContext) { + if (actions) { + actions(rendererContext.CGContext); + } + }; + return [self.uirenderer imageWithActions:uiactions]; + } else { +#endif + SDGraphicsBeginImageContextWithOptions(self.size, self.format.opaque, self.format.scale); + CGContextRef context = SDGraphicsGetCurrentContext(); + if (actions) { + actions(context); + } + UIImage *image = SDGraphicsGetImageFromCurrentImageContext(); + SDGraphicsEndImageContext(); + return image; +#if SD_UIKIT + } +#endif +} + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageAPNGCoder.h b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageAPNGCoder.h new file mode 100644 index 0000000..f73742c --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageAPNGCoder.h @@ -0,0 +1,19 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import +#import "SDImageIOAnimatedCoder.h" + +/** + Built in coder using ImageIO that supports APNG encoding/decoding + */ +@interface SDImageAPNGCoder : SDImageIOAnimatedCoder + +@property (nonatomic, class, readonly, nonnull) SDImageAPNGCoder *sharedCoder; + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageAPNGCoder.m b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageAPNGCoder.m new file mode 100644 index 0000000..b262bd3 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageAPNGCoder.m @@ -0,0 +1,58 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDImageAPNGCoder.h" +#import "SDImageIOAnimatedCoderInternal.h" +#if SD_MAC +#import +#else +#import +#endif + +@implementation SDImageAPNGCoder + ++ (instancetype)sharedCoder { + static SDImageAPNGCoder *coder; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + coder = [[SDImageAPNGCoder alloc] init]; + }); + return coder; +} + +#pragma mark - Subclass Override + ++ (SDImageFormat)imageFormat { + return SDImageFormatPNG; +} + ++ (NSString *)imageUTType { + return (__bridge NSString *)kSDUTTypePNG; +} + ++ (NSString *)dictionaryProperty { + return (__bridge NSString *)kCGImagePropertyPNGDictionary; +} + ++ (NSString *)unclampedDelayTimeProperty { + return (__bridge NSString *)kCGImagePropertyAPNGUnclampedDelayTime; +} + ++ (NSString *)delayTimeProperty { + return (__bridge NSString *)kCGImagePropertyAPNGDelayTime; +} + ++ (NSString *)loopCountProperty { + return (__bridge NSString *)kCGImagePropertyAPNGLoopCount; +} + ++ (NSUInteger)defaultLoopCount { + return 0; +} + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageAWebPCoder.h b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageAWebPCoder.h new file mode 100644 index 0000000..4b585a9 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageAWebPCoder.h @@ -0,0 +1,23 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import +#import "SDImageIOAnimatedCoder.h" + +/** + This coder is used for Google WebP and Animated WebP(AWebP) image format. + Image/IO provide the WebP decoding support in iOS 14/macOS 11/tvOS 14/watchOS 7+. + @note Currently Image/IO seems does not supports WebP encoding, if you need WebP encoding, use the custom codec below. + @note If you need to support lower firmware version for WebP, you can have a try at https://github.com/SDWebImage/SDWebImageWebPCoder + */ +API_AVAILABLE(ios(14.0), tvos(14.0), macos(11.0), watchos(7.0)) +@interface SDImageAWebPCoder : SDImageIOAnimatedCoder + +@property (nonatomic, class, readonly, nonnull) SDImageAWebPCoder *sharedCoder; + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageAWebPCoder.m b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageAWebPCoder.m new file mode 100644 index 0000000..e58bc21 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageAWebPCoder.m @@ -0,0 +1,98 @@ +/* +* This file is part of the SDWebImage package. +* (c) Olivier Poitrey +* +* For the full copyright and license information, please view the LICENSE +* file that was distributed with this source code. +*/ + +#import "SDImageAWebPCoder.h" +#import "SDImageIOAnimatedCoderInternal.h" + +// These constants are available from iOS 14+ and Xcode 12. This raw value is used for toolchain and firmware compatibility +static NSString * kSDCGImagePropertyWebPDictionary = @"{WebP}"; +static NSString * kSDCGImagePropertyWebPLoopCount = @"LoopCount"; +static NSString * kSDCGImagePropertyWebPDelayTime = @"DelayTime"; +static NSString * kSDCGImagePropertyWebPUnclampedDelayTime = @"UnclampedDelayTime"; + +@implementation SDImageAWebPCoder + ++ (void)initialize { +#if __IPHONE_14_0 || __TVOS_14_0 || __MAC_11_0 || __WATCHOS_7_0 + // Xcode 12 + if (@available(iOS 14, tvOS 14, macOS 11, watchOS 7, *)) { + // Use SDK instead of raw value + kSDCGImagePropertyWebPDictionary = (__bridge NSString *)kCGImagePropertyWebPDictionary; + kSDCGImagePropertyWebPLoopCount = (__bridge NSString *)kCGImagePropertyWebPLoopCount; + kSDCGImagePropertyWebPDelayTime = (__bridge NSString *)kCGImagePropertyWebPDelayTime; + kSDCGImagePropertyWebPUnclampedDelayTime = (__bridge NSString *)kCGImagePropertyWebPUnclampedDelayTime; + } +#endif +} + ++ (instancetype)sharedCoder { + static SDImageAWebPCoder *coder; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + coder = [[SDImageAWebPCoder alloc] init]; + }); + return coder; +} + +#pragma mark - SDImageCoder + +- (BOOL)canDecodeFromData:(nullable NSData *)data { + switch ([NSData sd_imageFormatForImageData:data]) { + case SDImageFormatWebP: + // Check WebP decoding compatibility + return [self.class canDecodeFromFormat:SDImageFormatWebP]; + default: + return NO; + } +} + +- (BOOL)canIncrementalDecodeFromData:(NSData *)data { + return [self canDecodeFromData:data]; +} + +- (BOOL)canEncodeToFormat:(SDImageFormat)format { + switch (format) { + case SDImageFormatWebP: + // Check WebP encoding compatibility + return [self.class canEncodeToFormat:SDImageFormatWebP]; + default: + return NO; + } +} + +#pragma mark - Subclass Override + ++ (SDImageFormat)imageFormat { + return SDImageFormatWebP; +} + ++ (NSString *)imageUTType { + return (__bridge NSString *)kSDUTTypeWebP; +} + ++ (NSString *)dictionaryProperty { + return kSDCGImagePropertyWebPDictionary; +} + ++ (NSString *)unclampedDelayTimeProperty { + return kSDCGImagePropertyWebPUnclampedDelayTime; +} + ++ (NSString *)delayTimeProperty { + return kSDCGImagePropertyWebPDelayTime; +} + ++ (NSString *)loopCountProperty { + return kSDCGImagePropertyWebPLoopCount; +} + ++ (NSUInteger)defaultLoopCount { + return 0; +} + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageCache.h b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageCache.h new file mode 100644 index 0000000..9a75580 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageCache.h @@ -0,0 +1,450 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import +#import "SDWebImageCompat.h" +#import "SDWebImageDefine.h" +#import "SDImageCacheConfig.h" +#import "SDImageCacheDefine.h" +#import "SDMemoryCache.h" +#import "SDDiskCache.h" + +/// Image Cache Options +typedef NS_OPTIONS(NSUInteger, SDImageCacheOptions) { + /** + * By default, we do not query image data when the image is already cached in memory. This mask can force to query image data at the same time. However, this query is asynchronously unless you specify `SDImageCacheQueryMemoryDataSync` + */ + SDImageCacheQueryMemoryData = 1 << 0, + /** + * By default, when you only specify `SDImageCacheQueryMemoryData`, we query the memory image data asynchronously. Combined this mask as well to query the memory image data synchronously. + */ + SDImageCacheQueryMemoryDataSync = 1 << 1, + /** + * By default, when the memory cache miss, we query the disk cache asynchronously. This mask can force to query disk cache (when memory cache miss) synchronously. + @note These 3 query options can be combined together. For the full list about these masks combination, see wiki page. + */ + SDImageCacheQueryDiskDataSync = 1 << 2, + /** + * By default, images are decoded respecting their original size. On iOS, this flag will scale down the + * images to a size compatible with the constrained memory of devices. + */ + SDImageCacheScaleDownLargeImages = 1 << 3, + /** + * By default, we will decode the image in the background during cache query and download from the network. This can help to improve performance because when rendering image on the screen, it need to be firstly decoded. But this happen on the main queue by Core Animation. + * However, this process may increase the memory usage as well. If you are experiencing a issue due to excessive memory consumption, This flag can prevent decode the image. + */ + SDImageCacheAvoidDecodeImage = 1 << 4, + /** + * By default, we decode the animated image. This flag can force decode the first frame only and produce the static image. + */ + SDImageCacheDecodeFirstFrameOnly = 1 << 5, + /** + * By default, for `SDAnimatedImage`, we decode the animated image frame during rendering to reduce memory usage. This flag actually trigger `preloadAllAnimatedImageFrames = YES` after image load from disk cache + */ + SDImageCachePreloadAllFrames = 1 << 6, + /** + * By default, when you use `SDWebImageContextAnimatedImageClass` context option (like using `SDAnimatedImageView` which designed to use `SDAnimatedImage`), we may still use `UIImage` when the memory cache hit, or image decoder is not available, to behave as a fallback solution. + * Using this option, can ensure we always produce image with your provided class. If failed, an error with code `SDWebImageErrorBadImageData` will be used. + * Note this options is not compatible with `SDImageCacheDecodeFirstFrameOnly`, which always produce a UIImage/NSImage. + */ + SDImageCacheMatchAnimatedImageClass = 1 << 7, +}; + +/** + * A token associated with each cache query. Can be used to cancel a cache query + */ +@interface SDImageCacheToken : NSObject + +/** + Cancel the current cache query. + */ +- (void)cancel; + +/** + The query's cache key. + */ +@property (nonatomic, strong, nullable, readonly) NSString *key; + +@end + +/** + * SDImageCache maintains a memory cache and a disk cache. Disk cache write operations are performed + * asynchronous so it doesn’t add unnecessary latency to the UI. + */ +@interface SDImageCache : NSObject + +#pragma mark - Properties + +/** + * Cache Config object - storing all kind of settings. + * The property is copy so change of current config will not accidentally affect other cache's config. + */ +@property (nonatomic, copy, nonnull, readonly) SDImageCacheConfig *config; + +/** + * The memory cache implementation object used for current image cache. + * By default we use `SDMemoryCache` class, you can also use this to call your own implementation class method. + * @note To customize this class, check `SDImageCacheConfig.memoryCacheClass` property. + */ +@property (nonatomic, strong, readonly, nonnull) id memoryCache; + +/** + * The disk cache implementation object used for current image cache. + * By default we use `SDMemoryCache` class, you can also use this to call your own implementation class method. + * @note To customize this class, check `SDImageCacheConfig.diskCacheClass` property. + * @warning When calling method about read/write in disk cache, be sure to either make your disk cache implementation IO-safe or using the same access queue to avoid issues. + */ +@property (nonatomic, strong, readonly, nonnull) id diskCache; + +/** + * The disk cache's root path + */ +@property (nonatomic, copy, nonnull, readonly) NSString *diskCachePath; + +/** + * The additional disk cache path to check if the query from disk cache not exist; + * The `key` param is the image cache key. The returned file path will be used to load the disk cache. If return nil, ignore it. + * Useful if you want to bundle pre-loaded images with your app + */ +@property (nonatomic, copy, nullable) SDImageCacheAdditionalCachePathBlock additionalCachePathBlock; + +#pragma mark - Singleton and initialization + +/** + * Returns global shared cache instance + */ +@property (nonatomic, class, readonly, nonnull) SDImageCache *sharedImageCache; + +/** + * Control the default disk cache directory. This will effect all the SDImageCache instance created after modification, even for shared image cache. + * This can be used to share the same disk cache with the App and App Extension (Today/Notification Widget) using `- [NSFileManager.containerURLForSecurityApplicationGroupIdentifier:]`. + * @note If you pass nil, the value will be reset to `~/Library/Caches/com.hackemist.SDImageCache`. + * @note We still preserve the `namespace` arg, which means, if you change this property into `/path/to/use`, the `SDImageCache.sharedImageCache.diskCachePath` should be `/path/to/use/default` because shared image cache use `default` as namespace. + * Defaults to nil. + */ +@property (nonatomic, class, readwrite, null_resettable) NSString *defaultDiskCacheDirectory; + +/** + * Init a new cache store with a specific namespace + * The final disk cache directory should looks like ($directory/$namespace). And the default config of shared cache, should result in (~/Library/Caches/com.hackemist.SDImageCache/default/) + * + * @param ns The namespace to use for this cache store + */ +- (nonnull instancetype)initWithNamespace:(nonnull NSString *)ns; + +/** + * Init a new cache store with a specific namespace and directory. + * The final disk cache directory should looks like ($directory/$namespace). And the default config of shared cache, should result in (~/Library/Caches/com.hackemist.SDImageCache/default/) + * + * @param ns The namespace to use for this cache store + * @param directory Directory to cache disk images in + */ +- (nonnull instancetype)initWithNamespace:(nonnull NSString *)ns + diskCacheDirectory:(nullable NSString *)directory; + +/** + * Init a new cache store with a specific namespace, directory and config. + * The final disk cache directory should looks like ($directory/$namespace). And the default config of shared cache, should result in (~/Library/Caches/com.hackemist.SDImageCache/default/) + * + * @param ns The namespace to use for this cache store + * @param directory Directory to cache disk images in + * @param config The cache config to be used to create the cache. You can provide custom memory cache or disk cache class in the cache config + */ +- (nonnull instancetype)initWithNamespace:(nonnull NSString *)ns + diskCacheDirectory:(nullable NSString *)directory + config:(nullable SDImageCacheConfig *)config NS_DESIGNATED_INITIALIZER; + +#pragma mark - Cache paths + +/** + Get the cache path for a certain key + + @param key The unique image cache key + @return The cache path. You can check `lastPathComponent` to grab the file name. + */ +- (nullable NSString *)cachePathForKey:(nullable NSString *)key; + +#pragma mark - Store Ops + +/** + * Asynchronously store an image into memory and disk cache at the given key. + * + * @param image The image to store + * @param key The unique image cache key, usually it's image absolute URL + * @param completionBlock A block executed after the operation is finished + */ +- (void)storeImage:(nullable UIImage *)image + forKey:(nullable NSString *)key + completion:(nullable SDWebImageNoParamsBlock)completionBlock; + +/** + * Asynchronously store an image into memory and disk cache at the given key. + * + * @param image The image to store + * @param key The unique image cache key, usually it's image absolute URL + * @param toDisk Store the image to disk cache if YES. If NO, the completion block is called synchronously + * @param completionBlock A block executed after the operation is finished + * @note If no image data is provided and encode to disk, we will try to detect the image format (using either `sd_imageFormat` or `SDAnimatedImage` protocol method) and animation status, to choose the best matched format, including GIF, JPEG or PNG. + */ +- (void)storeImage:(nullable UIImage *)image + forKey:(nullable NSString *)key + toDisk:(BOOL)toDisk + completion:(nullable SDWebImageNoParamsBlock)completionBlock; + +/** + * Asynchronously store an image data into disk cache at the given key. + * + * @param imageData The image data to store + * @param key The unique image cache key, usually it's image absolute URL + * @param completionBlock A block executed after the operation is finished + */ +- (void)storeImageData:(nullable NSData *)imageData + forKey:(nullable NSString *)key + completion:(nullable SDWebImageNoParamsBlock)completionBlock; + +/** + * Asynchronously store an image into memory and disk cache at the given key. + * + * @param image The image to store + * @param imageData The image data as returned by the server, this representation will be used for disk storage + * instead of converting the given image object into a storable/compressed image format in order + * to save quality and CPU + * @param key The unique image cache key, usually it's image absolute URL + * @param toDisk Store the image to disk cache if YES. If NO, the completion block is called synchronously + * @param completionBlock A block executed after the operation is finished + * @note If no image data is provided and encode to disk, we will try to detect the image format (using either `sd_imageFormat` or `SDAnimatedImage` protocol method) and animation status, to choose the best matched format, including GIF, JPEG or PNG. + */ +- (void)storeImage:(nullable UIImage *)image + imageData:(nullable NSData *)imageData + forKey:(nullable NSString *)key + toDisk:(BOOL)toDisk + completion:(nullable SDWebImageNoParamsBlock)completionBlock; + +/** + * Synchronously store an image into memory cache at the given key. + * + * @param image The image to store + * @param key The unique image cache key, usually it's image absolute URL + */ +- (void)storeImageToMemory:(nullable UIImage*)image + forKey:(nullable NSString *)key; + +/** + * Synchronously store an image data into disk cache at the given key. + * + * @param imageData The image data to store + * @param key The unique image cache key, usually it's image absolute URL + */ +- (void)storeImageDataToDisk:(nullable NSData *)imageData + forKey:(nullable NSString *)key; + + +#pragma mark - Contains and Check Ops + +/** + * Asynchronously check if image exists in disk cache already (does not load the image) + * + * @param key the key describing the url + * @param completionBlock the block to be executed when the check is done. + * @note the completion block will be always executed on the main queue + */ +- (void)diskImageExistsWithKey:(nullable NSString *)key completion:(nullable SDImageCacheCheckCompletionBlock)completionBlock; + +/** + * Synchronously check if image data exists in disk cache already (does not load the image) + * + * @param key the key describing the url + */ +- (BOOL)diskImageDataExistsWithKey:(nullable NSString *)key; + +#pragma mark - Query and Retrieve Ops + +/** + * Synchronously query the image data for the given key in disk cache. You can decode the image data to image after loaded. + * + * @param key The unique key used to store the wanted image + * @return The image data for the given key, or nil if not found. + */ +- (nullable NSData *)diskImageDataForKey:(nullable NSString *)key; + +/** + * Asynchronously query the image data for the given key in disk cache. You can decode the image data to image after loaded. + * + * @param key The unique key used to store the wanted image + * @param completionBlock the block to be executed when the query is done. + * @note the completion block will be always executed on the main queue + */ +- (void)diskImageDataQueryForKey:(nullable NSString *)key completion:(nullable SDImageCacheQueryDataCompletionBlock)completionBlock; + +/** + * Asynchronously queries the cache with operation and call the completion when done. + * + * @param key The unique key used to store the wanted image. If you want transformed or thumbnail image, calculate the key with `SDTransformedKeyForKey`, `SDThumbnailedKeyForKey`, or generate the cache key from url with `cacheKeyForURL:context:`. + * @param doneBlock The completion block. Will not get called if the operation is cancelled + * + * @return a SDImageCacheToken instance containing the cache operation, will callback immediately when cancelled + */ +- (nullable SDImageCacheToken *)queryCacheOperationForKey:(nullable NSString *)key done:(nullable SDImageCacheQueryCompletionBlock)doneBlock; + +/** + * Asynchronously queries the cache with operation and call the completion when done. + * + * @param key The unique key used to store the wanted image. If you want transformed or thumbnail image, calculate the key with `SDTransformedKeyForKey`, `SDThumbnailedKeyForKey`, or generate the cache key from url with `cacheKeyForURL:context:`. + * @param options A mask to specify options to use for this cache query + * @param doneBlock The completion block. Will not get called if the operation is cancelled + * + * @return a SDImageCacheToken instance containing the cache operation, will callback immediately when cancelled + */ +- (nullable SDImageCacheToken *)queryCacheOperationForKey:(nullable NSString *)key options:(SDImageCacheOptions)options done:(nullable SDImageCacheQueryCompletionBlock)doneBlock; + +/** + * Asynchronously queries the cache with operation and call the completion when done. + * + * @param key The unique key used to store the wanted image. If you want transformed or thumbnail image, calculate the key with `SDTransformedKeyForKey`, `SDThumbnailedKeyForKey`, or generate the cache key from url with `cacheKeyForURL:context:`. + * @param options A mask to specify options to use for this cache query + * @param context A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold. + * @param doneBlock The completion block. Will not get called if the operation is cancelled + * + * @return a SDImageCacheToken instance containing the cache operation, will callback immediately when cancellederation, will callback immediately when cancelled + */ +- (nullable SDImageCacheToken *)queryCacheOperationForKey:(nullable NSString *)key options:(SDImageCacheOptions)options context:(nullable SDWebImageContext *)context done:(nullable SDImageCacheQueryCompletionBlock)doneBlock; + +/** + * Asynchronously queries the cache with operation and call the completion when done. + * + * @param key The unique key used to store the wanted image. If you want transformed or thumbnail image, calculate the key with `SDTransformedKeyForKey`, `SDThumbnailedKeyForKey`, or generate the cache key from url with `cacheKeyForURL:context:`. + * @param options A mask to specify options to use for this cache query + * @param context A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold. + * @param queryCacheType Specify where to query the cache from. By default we use `.all`, which means both memory cache and disk cache. You can choose to query memory only or disk only as well. Pass `.none` is invalid and callback with nil immediately. + * @param doneBlock The completion block. Will not get called if the operation is cancelled + * + * @return a SDImageCacheToken instance containing the cache operation, will callback immediately when cancelled + */ +- (nullable SDImageCacheToken *)queryCacheOperationForKey:(nullable NSString *)key options:(SDImageCacheOptions)options context:(nullable SDWebImageContext *)context cacheType:(SDImageCacheType)queryCacheType done:(nullable SDImageCacheQueryCompletionBlock)doneBlock; + +/** + * Synchronously query the memory cache. + * + * @param key The unique key used to store the image + * @return The image for the given key, or nil if not found. + */ +- (nullable UIImage *)imageFromMemoryCacheForKey:(nullable NSString *)key; + +/** + * Synchronously query the disk cache. + * + * @param key The unique key used to store the image + * @return The image for the given key, or nil if not found. + */ +- (nullable UIImage *)imageFromDiskCacheForKey:(nullable NSString *)key; + +/** + * Synchronously query the disk cache. With the options and context which may effect the image generation. (Such as transformer, animated image, thumbnail, etc) + * + * @param key The unique key used to store the image + * @param options A mask to specify options to use for this cache query + * @param context A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold. + * @return The image for the given key, or nil if not found. + */ +- (nullable UIImage *)imageFromDiskCacheForKey:(nullable NSString *)key options:(SDImageCacheOptions)options context:(nullable SDWebImageContext *)context; + +/** + * Synchronously query the cache (memory and or disk) after checking the memory cache. + * + * @param key The unique key used to store the image + * @return The image for the given key, or nil if not found. + */ +- (nullable UIImage *)imageFromCacheForKey:(nullable NSString *)key; + +/** + * Synchronously query the cache (memory and or disk) after checking the memory cache. With the options and context which may effect the image generation. (Such as transformer, animated image, thumbnail, etc) + * + * @param key The unique key used to store the image + * @param options A mask to specify options to use for this cache query + * @param context A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold. + * @return The image for the given key, or nil if not found. + */ +- (nullable UIImage *)imageFromCacheForKey:(nullable NSString *)key options:(SDImageCacheOptions)options context:(nullable SDWebImageContext *)context; + +#pragma mark - Remove Ops + +/** + * Asynchronously remove the image from memory and disk cache + * + * @param key The unique image cache key + * @param completion A block that should be executed after the image has been removed (optional) + */ +- (void)removeImageForKey:(nullable NSString *)key withCompletion:(nullable SDWebImageNoParamsBlock)completion; + +/** + * Asynchronously remove the image from memory and optionally disk cache + * + * @param key The unique image cache key + * @param fromDisk Also remove cache entry from disk if YES. If NO, the completion block is called synchronously + * @param completion A block that should be executed after the image has been removed (optional) + */ +- (void)removeImageForKey:(nullable NSString *)key fromDisk:(BOOL)fromDisk withCompletion:(nullable SDWebImageNoParamsBlock)completion; + +/** + Synchronously remove the image from memory cache. + + @param key The unique image cache key + */ +- (void)removeImageFromMemoryForKey:(nullable NSString *)key; + +/** + Synchronously remove the image from disk cache. + + @param key The unique image cache key + */ +- (void)removeImageFromDiskForKey:(nullable NSString *)key; + +#pragma mark - Cache clean Ops + +/** + * Synchronously Clear all memory cached images + */ +- (void)clearMemory; + +/** + * Asynchronously clear all disk cached images. Non-blocking method - returns immediately. + * @param completion A block that should be executed after cache expiration completes (optional) + */ +- (void)clearDiskOnCompletion:(nullable SDWebImageNoParamsBlock)completion; + +/** + * Asynchronously remove all expired cached image from disk. Non-blocking method - returns immediately. + * @param completionBlock A block that should be executed after cache expiration completes (optional) + */ +- (void)deleteOldFilesWithCompletionBlock:(nullable SDWebImageNoParamsBlock)completionBlock; + +#pragma mark - Cache Info + +/** + * Get the total bytes size of images in the disk cache + */ +- (NSUInteger)totalDiskSize; + +/** + * Get the number of images in the disk cache + */ +- (NSUInteger)totalDiskCount; + +/** + * Asynchronously calculate the disk cache's size. + */ +- (void)calculateSizeWithCompletionBlock:(nullable SDImageCacheCalculateSizeBlock)completionBlock; + +@end + +/** + * SDImageCache is the built-in image cache implementation for web image manager. It adopts `SDImageCache` protocol to provide the function for web image manager to use for image loading process. + */ +@interface SDImageCache (SDImageCache) + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageCache.m b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageCache.m new file mode 100644 index 0000000..cce92f6 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageCache.m @@ -0,0 +1,1011 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDImageCache.h" +#import "NSImage+Compatibility.h" +#import "SDImageCodersManager.h" +#import "SDImageCoderHelper.h" +#import "SDAnimatedImage.h" +#import "UIImage+MemoryCacheCost.h" +#import "UIImage+Metadata.h" +#import "UIImage+ExtendedCacheData.h" + +@interface SDImageCacheToken () + +@property (nonatomic, strong, nullable, readwrite) NSString *key; +@property (nonatomic, assign, getter=isCancelled) BOOL cancelled; +@property (nonatomic, copy, nullable) SDImageCacheQueryCompletionBlock doneBlock; + +@end + +@implementation SDImageCacheToken + +-(instancetype)initWithDoneBlock:(nullable SDImageCacheQueryCompletionBlock)doneBlock { + self = [super init]; + if (self) { + self.doneBlock = doneBlock; + } + return self; +} + +- (void)cancel { + @synchronized (self) { + if (self.isCancelled) { + return; + } + self.cancelled = YES; + + dispatch_main_async_safe(^{ + if (self.doneBlock) { + self.doneBlock(nil, nil, SDImageCacheTypeNone); + self.doneBlock = nil; + } + }); + } +} + +@end + +static NSString * _defaultDiskCacheDirectory; + +@interface SDImageCache () + +#pragma mark - Properties +@property (nonatomic, strong, readwrite, nonnull) id memoryCache; +@property (nonatomic, strong, readwrite, nonnull) id diskCache; +@property (nonatomic, copy, readwrite, nonnull) SDImageCacheConfig *config; +@property (nonatomic, copy, readwrite, nonnull) NSString *diskCachePath; +@property (nonatomic, strong, nullable) dispatch_queue_t ioQueue; + +@end + + +@implementation SDImageCache + +#pragma mark - Singleton, init, dealloc + ++ (nonnull instancetype)sharedImageCache { + static dispatch_once_t once; + static id instance; + dispatch_once(&once, ^{ + instance = [self new]; + }); + return instance; +} + ++ (NSString *)defaultDiskCacheDirectory { + if (!_defaultDiskCacheDirectory) { + _defaultDiskCacheDirectory = [[self userCacheDirectory] stringByAppendingPathComponent:@"com.hackemist.SDImageCache"]; + } + return _defaultDiskCacheDirectory; +} + ++ (void)setDefaultDiskCacheDirectory:(NSString *)defaultDiskCacheDirectory { + _defaultDiskCacheDirectory = [defaultDiskCacheDirectory copy]; +} + +- (instancetype)init { + return [self initWithNamespace:@"default"]; +} + +- (nonnull instancetype)initWithNamespace:(nonnull NSString *)ns { + return [self initWithNamespace:ns diskCacheDirectory:nil]; +} + +- (nonnull instancetype)initWithNamespace:(nonnull NSString *)ns + diskCacheDirectory:(nullable NSString *)directory { + return [self initWithNamespace:ns diskCacheDirectory:directory config:SDImageCacheConfig.defaultCacheConfig]; +} + +- (nonnull instancetype)initWithNamespace:(nonnull NSString *)ns + diskCacheDirectory:(nullable NSString *)directory + config:(nullable SDImageCacheConfig *)config { + if ((self = [super init])) { + NSAssert(ns, @"Cache namespace should not be nil"); + + // Create IO serial queue + _ioQueue = dispatch_queue_create("com.hackemist.SDImageCache", DISPATCH_QUEUE_SERIAL); + + if (!config) { + config = SDImageCacheConfig.defaultCacheConfig; + } + _config = [config copy]; + + // Init the memory cache + NSAssert([config.memoryCacheClass conformsToProtocol:@protocol(SDMemoryCache)], @"Custom memory cache class must conform to `SDMemoryCache` protocol"); + _memoryCache = [[config.memoryCacheClass alloc] initWithConfig:_config]; + + // Init the disk cache + if (!directory) { + // Use default disk cache directory + directory = [self.class defaultDiskCacheDirectory]; + } + _diskCachePath = [directory stringByAppendingPathComponent:ns]; + + NSAssert([config.diskCacheClass conformsToProtocol:@protocol(SDDiskCache)], @"Custom disk cache class must conform to `SDDiskCache` protocol"); + _diskCache = [[config.diskCacheClass alloc] initWithCachePath:_diskCachePath config:_config]; + + // Check and migrate disk cache directory if need + [self migrateDiskCacheDirectory]; + +#if SD_UIKIT + // Subscribe to app events + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(applicationWillTerminate:) + name:UIApplicationWillTerminateNotification + object:nil]; + + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(applicationDidEnterBackground:) + name:UIApplicationDidEnterBackgroundNotification + object:nil]; +#endif +#if SD_MAC + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(applicationWillTerminate:) + name:NSApplicationWillTerminateNotification + object:nil]; +#endif + } + + return self; +} + +- (void)dealloc { + [[NSNotificationCenter defaultCenter] removeObserver:self]; +} + +#pragma mark - Cache paths + +- (nullable NSString *)cachePathForKey:(nullable NSString *)key { + if (!key) { + return nil; + } + return [self.diskCache cachePathForKey:key]; +} + ++ (nullable NSString *)userCacheDirectory { + NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES); + return paths.firstObject; +} + +- (void)migrateDiskCacheDirectory { + if ([self.diskCache isKindOfClass:[SDDiskCache class]]) { + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + // ~/Library/Caches/com.hackemist.SDImageCache/default/ + NSString *newDefaultPath = [[[self.class userCacheDirectory] stringByAppendingPathComponent:@"com.hackemist.SDImageCache"] stringByAppendingPathComponent:@"default"]; + // ~/Library/Caches/default/com.hackemist.SDWebImageCache.default/ + NSString *oldDefaultPath = [[[self.class userCacheDirectory] stringByAppendingPathComponent:@"default"] stringByAppendingPathComponent:@"com.hackemist.SDWebImageCache.default"]; + dispatch_async(self.ioQueue, ^{ + [((SDDiskCache *)self.diskCache) moveCacheDirectoryFromPath:oldDefaultPath toPath:newDefaultPath]; + }); + }); + } +} + +#pragma mark - Store Ops + +- (void)storeImage:(nullable UIImage *)image + forKey:(nullable NSString *)key + completion:(nullable SDWebImageNoParamsBlock)completionBlock { + [self storeImage:image imageData:nil forKey:key toDisk:YES completion:completionBlock]; +} + +- (void)storeImage:(nullable UIImage *)image + forKey:(nullable NSString *)key + toDisk:(BOOL)toDisk + completion:(nullable SDWebImageNoParamsBlock)completionBlock { + [self storeImage:image imageData:nil forKey:key toDisk:toDisk completion:completionBlock]; +} + +- (void)storeImageData:(nullable NSData *)imageData + forKey:(nullable NSString *)key + completion:(nullable SDWebImageNoParamsBlock)completionBlock { + [self storeImage:nil imageData:imageData forKey:key toDisk:YES completion:completionBlock]; +} + +- (void)storeImage:(nullable UIImage *)image + imageData:(nullable NSData *)imageData + forKey:(nullable NSString *)key + toDisk:(BOOL)toDisk + completion:(nullable SDWebImageNoParamsBlock)completionBlock { + return [self storeImage:image imageData:imageData forKey:key toMemory:YES toDisk:toDisk completion:completionBlock]; +} + +- (void)storeImage:(nullable UIImage *)image + imageData:(nullable NSData *)imageData + forKey:(nullable NSString *)key + toMemory:(BOOL)toMemory + toDisk:(BOOL)toDisk + completion:(nullable SDWebImageNoParamsBlock)completionBlock { + if ((!image && !imageData) || !key) { + if (completionBlock) { + completionBlock(); + } + return; + } + // if memory cache is enabled + if (image && toMemory && self.config.shouldCacheImagesInMemory) { + NSUInteger cost = image.sd_memoryCost; + [self.memoryCache setObject:image forKey:key cost:cost]; + } + + if (!toDisk) { + if (completionBlock) { + completionBlock(); + } + return; + } + dispatch_async(self.ioQueue, ^{ + @autoreleasepool { + NSData *data = imageData; + if (!data && [image conformsToProtocol:@protocol(SDAnimatedImage)]) { + // If image is custom animated image class, prefer its original animated data + data = [((id)image) animatedImageData]; + } + if (!data && image) { + // Check image's associated image format, may return .undefined + SDImageFormat format = image.sd_imageFormat; + if (format == SDImageFormatUndefined) { + // If image is animated, use GIF (APNG may be better, but has bugs before macOS 10.14) + if (image.sd_isAnimated) { + format = SDImageFormatGIF; + } else { + // If we do not have any data to detect image format, check whether it contains alpha channel to use PNG or JPEG format + format = [SDImageCoderHelper CGImageContainsAlpha:image.CGImage] ? SDImageFormatPNG : SDImageFormatJPEG; + } + } + data = [[SDImageCodersManager sharedManager] encodedDataWithImage:image format:format options:nil]; + } + [self _storeImageDataToDisk:data forKey:key]; + [self _archivedDataWithImage:image forKey:key]; + } + + if (completionBlock) { + dispatch_async(dispatch_get_main_queue(), ^{ + completionBlock(); + }); + } + }); +} + +- (void)_archivedDataWithImage:(UIImage *)image forKey:(NSString *)key { + if (!image || !key) { + return; + } + // Check extended data + id extendedObject = image.sd_extendedObject; + if (![extendedObject conformsToProtocol:@protocol(NSCoding)]) { + return; + } + NSData *extendedData; + if (@available(iOS 11, tvOS 11, macOS 10.13, watchOS 4, *)) { + NSError *error; + extendedData = [NSKeyedArchiver archivedDataWithRootObject:extendedObject requiringSecureCoding:NO error:&error]; + if (error) { + NSLog(@"NSKeyedArchiver archive failed with error: %@", error); + } + } else { + @try { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + extendedData = [NSKeyedArchiver archivedDataWithRootObject:extendedObject]; +#pragma clang diagnostic pop + } @catch (NSException *exception) { + NSLog(@"NSKeyedArchiver archive failed with exception: %@", exception); + } + } + if (extendedData) { + [self.diskCache setExtendedData:extendedData forKey:key]; + } +} + +- (void)storeImageToMemory:(UIImage *)image forKey:(NSString *)key { + if (!image || !key) { + return; + } + NSUInteger cost = image.sd_memoryCost; + [self.memoryCache setObject:image forKey:key cost:cost]; +} + +- (void)storeImageDataToDisk:(nullable NSData *)imageData + forKey:(nullable NSString *)key { + if (!imageData || !key) { + return; + } + + dispatch_sync(self.ioQueue, ^{ + [self _storeImageDataToDisk:imageData forKey:key]; + }); +} + +// Make sure to call from io queue by caller +- (void)_storeImageDataToDisk:(nullable NSData *)imageData forKey:(nullable NSString *)key { + if (!imageData || !key) { + return; + } + + [self.diskCache setData:imageData forKey:key]; +} + +#pragma mark - Query and Retrieve Ops + +- (void)diskImageExistsWithKey:(nullable NSString *)key completion:(nullable SDImageCacheCheckCompletionBlock)completionBlock { + dispatch_async(self.ioQueue, ^{ + BOOL exists = [self _diskImageDataExistsWithKey:key]; + if (completionBlock) { + dispatch_async(dispatch_get_main_queue(), ^{ + completionBlock(exists); + }); + } + }); +} + +- (BOOL)diskImageDataExistsWithKey:(nullable NSString *)key { + if (!key) { + return NO; + } + + __block BOOL exists = NO; + dispatch_sync(self.ioQueue, ^{ + exists = [self _diskImageDataExistsWithKey:key]; + }); + + return exists; +} + +// Make sure to call from io queue by caller +- (BOOL)_diskImageDataExistsWithKey:(nullable NSString *)key { + if (!key) { + return NO; + } + + return [self.diskCache containsDataForKey:key]; +} + +- (void)diskImageDataQueryForKey:(NSString *)key completion:(SDImageCacheQueryDataCompletionBlock)completionBlock { + dispatch_async(self.ioQueue, ^{ + NSData *imageData = [self diskImageDataBySearchingAllPathsForKey:key]; + if (completionBlock) { + dispatch_async(dispatch_get_main_queue(), ^{ + completionBlock(imageData); + }); + } + }); +} + +- (nullable NSData *)diskImageDataForKey:(nullable NSString *)key { + if (!key) { + return nil; + } + __block NSData *imageData = nil; + dispatch_sync(self.ioQueue, ^{ + imageData = [self diskImageDataBySearchingAllPathsForKey:key]; + }); + + return imageData; +} + +- (nullable UIImage *)imageFromMemoryCacheForKey:(nullable NSString *)key { + return [self.memoryCache objectForKey:key]; +} + +- (nullable UIImage *)imageFromDiskCacheForKey:(nullable NSString *)key { + return [self imageFromDiskCacheForKey:key options:0 context:nil]; +} + +- (nullable UIImage *)imageFromDiskCacheForKey:(nullable NSString *)key options:(SDImageCacheOptions)options context:(nullable SDWebImageContext *)context { + NSData *data = [self diskImageDataForKey:key]; + UIImage *diskImage = [self diskImageForKey:key data:data options:options context:context]; + + BOOL shouldCacheToMomery = YES; + if (context[SDWebImageContextStoreCacheType]) { + SDImageCacheType cacheType = [context[SDWebImageContextStoreCacheType] integerValue]; + shouldCacheToMomery = (cacheType == SDImageCacheTypeAll || cacheType == SDImageCacheTypeMemory); + } + if (context[SDWebImageContextImageThumbnailPixelSize]) { + // Query full size cache key which generate a thumbnail, should not write back to full size memory cache + shouldCacheToMomery = NO; + } + if (shouldCacheToMomery && diskImage && self.config.shouldCacheImagesInMemory) { + NSUInteger cost = diskImage.sd_memoryCost; + [self.memoryCache setObject:diskImage forKey:key cost:cost]; + } + + return diskImage; +} + +- (nullable UIImage *)imageFromCacheForKey:(nullable NSString *)key { + return [self imageFromCacheForKey:key options:0 context:nil]; +} + +- (nullable UIImage *)imageFromCacheForKey:(nullable NSString *)key options:(SDImageCacheOptions)options context:(nullable SDWebImageContext *)context { + // First check the in-memory cache... + UIImage *image = [self imageFromMemoryCacheForKey:key]; + if (image) { + if (options & SDImageCacheDecodeFirstFrameOnly) { + // Ensure static image + Class animatedImageClass = image.class; + if (image.sd_isAnimated || ([animatedImageClass isSubclassOfClass:[UIImage class]] && [animatedImageClass conformsToProtocol:@protocol(SDAnimatedImage)])) { +#if SD_MAC + image = [[NSImage alloc] initWithCGImage:image.CGImage scale:image.scale orientation:kCGImagePropertyOrientationUp]; +#else + image = [[UIImage alloc] initWithCGImage:image.CGImage scale:image.scale orientation:image.imageOrientation]; +#endif + } + } else if (options & SDImageCacheMatchAnimatedImageClass) { + // Check image class matching + Class animatedImageClass = image.class; + Class desiredImageClass = context[SDWebImageContextAnimatedImageClass]; + if (desiredImageClass && ![animatedImageClass isSubclassOfClass:desiredImageClass]) { + image = nil; + } + } + } + + // Since we don't need to query imageData, return image if exist + if (image) { + return image; + } + + // Second check the disk cache... + image = [self imageFromDiskCacheForKey:key options:options context:context]; + return image; +} + +- (nullable NSData *)diskImageDataBySearchingAllPathsForKey:(nullable NSString *)key { + if (!key) { + return nil; + } + + NSData *data = [self.diskCache dataForKey:key]; + if (data) { + return data; + } + + // Addtional cache path for custom pre-load cache + if (self.additionalCachePathBlock) { + NSString *filePath = self.additionalCachePathBlock(key); + if (filePath) { + data = [NSData dataWithContentsOfFile:filePath options:self.config.diskCacheReadingOptions error:nil]; + } + } + + return data; +} + +- (nullable UIImage *)diskImageForKey:(nullable NSString *)key { + NSData *data = [self diskImageDataForKey:key]; + return [self diskImageForKey:key data:data]; +} + +- (nullable UIImage *)diskImageForKey:(nullable NSString *)key data:(nullable NSData *)data { + return [self diskImageForKey:key data:data options:0 context:nil]; +} + +- (nullable UIImage *)diskImageForKey:(nullable NSString *)key data:(nullable NSData *)data options:(SDImageCacheOptions)options context:(SDWebImageContext *)context { + if (!data) { + return nil; + } + UIImage *image = SDImageCacheDecodeImageData(data, key, [[self class] imageOptionsFromCacheOptions:options], context); + [self _unarchiveObjectWithImage:image forKey:key]; + return image; +} + +- (void)_unarchiveObjectWithImage:(UIImage *)image forKey:(NSString *)key { + if (!image) { + return; + } + // Check extended data + NSData *extendedData = [self.diskCache extendedDataForKey:key]; + if (!extendedData) { + return; + } + id extendedObject; + if (@available(iOS 11, tvOS 11, macOS 10.13, watchOS 4, *)) { + NSError *error; + NSKeyedUnarchiver *unarchiver = [[NSKeyedUnarchiver alloc] initForReadingFromData:extendedData error:&error]; + unarchiver.requiresSecureCoding = NO; + extendedObject = [unarchiver decodeTopLevelObjectForKey:NSKeyedArchiveRootObjectKey error:&error]; + if (error) { + NSLog(@"NSKeyedUnarchiver unarchive failed with error: %@", error); + } + } else { + @try { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + extendedObject = [NSKeyedUnarchiver unarchiveObjectWithData:extendedData]; +#pragma clang diagnostic pop + } @catch (NSException *exception) { + NSLog(@"NSKeyedUnarchiver unarchive failed with exception: %@", exception); + } + } + image.sd_extendedObject = extendedObject; +} + +- (nullable SDImageCacheToken *)queryCacheOperationForKey:(NSString *)key done:(SDImageCacheQueryCompletionBlock)doneBlock { + return [self queryCacheOperationForKey:key options:0 done:doneBlock]; +} + +- (nullable SDImageCacheToken *)queryCacheOperationForKey:(NSString *)key options:(SDImageCacheOptions)options done:(SDImageCacheQueryCompletionBlock)doneBlock { + return [self queryCacheOperationForKey:key options:options context:nil done:doneBlock]; +} + +- (nullable SDImageCacheToken *)queryCacheOperationForKey:(nullable NSString *)key options:(SDImageCacheOptions)options context:(nullable SDWebImageContext *)context done:(nullable SDImageCacheQueryCompletionBlock)doneBlock { + return [self queryCacheOperationForKey:key options:options context:context cacheType:SDImageCacheTypeAll done:doneBlock]; +} + +- (nullable SDImageCacheToken *)queryCacheOperationForKey:(nullable NSString *)key options:(SDImageCacheOptions)options context:(nullable SDWebImageContext *)context cacheType:(SDImageCacheType)queryCacheType done:(nullable SDImageCacheQueryCompletionBlock)doneBlock { + if (!key) { + if (doneBlock) { + doneBlock(nil, nil, SDImageCacheTypeNone); + } + return nil; + } + // Invalid cache type + if (queryCacheType == SDImageCacheTypeNone) { + if (doneBlock) { + doneBlock(nil, nil, SDImageCacheTypeNone); + } + return nil; + } + + // First check the in-memory cache... + UIImage *image; + if (queryCacheType != SDImageCacheTypeDisk) { + image = [self imageFromMemoryCacheForKey:key]; + } + + if (image) { + if (options & SDImageCacheDecodeFirstFrameOnly) { + // Ensure static image + Class animatedImageClass = image.class; + if (image.sd_isAnimated || ([animatedImageClass isSubclassOfClass:[UIImage class]] && [animatedImageClass conformsToProtocol:@protocol(SDAnimatedImage)])) { +#if SD_MAC + image = [[NSImage alloc] initWithCGImage:image.CGImage scale:image.scale orientation:kCGImagePropertyOrientationUp]; +#else + image = [[UIImage alloc] initWithCGImage:image.CGImage scale:image.scale orientation:image.imageOrientation]; +#endif + } + } else if (options & SDImageCacheMatchAnimatedImageClass) { + // Check image class matching + Class animatedImageClass = image.class; + Class desiredImageClass = context[SDWebImageContextAnimatedImageClass]; + if (desiredImageClass && ![animatedImageClass isSubclassOfClass:desiredImageClass]) { + image = nil; + } + } + } + + BOOL shouldQueryMemoryOnly = (queryCacheType == SDImageCacheTypeMemory) || (image && !(options & SDImageCacheQueryMemoryData)); + if (shouldQueryMemoryOnly) { + if (doneBlock) { + doneBlock(image, nil, SDImageCacheTypeMemory); + } + return nil; + } + + // Second check the disk cache... + SDImageCacheToken *operation = [[SDImageCacheToken alloc] initWithDoneBlock:doneBlock]; + operation.key = key; + // Check whether we need to synchronously query disk + // 1. in-memory cache hit & memoryDataSync + // 2. in-memory cache miss & diskDataSync + BOOL shouldQueryDiskSync = ((image && options & SDImageCacheQueryMemoryDataSync) || + (!image && options & SDImageCacheQueryDiskDataSync)); + NSData* (^queryDiskDataBlock)(void) = ^NSData* { + @synchronized (operation) { + if (operation.isCancelled) { + return nil; + } + } + + return [self diskImageDataBySearchingAllPathsForKey:key]; + }; + + UIImage* (^queryDiskImageBlock)(NSData*) = ^UIImage*(NSData* diskData) { + @synchronized (operation) { + if (operation.isCancelled) { + return nil; + } + } + + UIImage *diskImage; + if (image) { + // the image is from in-memory cache, but need image data + diskImage = image; + } else if (diskData) { + BOOL shouldCacheToMomery = YES; + if (context[SDWebImageContextStoreCacheType]) { + SDImageCacheType cacheType = [context[SDWebImageContextStoreCacheType] integerValue]; + shouldCacheToMomery = (cacheType == SDImageCacheTypeAll || cacheType == SDImageCacheTypeMemory); + } + if (context[SDWebImageContextImageThumbnailPixelSize]) { + // Query full size cache key which generate a thumbnail, should not write back to full size memory cache + shouldCacheToMomery = NO; + } + // decode image data only if in-memory cache missed + diskImage = [self diskImageForKey:key data:diskData options:options context:context]; + if (shouldCacheToMomery && diskImage && self.config.shouldCacheImagesInMemory) { + NSUInteger cost = diskImage.sd_memoryCost; + [self.memoryCache setObject:diskImage forKey:key cost:cost]; + } + } + return diskImage; + }; + + // Query in ioQueue to keep IO-safe + if (shouldQueryDiskSync) { + __block NSData* diskData; + __block UIImage* diskImage; + dispatch_sync(self.ioQueue, ^{ + diskData = queryDiskDataBlock(); + diskImage = queryDiskImageBlock(diskData); + }); + if (doneBlock) { + doneBlock(diskImage, diskData, SDImageCacheTypeDisk); + } + } else { + dispatch_async(self.ioQueue, ^{ + NSData* diskData = queryDiskDataBlock(); + UIImage* diskImage = queryDiskImageBlock(diskData); + @synchronized (operation) { + if (operation.isCancelled) { + return; + } + } + if (doneBlock) { + dispatch_async(dispatch_get_main_queue(), ^{ + // Dispatch from IO queue to main queue need time, user may call cancel during the dispatch timing + // This check is here to avoid double callback (one is from `SDImageCacheToken` in sync) + @synchronized (operation) { + if (operation.isCancelled) { + return; + } + } + doneBlock(diskImage, diskData, SDImageCacheTypeDisk); + }); + } + }); + } + + return operation; +} + +#pragma mark - Remove Ops + +- (void)removeImageForKey:(nullable NSString *)key withCompletion:(nullable SDWebImageNoParamsBlock)completion { + [self removeImageForKey:key fromDisk:YES withCompletion:completion]; +} + +- (void)removeImageForKey:(nullable NSString *)key fromDisk:(BOOL)fromDisk withCompletion:(nullable SDWebImageNoParamsBlock)completion { + [self removeImageForKey:key fromMemory:YES fromDisk:fromDisk withCompletion:completion]; +} + +- (void)removeImageForKey:(nullable NSString *)key fromMemory:(BOOL)fromMemory fromDisk:(BOOL)fromDisk withCompletion:(nullable SDWebImageNoParamsBlock)completion { + if (key == nil) { + return; + } + + if (fromMemory && self.config.shouldCacheImagesInMemory) { + [self.memoryCache removeObjectForKey:key]; + } + + if (fromDisk) { + dispatch_async(self.ioQueue, ^{ + [self.diskCache removeDataForKey:key]; + + if (completion) { + dispatch_async(dispatch_get_main_queue(), ^{ + completion(); + }); + } + }); + } else if (completion) { + completion(); + } +} + +- (void)removeImageFromMemoryForKey:(NSString *)key { + if (!key) { + return; + } + + [self.memoryCache removeObjectForKey:key]; +} + +- (void)removeImageFromDiskForKey:(NSString *)key { + if (!key) { + return; + } + dispatch_sync(self.ioQueue, ^{ + [self _removeImageFromDiskForKey:key]; + }); +} + +// Make sure to call from io queue by caller +- (void)_removeImageFromDiskForKey:(NSString *)key { + if (!key) { + return; + } + + [self.diskCache removeDataForKey:key]; +} + +#pragma mark - Cache clean Ops + +- (void)clearMemory { + [self.memoryCache removeAllObjects]; +} + +- (void)clearDiskOnCompletion:(nullable SDWebImageNoParamsBlock)completion { + dispatch_async(self.ioQueue, ^{ + [self.diskCache removeAllData]; + if (completion) { + dispatch_async(dispatch_get_main_queue(), ^{ + completion(); + }); + } + }); +} + +- (void)deleteOldFilesWithCompletionBlock:(nullable SDWebImageNoParamsBlock)completionBlock { + dispatch_async(self.ioQueue, ^{ + [self.diskCache removeExpiredData]; + if (completionBlock) { + dispatch_async(dispatch_get_main_queue(), ^{ + completionBlock(); + }); + } + }); +} + +#pragma mark - UIApplicationWillTerminateNotification + +#if SD_UIKIT || SD_MAC +- (void)applicationWillTerminate:(NSNotification *)notification { + // On iOS/macOS, the async opeartion to remove exipred data will be terminated quickly + // Try using the sync operation to ensure we reomve the exipred data + if (!self.config.shouldRemoveExpiredDataWhenTerminate) { + return; + } + dispatch_sync(self.ioQueue, ^{ + [self.diskCache removeExpiredData]; + }); +} +#endif + +#pragma mark - UIApplicationDidEnterBackgroundNotification + +#if SD_UIKIT +- (void)applicationDidEnterBackground:(NSNotification *)notification { + if (!self.config.shouldRemoveExpiredDataWhenEnterBackground) { + return; + } + Class UIApplicationClass = NSClassFromString(@"UIApplication"); + if(!UIApplicationClass || ![UIApplicationClass respondsToSelector:@selector(sharedApplication)]) { + return; + } + UIApplication *application = [UIApplication performSelector:@selector(sharedApplication)]; + __block UIBackgroundTaskIdentifier bgTask = [application beginBackgroundTaskWithExpirationHandler:^{ + // Clean up any unfinished task business by marking where you + // stopped or ending the task outright. + [application endBackgroundTask:bgTask]; + bgTask = UIBackgroundTaskInvalid; + }]; + + // Start the long-running task and return immediately. + [self deleteOldFilesWithCompletionBlock:^{ + [application endBackgroundTask:bgTask]; + bgTask = UIBackgroundTaskInvalid; + }]; +} +#endif + +#pragma mark - Cache Info + +- (NSUInteger)totalDiskSize { + __block NSUInteger size = 0; + dispatch_sync(self.ioQueue, ^{ + size = [self.diskCache totalSize]; + }); + return size; +} + +- (NSUInteger)totalDiskCount { + __block NSUInteger count = 0; + dispatch_sync(self.ioQueue, ^{ + count = [self.diskCache totalCount]; + }); + return count; +} + +- (void)calculateSizeWithCompletionBlock:(nullable SDImageCacheCalculateSizeBlock)completionBlock { + dispatch_async(self.ioQueue, ^{ + NSUInteger fileCount = [self.diskCache totalCount]; + NSUInteger totalSize = [self.diskCache totalSize]; + if (completionBlock) { + dispatch_async(dispatch_get_main_queue(), ^{ + completionBlock(fileCount, totalSize); + }); + } + }); +} + +#pragma mark - Helper ++ (SDWebImageOptions)imageOptionsFromCacheOptions:(SDImageCacheOptions)cacheOptions { + SDWebImageOptions options = 0; + if (cacheOptions & SDImageCacheScaleDownLargeImages) options |= SDWebImageScaleDownLargeImages; + if (cacheOptions & SDImageCacheDecodeFirstFrameOnly) options |= SDWebImageDecodeFirstFrameOnly; + if (cacheOptions & SDImageCachePreloadAllFrames) options |= SDWebImagePreloadAllFrames; + if (cacheOptions & SDImageCacheAvoidDecodeImage) options |= SDWebImageAvoidDecodeImage; + if (cacheOptions & SDImageCacheMatchAnimatedImageClass) options |= SDWebImageMatchAnimatedImageClass; + + return options; +} + +@end + +@implementation SDImageCache (SDImageCache) + +#pragma mark - SDImageCache + +- (id)queryImageForKey:(NSString *)key options:(SDWebImageOptions)options context:(nullable SDWebImageContext *)context completion:(nullable SDImageCacheQueryCompletionBlock)completionBlock { + return [self queryImageForKey:key options:options context:context cacheType:SDImageCacheTypeAll completion:completionBlock]; +} + +- (id)queryImageForKey:(NSString *)key options:(SDWebImageOptions)options context:(nullable SDWebImageContext *)context cacheType:(SDImageCacheType)cacheType completion:(nullable SDImageCacheQueryCompletionBlock)completionBlock { + SDImageCacheOptions cacheOptions = 0; + if (options & SDWebImageQueryMemoryData) cacheOptions |= SDImageCacheQueryMemoryData; + if (options & SDWebImageQueryMemoryDataSync) cacheOptions |= SDImageCacheQueryMemoryDataSync; + if (options & SDWebImageQueryDiskDataSync) cacheOptions |= SDImageCacheQueryDiskDataSync; + if (options & SDWebImageScaleDownLargeImages) cacheOptions |= SDImageCacheScaleDownLargeImages; + if (options & SDWebImageAvoidDecodeImage) cacheOptions |= SDImageCacheAvoidDecodeImage; + if (options & SDWebImageDecodeFirstFrameOnly) cacheOptions |= SDImageCacheDecodeFirstFrameOnly; + if (options & SDWebImagePreloadAllFrames) cacheOptions |= SDImageCachePreloadAllFrames; + if (options & SDWebImageMatchAnimatedImageClass) cacheOptions |= SDImageCacheMatchAnimatedImageClass; + + return [self queryCacheOperationForKey:key options:cacheOptions context:context cacheType:cacheType done:completionBlock]; +} + +- (void)storeImage:(UIImage *)image imageData:(NSData *)imageData forKey:(nullable NSString *)key cacheType:(SDImageCacheType)cacheType completion:(nullable SDWebImageNoParamsBlock)completionBlock { + switch (cacheType) { + case SDImageCacheTypeNone: { + [self storeImage:image imageData:imageData forKey:key toMemory:NO toDisk:NO completion:completionBlock]; + } + break; + case SDImageCacheTypeMemory: { + [self storeImage:image imageData:imageData forKey:key toMemory:YES toDisk:NO completion:completionBlock]; + } + break; + case SDImageCacheTypeDisk: { + [self storeImage:image imageData:imageData forKey:key toMemory:NO toDisk:YES completion:completionBlock]; + } + break; + case SDImageCacheTypeAll: { + [self storeImage:image imageData:imageData forKey:key toMemory:YES toDisk:YES completion:completionBlock]; + } + break; + default: { + if (completionBlock) { + completionBlock(); + } + } + break; + } +} + +- (void)removeImageForKey:(NSString *)key cacheType:(SDImageCacheType)cacheType completion:(nullable SDWebImageNoParamsBlock)completionBlock { + switch (cacheType) { + case SDImageCacheTypeNone: { + [self removeImageForKey:key fromMemory:NO fromDisk:NO withCompletion:completionBlock]; + } + break; + case SDImageCacheTypeMemory: { + [self removeImageForKey:key fromMemory:YES fromDisk:NO withCompletion:completionBlock]; + } + break; + case SDImageCacheTypeDisk: { + [self removeImageForKey:key fromMemory:NO fromDisk:YES withCompletion:completionBlock]; + } + break; + case SDImageCacheTypeAll: { + [self removeImageForKey:key fromMemory:YES fromDisk:YES withCompletion:completionBlock]; + } + break; + default: { + if (completionBlock) { + completionBlock(); + } + } + break; + } +} + +- (void)containsImageForKey:(NSString *)key cacheType:(SDImageCacheType)cacheType completion:(nullable SDImageCacheContainsCompletionBlock)completionBlock { + switch (cacheType) { + case SDImageCacheTypeNone: { + if (completionBlock) { + completionBlock(SDImageCacheTypeNone); + } + } + break; + case SDImageCacheTypeMemory: { + BOOL isInMemoryCache = ([self imageFromMemoryCacheForKey:key] != nil); + if (completionBlock) { + completionBlock(isInMemoryCache ? SDImageCacheTypeMemory : SDImageCacheTypeNone); + } + } + break; + case SDImageCacheTypeDisk: { + [self diskImageExistsWithKey:key completion:^(BOOL isInDiskCache) { + if (completionBlock) { + completionBlock(isInDiskCache ? SDImageCacheTypeDisk : SDImageCacheTypeNone); + } + }]; + } + break; + case SDImageCacheTypeAll: { + BOOL isInMemoryCache = ([self imageFromMemoryCacheForKey:key] != nil); + if (isInMemoryCache) { + if (completionBlock) { + completionBlock(SDImageCacheTypeMemory); + } + return; + } + [self diskImageExistsWithKey:key completion:^(BOOL isInDiskCache) { + if (completionBlock) { + completionBlock(isInDiskCache ? SDImageCacheTypeDisk : SDImageCacheTypeNone); + } + }]; + } + break; + default: + if (completionBlock) { + completionBlock(SDImageCacheTypeNone); + } + break; + } +} + +- (void)clearWithCacheType:(SDImageCacheType)cacheType completion:(SDWebImageNoParamsBlock)completionBlock { + switch (cacheType) { + case SDImageCacheTypeNone: { + if (completionBlock) { + completionBlock(); + } + } + break; + case SDImageCacheTypeMemory: { + [self clearMemory]; + if (completionBlock) { + completionBlock(); + } + } + break; + case SDImageCacheTypeDisk: { + [self clearDiskOnCompletion:completionBlock]; + } + break; + case SDImageCacheTypeAll: { + [self clearMemory]; + [self clearDiskOnCompletion:completionBlock]; + } + break; + default: { + if (completionBlock) { + completionBlock(); + } + } + break; + } +} + +@end + diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageCacheConfig.h b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageCacheConfig.h new file mode 100644 index 0000000..468fa09 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageCacheConfig.h @@ -0,0 +1,144 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import +#import "SDWebImageCompat.h" + +/// Image Cache Expire Type +typedef NS_ENUM(NSUInteger, SDImageCacheConfigExpireType) { + /** + * When the image cache is accessed it will update this value + */ + SDImageCacheConfigExpireTypeAccessDate, + /** + * When the image cache is created or modified it will update this value (Default) + */ + SDImageCacheConfigExpireTypeModificationDate, + /** + * When the image cache is created it will update this value + */ + SDImageCacheConfigExpireTypeCreationDate, + /** + * When the image cache is created, modified, renamed, file attribute updated (like permission, xattr) it will update this value + */ + SDImageCacheConfigExpireTypeChangeDate, +}; + +/** + The class contains all the config for image cache + @note This class conform to NSCopying, make sure to add the property in `copyWithZone:` as well. + */ +@interface SDImageCacheConfig : NSObject + +/** + Gets the default cache config used for shared instance or initialization when it does not provide any cache config. Such as `SDImageCache.sharedImageCache`. + @note You can modify the property on default cache config, which can be used for later created cache instance. The already created cache instance does not get affected. + */ +@property (nonatomic, class, readonly, nonnull) SDImageCacheConfig *defaultCacheConfig; + +/** + * Whether or not to disable iCloud backup + * Defaults to YES. + */ +@property (assign, nonatomic) BOOL shouldDisableiCloud; + +/** + * Whether or not to use memory cache + * @note When the memory cache is disabled, the weak memory cache will also be disabled. + * Defaults to YES. + */ +@property (assign, nonatomic) BOOL shouldCacheImagesInMemory; + +/* + * The option to control weak memory cache for images. When enable, `SDImageCache`'s memory cache will use a weak maptable to store the image at the same time when it stored to memory, and get removed at the same time. + * However when memory warning is triggered, since the weak maptable does not hold a strong reference to image instance, even when the memory cache itself is purged, some images which are held strongly by UIImageViews or other live instances can be recovered again, to avoid later re-query from disk cache or network. This may be helpful for the case, for example, when app enter background and memory is purged, cause cell flashing after re-enter foreground. + * When enabling this option, we will sync back the image from weak maptable to strong cache during next time top level `sd_setImage` function call. + * Defaults to NO (YES before 5.12.0 version). You can change this option dynamically. + */ +@property (assign, nonatomic) BOOL shouldUseWeakMemoryCache; + +/** + * Whether or not to remove the expired disk data when application entering the background. (Not works for macOS) + * Defaults to YES. + */ +@property (assign, nonatomic) BOOL shouldRemoveExpiredDataWhenEnterBackground; + +/** + * Whether or not to remove the expired disk data when application been terminated. This operation is processed in sync to ensure clean up. + * Defaults to YES. + */ +@property (assign, nonatomic) BOOL shouldRemoveExpiredDataWhenTerminate; + +/** + * The reading options while reading cache from disk. + * Defaults to 0. You can set this to `NSDataReadingMappedIfSafe` to improve performance. + */ +@property (assign, nonatomic) NSDataReadingOptions diskCacheReadingOptions; + +/** + * The writing options while writing cache to disk. + * Defaults to `NSDataWritingAtomic`. You can set this to `NSDataWritingWithoutOverwriting` to prevent overwriting an existing file. + */ +@property (assign, nonatomic) NSDataWritingOptions diskCacheWritingOptions; + +/** + * The maximum length of time to keep an image in the disk cache, in seconds. + * Setting this to a negative value means no expiring. + * Setting this to zero means that all cached files would be removed when do expiration check. + * Defaults to 1 week. + */ +@property (assign, nonatomic) NSTimeInterval maxDiskAge; + +/** + * The maximum size of the disk cache, in bytes. + * Defaults to 0. Which means there is no cache size limit. + */ +@property (assign, nonatomic) NSUInteger maxDiskSize; + +/** + * The maximum "total cost" of the in-memory image cache. The cost function is the bytes size held in memory. + * @note The memory cost is bytes size in memory, but not simple pixels count. For common ARGB8888 image, one pixel is 4 bytes (32 bits). + * Defaults to 0. Which means there is no memory cost limit. + */ +@property (assign, nonatomic) NSUInteger maxMemoryCost; + +/** + * The maximum number of objects in-memory image cache should hold. + * Defaults to 0. Which means there is no memory count limit. + */ +@property (assign, nonatomic) NSUInteger maxMemoryCount; + +/* + * The attribute which the clear cache will be checked against when clearing the disk cache + * Default is Modified Date + */ +@property (assign, nonatomic) SDImageCacheConfigExpireType diskCacheExpireType; + +/** + * The custom file manager for disk cache. Pass nil to let disk cache choose the proper file manager. + * Defaults to nil. + * @note This value does not support dynamic changes. Which means further modification on this value after cache initialized has no effect. + * @note Since `NSFileManager` does not support `NSCopying`. We just pass this by reference during copying. So it's not recommend to set this value on `defaultCacheConfig`. + */ +@property (strong, nonatomic, nullable) NSFileManager *fileManager; + +/** + * The custom memory cache class. Provided class instance must conform to `SDMemoryCache` protocol to allow usage. + * Defaults to built-in `SDMemoryCache` class. + * @note This value does not support dynamic changes. Which means further modification on this value after cache initialized has no effect. + */ +@property (assign, nonatomic, nonnull) Class memoryCacheClass; + +/** + * The custom disk cache class. Provided class instance must conform to `SDDiskCache` protocol to allow usage. + * Defaults to built-in `SDDiskCache` class. + * @note This value does not support dynamic changes. Which means further modification on this value after cache initialized has no effect. + */ +@property (assign ,nonatomic, nonnull) Class diskCacheClass; + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageCacheConfig.m b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageCacheConfig.m new file mode 100644 index 0000000..fc02285 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageCacheConfig.m @@ -0,0 +1,65 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDImageCacheConfig.h" +#import "SDMemoryCache.h" +#import "SDDiskCache.h" + +static SDImageCacheConfig *_defaultCacheConfig; +static const NSInteger kDefaultCacheMaxDiskAge = 60 * 60 * 24 * 7; // 1 week + +@implementation SDImageCacheConfig + ++ (SDImageCacheConfig *)defaultCacheConfig { + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + _defaultCacheConfig = [SDImageCacheConfig new]; + }); + return _defaultCacheConfig; +} + +- (instancetype)init { + if (self = [super init]) { + _shouldDisableiCloud = YES; + _shouldCacheImagesInMemory = YES; + _shouldUseWeakMemoryCache = NO; + _shouldRemoveExpiredDataWhenEnterBackground = YES; + _shouldRemoveExpiredDataWhenTerminate = YES; + _diskCacheReadingOptions = 0; + _diskCacheWritingOptions = NSDataWritingAtomic; + _maxDiskAge = kDefaultCacheMaxDiskAge; + _maxDiskSize = 0; + _diskCacheExpireType = SDImageCacheConfigExpireTypeModificationDate; + _memoryCacheClass = [SDMemoryCache class]; + _diskCacheClass = [SDDiskCache class]; + } + return self; +} + +- (id)copyWithZone:(NSZone *)zone { + SDImageCacheConfig *config = [[[self class] allocWithZone:zone] init]; + config.shouldDisableiCloud = self.shouldDisableiCloud; + config.shouldCacheImagesInMemory = self.shouldCacheImagesInMemory; + config.shouldUseWeakMemoryCache = self.shouldUseWeakMemoryCache; + config.shouldRemoveExpiredDataWhenEnterBackground = self.shouldRemoveExpiredDataWhenEnterBackground; + config.shouldRemoveExpiredDataWhenTerminate = self.shouldRemoveExpiredDataWhenTerminate; + config.diskCacheReadingOptions = self.diskCacheReadingOptions; + config.diskCacheWritingOptions = self.diskCacheWritingOptions; + config.maxDiskAge = self.maxDiskAge; + config.maxDiskSize = self.maxDiskSize; + config.maxMemoryCost = self.maxMemoryCost; + config.maxMemoryCount = self.maxMemoryCount; + config.diskCacheExpireType = self.diskCacheExpireType; + config.fileManager = self.fileManager; // NSFileManager does not conform to NSCopying, just pass the reference + config.memoryCacheClass = self.memoryCacheClass; + config.diskCacheClass = self.diskCacheClass; + + return config; +} + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageCacheDefine.h b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageCacheDefine.h new file mode 100644 index 0000000..9d84046 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageCacheDefine.h @@ -0,0 +1,150 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import +#import "SDWebImageCompat.h" +#import "SDWebImageOperation.h" +#import "SDWebImageDefine.h" +#import "SDImageCoder.h" + +/// Image Cache Type +typedef NS_ENUM(NSInteger, SDImageCacheType) { + /** + * For query and contains op in response, means the image isn't available in the image cache + * For op in request, this type is not available and take no effect. + */ + SDImageCacheTypeNone, + /** + * For query and contains op in response, means the image was obtained from the disk cache. + * For op in request, means process only disk cache. + */ + SDImageCacheTypeDisk, + /** + * For query and contains op in response, means the image was obtained from the memory cache. + * For op in request, means process only memory cache. + */ + SDImageCacheTypeMemory, + /** + * For query and contains op in response, this type is not available and take no effect. + * For op in request, means process both memory cache and disk cache. + */ + SDImageCacheTypeAll +}; + +typedef void(^SDImageCacheCheckCompletionBlock)(BOOL isInCache); +typedef void(^SDImageCacheQueryDataCompletionBlock)(NSData * _Nullable data); +typedef void(^SDImageCacheCalculateSizeBlock)(NSUInteger fileCount, NSUInteger totalSize); +typedef NSString * _Nullable (^SDImageCacheAdditionalCachePathBlock)(NSString * _Nonnull key); +typedef void(^SDImageCacheQueryCompletionBlock)(UIImage * _Nullable image, NSData * _Nullable data, SDImageCacheType cacheType); +typedef void(^SDImageCacheContainsCompletionBlock)(SDImageCacheType containsCacheType); + +/** + This is the built-in decoding process for image query from cache. + @note If you want to implement your custom loader with `queryImageForKey:options:context:completion:` API, but also want to keep compatible with SDWebImage's behavior, you'd better use this to produce image. + + @param imageData The image data from the cache. Should not be nil + @param cacheKey The image cache key from the input. Should not be nil + @param options The options arg from the input + @param context The context arg from the input + @return The decoded image for current image data query from cache + */ +FOUNDATION_EXPORT UIImage * _Nullable SDImageCacheDecodeImageData(NSData * _Nonnull imageData, NSString * _Nonnull cacheKey, SDWebImageOptions options, SDWebImageContext * _Nullable context); + +/// Get the decode options from the loading context options and cache key. This is the built-in translate between the web loading part to the decoding part (which does not depens on). +/// @param context The options arg from the input +/// @param options The context arg from the input +/// @param cacheKey The image cache key from the input. Should not be nil +FOUNDATION_EXPORT SDImageCoderOptions * _Nonnull SDGetDecodeOptionsFromContext(SDWebImageContext * _Nullable context, SDWebImageOptions options, NSString * _Nonnull cacheKey); + +/** + This is the image cache protocol to provide custom image cache for `SDWebImageManager`. + Though the best practice to custom image cache, is to write your own class which conform `SDMemoryCache` or `SDDiskCache` protocol for `SDImageCache` class (See more on `SDImageCacheConfig.memoryCacheClass & SDImageCacheConfig.diskCacheClass`). + However, if your own cache implementation contains more advanced feature beyond `SDImageCache` itself, you can consider to provide this instead. For example, you can even use a cache manager like `SDImageCachesManager` to register multiple caches. + */ +@protocol SDImageCache + +@required +/** + Query the cached image from image cache for given key. The operation can be used to cancel the query. + If image is cached in memory, completion is called synchronously, else asynchronously and depends on the options arg (See `SDWebImageQueryDiskSync`) + + @param key The image cache key + @param options A mask to specify options to use for this query + @param context A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold. + @param completionBlock The completion block. Will not get called if the operation is cancelled + @return The operation for this query + */ +- (nullable id)queryImageForKey:(nullable NSString *)key + options:(SDWebImageOptions)options + context:(nullable SDWebImageContext *)context + completion:(nullable SDImageCacheQueryCompletionBlock)completionBlock; + +/** + Query the cached image from image cache for given key. The operation can be used to cancel the query. + If image is cached in memory, completion is called synchronously, else asynchronously and depends on the options arg (See `SDWebImageQueryDiskSync`) + + @param key The image cache key + @param options A mask to specify options to use for this query + @param context A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold. + @param cacheType Specify where to query the cache from. By default we use `.all`, which means both memory cache and disk cache. You can choose to query memory only or disk only as well. Pass `.none` is invalid and callback with nil immediately. + @param completionBlock The completion block. Will not get called if the operation is cancelled + @return The operation for this query + */ +- (nullable id)queryImageForKey:(nullable NSString *)key + options:(SDWebImageOptions)options + context:(nullable SDWebImageContext *)context + cacheType:(SDImageCacheType)cacheType + completion:(nullable SDImageCacheQueryCompletionBlock)completionBlock; + +/** + Store the image into image cache for the given key. If cache type is memory only, completion is called synchronously, else asynchronously. + + @param image The image to store + @param imageData The image data to be used for disk storage + @param key The image cache key + @param cacheType The image store op cache type + @param completionBlock A block executed after the operation is finished + */ +- (void)storeImage:(nullable UIImage *)image + imageData:(nullable NSData *)imageData + forKey:(nullable NSString *)key + cacheType:(SDImageCacheType)cacheType + completion:(nullable SDWebImageNoParamsBlock)completionBlock; + +/** + Remove the image from image cache for the given key. If cache type is memory only, completion is called synchronously, else asynchronously. + + @param key The image cache key + @param cacheType The image remove op cache type + @param completionBlock A block executed after the operation is finished + */ +- (void)removeImageForKey:(nullable NSString *)key + cacheType:(SDImageCacheType)cacheType + completion:(nullable SDWebImageNoParamsBlock)completionBlock; + +/** + Check if image cache contains the image for the given key (does not load the image). If image is cached in memory, completion is called synchronously, else asynchronously. + + @param key The image cache key + @param cacheType The image contains op cache type + @param completionBlock A block executed after the operation is finished. + */ +- (void)containsImageForKey:(nullable NSString *)key + cacheType:(SDImageCacheType)cacheType + completion:(nullable SDImageCacheContainsCompletionBlock)completionBlock; + +/** + Clear all the cached images for image cache. If cache type is memory only, completion is called synchronously, else asynchronously. + + @param cacheType The image clear op cache type + @param completionBlock A block executed after the operation is finished + */ +- (void)clearWithCacheType:(SDImageCacheType)cacheType + completion:(nullable SDWebImageNoParamsBlock)completionBlock; + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageCacheDefine.m b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageCacheDefine.m new file mode 100644 index 0000000..8ee8750 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageCacheDefine.m @@ -0,0 +1,97 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDImageCacheDefine.h" +#import "SDImageCodersManager.h" +#import "SDImageCoderHelper.h" +#import "SDAnimatedImage.h" +#import "UIImage+Metadata.h" +#import "SDInternalMacros.h" + +SDImageCoderOptions * _Nonnull SDGetDecodeOptionsFromContext(SDWebImageContext * _Nullable context, SDWebImageOptions options, NSString * _Nonnull cacheKey) { + BOOL decodeFirstFrame = SD_OPTIONS_CONTAINS(options, SDWebImageDecodeFirstFrameOnly); + NSNumber *scaleValue = context[SDWebImageContextImageScaleFactor]; + CGFloat scale = scaleValue.doubleValue >= 1 ? scaleValue.doubleValue : SDImageScaleFactorForKey(cacheKey); + NSNumber *preserveAspectRatioValue = context[SDWebImageContextImagePreserveAspectRatio]; + NSValue *thumbnailSizeValue; + BOOL shouldScaleDown = SD_OPTIONS_CONTAINS(options, SDWebImageScaleDownLargeImages); + if (shouldScaleDown) { + CGFloat thumbnailPixels = SDImageCoderHelper.defaultScaleDownLimitBytes / 4; + CGFloat dimension = ceil(sqrt(thumbnailPixels)); + thumbnailSizeValue = @(CGSizeMake(dimension, dimension)); + } + if (context[SDWebImageContextImageThumbnailPixelSize]) { + thumbnailSizeValue = context[SDWebImageContextImageThumbnailPixelSize]; + } + + SDImageCoderMutableOptions *mutableCoderOptions = [NSMutableDictionary dictionaryWithCapacity:2]; + mutableCoderOptions[SDImageCoderDecodeFirstFrameOnly] = @(decodeFirstFrame); + mutableCoderOptions[SDImageCoderDecodeScaleFactor] = @(scale); + mutableCoderOptions[SDImageCoderDecodePreserveAspectRatio] = preserveAspectRatioValue; + mutableCoderOptions[SDImageCoderDecodeThumbnailPixelSize] = thumbnailSizeValue; + mutableCoderOptions[SDImageCoderWebImageContext] = context; + SDImageCoderOptions *coderOptions = [mutableCoderOptions copy]; + + return coderOptions; +} + +UIImage * _Nullable SDImageCacheDecodeImageData(NSData * _Nonnull imageData, NSString * _Nonnull cacheKey, SDWebImageOptions options, SDWebImageContext * _Nullable context) { + NSCParameterAssert(imageData); + NSCParameterAssert(cacheKey); + UIImage *image; + SDImageCoderOptions *coderOptions = SDGetDecodeOptionsFromContext(context, options, cacheKey); + BOOL decodeFirstFrame = SD_OPTIONS_CONTAINS(options, SDWebImageDecodeFirstFrameOnly); + CGFloat scale = [coderOptions[SDImageCoderDecodeScaleFactor] doubleValue]; + + // Grab the image coder + id imageCoder; + if ([context[SDWebImageContextImageCoder] conformsToProtocol:@protocol(SDImageCoder)]) { + imageCoder = context[SDWebImageContextImageCoder]; + } else { + imageCoder = [SDImageCodersManager sharedManager]; + } + + if (!decodeFirstFrame) { + Class animatedImageClass = context[SDWebImageContextAnimatedImageClass]; + // check whether we should use `SDAnimatedImage` + if ([animatedImageClass isSubclassOfClass:[UIImage class]] && [animatedImageClass conformsToProtocol:@protocol(SDAnimatedImage)]) { + image = [[animatedImageClass alloc] initWithData:imageData scale:scale options:coderOptions]; + if (image) { + // Preload frames if supported + if (options & SDWebImagePreloadAllFrames && [image respondsToSelector:@selector(preloadAllFrames)]) { + [((id)image) preloadAllFrames]; + } + } else { + // Check image class matching + if (options & SDWebImageMatchAnimatedImageClass) { + return nil; + } + } + } + } + if (!image) { + image = [imageCoder decodedImageWithData:imageData options:coderOptions]; + } + if (image) { + BOOL shouldDecode = !SD_OPTIONS_CONTAINS(options, SDWebImageAvoidDecodeImage); + if ([image.class conformsToProtocol:@protocol(SDAnimatedImage)]) { + // `SDAnimatedImage` do not decode + shouldDecode = NO; + } else if (image.sd_isAnimated) { + // animated image do not decode + shouldDecode = NO; + } + if (shouldDecode) { + image = [SDImageCoderHelper decodedImageWithImage:image]; + } + // assign the decode options, to let manager check whether to re-decode if needed + image.sd_decodeOptions = coderOptions; + } + + return image; +} diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageCachesManager.h b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageCachesManager.h new file mode 100644 index 0000000..ad85db8 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageCachesManager.h @@ -0,0 +1,81 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import +#import "SDImageCacheDefine.h" + +/// Policy for cache operation +typedef NS_ENUM(NSUInteger, SDImageCachesManagerOperationPolicy) { + SDImageCachesManagerOperationPolicySerial, // process all caches serially (from the highest priority to the lowest priority cache by order) + SDImageCachesManagerOperationPolicyConcurrent, // process all caches concurrently + SDImageCachesManagerOperationPolicyHighestOnly, // process the highest priority cache only + SDImageCachesManagerOperationPolicyLowestOnly // process the lowest priority cache only +}; + +/** + A caches manager to manage multiple caches. + */ +@interface SDImageCachesManager : NSObject + +/** + Returns the global shared caches manager instance. By default we will set [`SDImageCache.sharedImageCache`] into the caches array. + */ +@property (nonatomic, class, readonly, nonnull) SDImageCachesManager *sharedManager; + +// These are op policy for cache manager. + +/** + Operation policy for query op. + Defaults to `Serial`, means query all caches serially (one completion called then next begin) until one cache query success (`image` != nil). + */ +@property (nonatomic, assign) SDImageCachesManagerOperationPolicy queryOperationPolicy; + +/** + Operation policy for store op. + Defaults to `HighestOnly`, means store to the highest priority cache only. + */ +@property (nonatomic, assign) SDImageCachesManagerOperationPolicy storeOperationPolicy; + +/** + Operation policy for remove op. + Defaults to `Concurrent`, means remove all caches concurrently. + */ +@property (nonatomic, assign) SDImageCachesManagerOperationPolicy removeOperationPolicy; + +/** + Operation policy for contains op. + Defaults to `Serial`, means check all caches serially (one completion called then next begin) until one cache check success (`containsCacheType` != None). + */ +@property (nonatomic, assign) SDImageCachesManagerOperationPolicy containsOperationPolicy; + +/** + Operation policy for clear op. + Defaults to `Concurrent`, means clear all caches concurrently. + */ +@property (nonatomic, assign) SDImageCachesManagerOperationPolicy clearOperationPolicy; + +/** + All caches in caches manager. The caches array is a priority queue, which means the later added cache will have the highest priority + */ +@property (nonatomic, copy, nullable) NSArray> *caches; + +/** + Add a new cache to the end of caches array. Which has the highest priority. + + @param cache cache + */ +- (void)addCache:(nonnull id)cache; + +/** + Remove a cache in the caches array. + + @param cache cache + */ +- (void)removeCache:(nonnull id)cache; + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageCachesManager.m b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageCachesManager.m new file mode 100644 index 0000000..5b8c0c3 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageCachesManager.m @@ -0,0 +1,556 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDImageCachesManager.h" +#import "SDImageCachesManagerOperation.h" +#import "SDImageCache.h" +#import "SDInternalMacros.h" + +@interface SDImageCachesManager () + +@property (nonatomic, strong, nonnull) NSMutableArray> *imageCaches; + +@end + +@implementation SDImageCachesManager { + SD_LOCK_DECLARE(_cachesLock); +} + ++ (SDImageCachesManager *)sharedManager { + static dispatch_once_t onceToken; + static SDImageCachesManager *manager; + dispatch_once(&onceToken, ^{ + manager = [[SDImageCachesManager alloc] init]; + }); + return manager; +} + +- (instancetype)init { + self = [super init]; + if (self) { + self.queryOperationPolicy = SDImageCachesManagerOperationPolicySerial; + self.storeOperationPolicy = SDImageCachesManagerOperationPolicyHighestOnly; + self.removeOperationPolicy = SDImageCachesManagerOperationPolicyConcurrent; + self.containsOperationPolicy = SDImageCachesManagerOperationPolicySerial; + self.clearOperationPolicy = SDImageCachesManagerOperationPolicyConcurrent; + // initialize with default image caches + _imageCaches = [NSMutableArray arrayWithObject:[SDImageCache sharedImageCache]]; + SD_LOCK_INIT(_cachesLock); + } + return self; +} + +- (NSArray> *)caches { + SD_LOCK(_cachesLock); + NSArray> *caches = [_imageCaches copy]; + SD_UNLOCK(_cachesLock); + return caches; +} + +- (void)setCaches:(NSArray> *)caches { + SD_LOCK(_cachesLock); + [_imageCaches removeAllObjects]; + if (caches.count) { + [_imageCaches addObjectsFromArray:caches]; + } + SD_UNLOCK(_cachesLock); +} + +#pragma mark - Cache IO operations + +- (void)addCache:(id)cache { + if (![cache conformsToProtocol:@protocol(SDImageCache)]) { + return; + } + SD_LOCK(_cachesLock); + [_imageCaches addObject:cache]; + SD_UNLOCK(_cachesLock); +} + +- (void)removeCache:(id)cache { + if (![cache conformsToProtocol:@protocol(SDImageCache)]) { + return; + } + SD_LOCK(_cachesLock); + [_imageCaches removeObject:cache]; + SD_UNLOCK(_cachesLock); +} + +#pragma mark - SDImageCache + +- (id)queryImageForKey:(NSString *)key options:(SDWebImageOptions)options context:(SDWebImageContext *)context completion:(SDImageCacheQueryCompletionBlock)completionBlock { + return [self queryImageForKey:key options:options context:context cacheType:SDImageCacheTypeAll completion:completionBlock]; +} + +- (id)queryImageForKey:(NSString *)key options:(SDWebImageOptions)options context:(SDWebImageContext *)context cacheType:(SDImageCacheType)cacheType completion:(SDImageCacheQueryCompletionBlock)completionBlock { + if (!key) { + return nil; + } + NSArray> *caches = self.caches; + NSUInteger count = caches.count; + if (count == 0) { + return nil; + } else if (count == 1) { + return [caches.firstObject queryImageForKey:key options:options context:context cacheType:cacheType completion:completionBlock]; + } + switch (self.queryOperationPolicy) { + case SDImageCachesManagerOperationPolicyHighestOnly: { + id cache = caches.lastObject; + return [cache queryImageForKey:key options:options context:context cacheType:cacheType completion:completionBlock]; + } + break; + case SDImageCachesManagerOperationPolicyLowestOnly: { + id cache = caches.firstObject; + return [cache queryImageForKey:key options:options context:context cacheType:cacheType completion:completionBlock]; + } + break; + case SDImageCachesManagerOperationPolicyConcurrent: { + SDImageCachesManagerOperation *operation = [SDImageCachesManagerOperation new]; + [operation beginWithTotalCount:caches.count]; + [self concurrentQueryImageForKey:key options:options context:context cacheType:cacheType completion:completionBlock enumerator:caches.reverseObjectEnumerator operation:operation]; + return operation; + } + break; + case SDImageCachesManagerOperationPolicySerial: { + SDImageCachesManagerOperation *operation = [SDImageCachesManagerOperation new]; + [operation beginWithTotalCount:caches.count]; + [self serialQueryImageForKey:key options:options context:context cacheType:cacheType completion:completionBlock enumerator:caches.reverseObjectEnumerator operation:operation]; + return operation; + } + break; + default: + return nil; + break; + } +} + +- (void)storeImage:(UIImage *)image imageData:(NSData *)imageData forKey:(NSString *)key cacheType:(SDImageCacheType)cacheType completion:(SDWebImageNoParamsBlock)completionBlock { + if (!key) { + return; + } + NSArray> *caches = self.caches; + NSUInteger count = caches.count; + if (count == 0) { + return; + } else if (count == 1) { + [caches.firstObject storeImage:image imageData:imageData forKey:key cacheType:cacheType completion:completionBlock]; + return; + } + switch (self.storeOperationPolicy) { + case SDImageCachesManagerOperationPolicyHighestOnly: { + id cache = caches.lastObject; + [cache storeImage:image imageData:imageData forKey:key cacheType:cacheType completion:completionBlock]; + } + break; + case SDImageCachesManagerOperationPolicyLowestOnly: { + id cache = caches.firstObject; + [cache storeImage:image imageData:imageData forKey:key cacheType:cacheType completion:completionBlock]; + } + break; + case SDImageCachesManagerOperationPolicyConcurrent: { + SDImageCachesManagerOperation *operation = [SDImageCachesManagerOperation new]; + [operation beginWithTotalCount:caches.count]; + [self concurrentStoreImage:image imageData:imageData forKey:key cacheType:cacheType completion:completionBlock enumerator:caches.reverseObjectEnumerator operation:operation]; + } + break; + case SDImageCachesManagerOperationPolicySerial: { + [self serialStoreImage:image imageData:imageData forKey:key cacheType:cacheType completion:completionBlock enumerator:caches.reverseObjectEnumerator]; + } + break; + default: + break; + } +} + +- (void)removeImageForKey:(NSString *)key cacheType:(SDImageCacheType)cacheType completion:(SDWebImageNoParamsBlock)completionBlock { + if (!key) { + return; + } + NSArray> *caches = self.caches; + NSUInteger count = caches.count; + if (count == 0) { + return; + } else if (count == 1) { + [caches.firstObject removeImageForKey:key cacheType:cacheType completion:completionBlock]; + return; + } + switch (self.removeOperationPolicy) { + case SDImageCachesManagerOperationPolicyHighestOnly: { + id cache = caches.lastObject; + [cache removeImageForKey:key cacheType:cacheType completion:completionBlock]; + } + break; + case SDImageCachesManagerOperationPolicyLowestOnly: { + id cache = caches.firstObject; + [cache removeImageForKey:key cacheType:cacheType completion:completionBlock]; + } + break; + case SDImageCachesManagerOperationPolicyConcurrent: { + SDImageCachesManagerOperation *operation = [SDImageCachesManagerOperation new]; + [operation beginWithTotalCount:caches.count]; + [self concurrentRemoveImageForKey:key cacheType:cacheType completion:completionBlock enumerator:caches.reverseObjectEnumerator operation:operation]; + } + break; + case SDImageCachesManagerOperationPolicySerial: { + [self serialRemoveImageForKey:key cacheType:cacheType completion:completionBlock enumerator:caches.reverseObjectEnumerator]; + } + break; + default: + break; + } +} + +- (void)containsImageForKey:(NSString *)key cacheType:(SDImageCacheType)cacheType completion:(SDImageCacheContainsCompletionBlock)completionBlock { + if (!key) { + return; + } + NSArray> *caches = self.caches; + NSUInteger count = caches.count; + if (count == 0) { + return; + } else if (count == 1) { + [caches.firstObject containsImageForKey:key cacheType:cacheType completion:completionBlock]; + return; + } + switch (self.clearOperationPolicy) { + case SDImageCachesManagerOperationPolicyHighestOnly: { + id cache = caches.lastObject; + [cache containsImageForKey:key cacheType:cacheType completion:completionBlock]; + } + break; + case SDImageCachesManagerOperationPolicyLowestOnly: { + id cache = caches.firstObject; + [cache containsImageForKey:key cacheType:cacheType completion:completionBlock]; + } + break; + case SDImageCachesManagerOperationPolicyConcurrent: { + SDImageCachesManagerOperation *operation = [SDImageCachesManagerOperation new]; + [operation beginWithTotalCount:caches.count]; + [self concurrentContainsImageForKey:key cacheType:cacheType completion:completionBlock enumerator:caches.reverseObjectEnumerator operation:operation]; + } + break; + case SDImageCachesManagerOperationPolicySerial: { + SDImageCachesManagerOperation *operation = [SDImageCachesManagerOperation new]; + [operation beginWithTotalCount:caches.count]; + [self serialContainsImageForKey:key cacheType:cacheType completion:completionBlock enumerator:caches.reverseObjectEnumerator operation:operation]; + } + break; + default: + break; + } +} + +- (void)clearWithCacheType:(SDImageCacheType)cacheType completion:(SDWebImageNoParamsBlock)completionBlock { + NSArray> *caches = self.caches; + NSUInteger count = caches.count; + if (count == 0) { + return; + } else if (count == 1) { + [caches.firstObject clearWithCacheType:cacheType completion:completionBlock]; + return; + } + switch (self.clearOperationPolicy) { + case SDImageCachesManagerOperationPolicyHighestOnly: { + id cache = caches.lastObject; + [cache clearWithCacheType:cacheType completion:completionBlock]; + } + break; + case SDImageCachesManagerOperationPolicyLowestOnly: { + id cache = caches.firstObject; + [cache clearWithCacheType:cacheType completion:completionBlock]; + } + break; + case SDImageCachesManagerOperationPolicyConcurrent: { + SDImageCachesManagerOperation *operation = [SDImageCachesManagerOperation new]; + [operation beginWithTotalCount:caches.count]; + [self concurrentClearWithCacheType:cacheType completion:completionBlock enumerator:caches.reverseObjectEnumerator operation:operation]; + } + break; + case SDImageCachesManagerOperationPolicySerial: { + [self serialClearWithCacheType:cacheType completion:completionBlock enumerator:caches.reverseObjectEnumerator]; + } + break; + default: + break; + } +} + +#pragma mark - Concurrent Operation + +- (void)concurrentQueryImageForKey:(NSString *)key options:(SDWebImageOptions)options context:(SDWebImageContext *)context cacheType:(SDImageCacheType)queryCacheType completion:(SDImageCacheQueryCompletionBlock)completionBlock enumerator:(NSEnumerator> *)enumerator operation:(SDImageCachesManagerOperation *)operation { + NSParameterAssert(enumerator); + NSParameterAssert(operation); + for (id cache in enumerator) { + [cache queryImageForKey:key options:options context:context cacheType:queryCacheType completion:^(UIImage * _Nullable image, NSData * _Nullable data, SDImageCacheType cacheType) { + if (operation.isCancelled) { + // Cancelled + return; + } + if (operation.isFinished) { + // Finished + return; + } + [operation completeOne]; + if (image) { + // Success + [operation done]; + if (completionBlock) { + completionBlock(image, data, cacheType); + } + return; + } + if (operation.pendingCount == 0) { + // Complete + [operation done]; + if (completionBlock) { + completionBlock(nil, nil, SDImageCacheTypeNone); + } + } + }]; + } +} + +- (void)concurrentStoreImage:(UIImage *)image imageData:(NSData *)imageData forKey:(NSString *)key cacheType:(SDImageCacheType)cacheType completion:(SDWebImageNoParamsBlock)completionBlock enumerator:(NSEnumerator> *)enumerator operation:(SDImageCachesManagerOperation *)operation { + NSParameterAssert(enumerator); + NSParameterAssert(operation); + for (id cache in enumerator) { + [cache storeImage:image imageData:imageData forKey:key cacheType:cacheType completion:^{ + if (operation.isCancelled) { + // Cancelled + return; + } + if (operation.isFinished) { + // Finished + return; + } + [operation completeOne]; + if (operation.pendingCount == 0) { + // Complete + [operation done]; + if (completionBlock) { + completionBlock(); + } + } + }]; + } +} + +- (void)concurrentRemoveImageForKey:(NSString *)key cacheType:(SDImageCacheType)cacheType completion:(SDWebImageNoParamsBlock)completionBlock enumerator:(NSEnumerator> *)enumerator operation:(SDImageCachesManagerOperation *)operation { + NSParameterAssert(enumerator); + NSParameterAssert(operation); + for (id cache in enumerator) { + [cache removeImageForKey:key cacheType:cacheType completion:^{ + if (operation.isCancelled) { + // Cancelled + return; + } + if (operation.isFinished) { + // Finished + return; + } + [operation completeOne]; + if (operation.pendingCount == 0) { + // Complete + [operation done]; + if (completionBlock) { + completionBlock(); + } + } + }]; + } +} + +- (void)concurrentContainsImageForKey:(NSString *)key cacheType:(SDImageCacheType)cacheType completion:(SDImageCacheContainsCompletionBlock)completionBlock enumerator:(NSEnumerator> *)enumerator operation:(SDImageCachesManagerOperation *)operation { + NSParameterAssert(enumerator); + NSParameterAssert(operation); + for (id cache in enumerator) { + [cache containsImageForKey:key cacheType:cacheType completion:^(SDImageCacheType containsCacheType) { + if (operation.isCancelled) { + // Cancelled + return; + } + if (operation.isFinished) { + // Finished + return; + } + [operation completeOne]; + if (containsCacheType != SDImageCacheTypeNone) { + // Success + [operation done]; + if (completionBlock) { + completionBlock(containsCacheType); + } + return; + } + if (operation.pendingCount == 0) { + // Complete + [operation done]; + if (completionBlock) { + completionBlock(SDImageCacheTypeNone); + } + } + }]; + } +} + +- (void)concurrentClearWithCacheType:(SDImageCacheType)cacheType completion:(SDWebImageNoParamsBlock)completionBlock enumerator:(NSEnumerator> *)enumerator operation:(SDImageCachesManagerOperation *)operation { + NSParameterAssert(enumerator); + NSParameterAssert(operation); + for (id cache in enumerator) { + [cache clearWithCacheType:cacheType completion:^{ + if (operation.isCancelled) { + // Cancelled + return; + } + if (operation.isFinished) { + // Finished + return; + } + [operation completeOne]; + if (operation.pendingCount == 0) { + // Complete + [operation done]; + if (completionBlock) { + completionBlock(); + } + } + }]; + } +} + +#pragma mark - Serial Operation + +- (void)serialQueryImageForKey:(NSString *)key options:(SDWebImageOptions)options context:(SDWebImageContext *)context cacheType:(SDImageCacheType)queryCacheType completion:(SDImageCacheQueryCompletionBlock)completionBlock enumerator:(NSEnumerator> *)enumerator operation:(SDImageCachesManagerOperation *)operation { + NSParameterAssert(enumerator); + NSParameterAssert(operation); + id cache = enumerator.nextObject; + if (!cache) { + // Complete + [operation done]; + if (completionBlock) { + completionBlock(nil, nil, SDImageCacheTypeNone); + } + return; + } + @weakify(self); + [cache queryImageForKey:key options:options context:context cacheType:queryCacheType completion:^(UIImage * _Nullable image, NSData * _Nullable data, SDImageCacheType cacheType) { + @strongify(self); + if (operation.isCancelled) { + // Cancelled + return; + } + if (operation.isFinished) { + // Finished + return; + } + [operation completeOne]; + if (image) { + // Success + [operation done]; + if (completionBlock) { + completionBlock(image, data, cacheType); + } + return; + } + // Next + [self serialQueryImageForKey:key options:options context:context cacheType:queryCacheType completion:completionBlock enumerator:enumerator operation:operation]; + }]; +} + +- (void)serialStoreImage:(UIImage *)image imageData:(NSData *)imageData forKey:(NSString *)key cacheType:(SDImageCacheType)cacheType completion:(SDWebImageNoParamsBlock)completionBlock enumerator:(NSEnumerator> *)enumerator { + NSParameterAssert(enumerator); + id cache = enumerator.nextObject; + if (!cache) { + // Complete + if (completionBlock) { + completionBlock(); + } + return; + } + @weakify(self); + [cache storeImage:image imageData:imageData forKey:key cacheType:cacheType completion:^{ + @strongify(self); + // Next + [self serialStoreImage:image imageData:imageData forKey:key cacheType:cacheType completion:completionBlock enumerator:enumerator]; + }]; +} + +- (void)serialRemoveImageForKey:(NSString *)key cacheType:(SDImageCacheType)cacheType completion:(SDWebImageNoParamsBlock)completionBlock enumerator:(NSEnumerator> *)enumerator { + NSParameterAssert(enumerator); + id cache = enumerator.nextObject; + if (!cache) { + // Complete + if (completionBlock) { + completionBlock(); + } + return; + } + @weakify(self); + [cache removeImageForKey:key cacheType:cacheType completion:^{ + @strongify(self); + // Next + [self serialRemoveImageForKey:key cacheType:cacheType completion:completionBlock enumerator:enumerator]; + }]; +} + +- (void)serialContainsImageForKey:(NSString *)key cacheType:(SDImageCacheType)cacheType completion:(SDImageCacheContainsCompletionBlock)completionBlock enumerator:(NSEnumerator> *)enumerator operation:(SDImageCachesManagerOperation *)operation { + NSParameterAssert(enumerator); + NSParameterAssert(operation); + id cache = enumerator.nextObject; + if (!cache) { + // Complete + [operation done]; + if (completionBlock) { + completionBlock(SDImageCacheTypeNone); + } + return; + } + @weakify(self); + [cache containsImageForKey:key cacheType:cacheType completion:^(SDImageCacheType containsCacheType) { + @strongify(self); + if (operation.isCancelled) { + // Cancelled + return; + } + if (operation.isFinished) { + // Finished + return; + } + [operation completeOne]; + if (containsCacheType != SDImageCacheTypeNone) { + // Success + [operation done]; + if (completionBlock) { + completionBlock(containsCacheType); + } + return; + } + // Next + [self serialContainsImageForKey:key cacheType:cacheType completion:completionBlock enumerator:enumerator operation:operation]; + }]; +} + +- (void)serialClearWithCacheType:(SDImageCacheType)cacheType completion:(SDWebImageNoParamsBlock)completionBlock enumerator:(NSEnumerator> *)enumerator { + NSParameterAssert(enumerator); + id cache = enumerator.nextObject; + if (!cache) { + // Complete + if (completionBlock) { + completionBlock(); + } + return; + } + @weakify(self); + [cache clearWithCacheType:cacheType completion:^{ + @strongify(self); + // Next + [self serialClearWithCacheType:cacheType completion:completionBlock enumerator:enumerator]; + }]; +} + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageCoder.h b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageCoder.h new file mode 100644 index 0000000..53b52e5 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageCoder.h @@ -0,0 +1,266 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import +#import "SDWebImageCompat.h" +#import "NSData+ImageContentType.h" + +typedef NSString * SDImageCoderOption NS_STRING_ENUM; +typedef NSDictionary SDImageCoderOptions; +typedef NSMutableDictionary SDImageCoderMutableOptions; + +#pragma mark - Coder Options +// These options are for image decoding +/** + A Boolean value indicating whether to decode the first frame only for animated image during decoding. (NSNumber). If not provide, decode animated image if need. + @note works for `SDImageCoder`. + */ +FOUNDATION_EXPORT SDImageCoderOption _Nonnull const SDImageCoderDecodeFirstFrameOnly; + +/** + A CGFloat value which is greater than or equal to 1.0. This value specify the image scale factor for decoding. If not provide, use 1.0. (NSNumber) + @note works for `SDImageCoder`, `SDProgressiveImageCoder`, `SDAnimatedImageCoder`. + */ +FOUNDATION_EXPORT SDImageCoderOption _Nonnull const SDImageCoderDecodeScaleFactor; + +/** + A Boolean value indicating whether to keep the original aspect ratio when generating thumbnail images (or bitmap images from vector format). + Defaults to YES. + @note works for `SDImageCoder`, `SDProgressiveImageCoder`, `SDAnimatedImageCoder`. + */ +FOUNDATION_EXPORT SDImageCoderOption _Nonnull const SDImageCoderDecodePreserveAspectRatio; + +/** + A CGSize value indicating whether or not to generate the thumbnail images (or bitmap images from vector format). When this value is provided, the decoder will generate a thumbnail image which pixel size is smaller than or equal to (depends the `.preserveAspectRatio`) the value size. + Defaults to CGSizeZero, which means no thumbnail generation at all. + @note Supports for animated image as well. + @note When you pass `.preserveAspectRatio == NO`, the thumbnail image is stretched to match each dimension. When `.preserveAspectRatio == YES`, the thumbnail image's width is limited to pixel size's width, the thumbnail image's height is limited to pixel size's height. For common cases, you can just pass a square size to limit both. + @note works for `SDImageCoder`, `SDProgressiveImageCoder`, `SDAnimatedImageCoder`. + */ +FOUNDATION_EXPORT SDImageCoderOption _Nonnull const SDImageCoderDecodeThumbnailPixelSize; + + +// These options are for image encoding +/** + A Boolean value indicating whether to encode the first frame only for animated image during encoding. (NSNumber). If not provide, encode animated image if need. + @note works for `SDImageCoder`. + */ +FOUNDATION_EXPORT SDImageCoderOption _Nonnull const SDImageCoderEncodeFirstFrameOnly; +/** + A double value between 0.0-1.0 indicating the encode compression quality to produce the image data. 1.0 resulting in no compression and 0.0 resulting in the maximum compression possible. If not provide, use 1.0. (NSNumber) + @note works for `SDImageCoder` + */ +FOUNDATION_EXPORT SDImageCoderOption _Nonnull const SDImageCoderEncodeCompressionQuality; + +/** + A UIColor(NSColor) value to used for non-alpha image encoding when the input image has alpha channel, the background color will be used to compose the alpha one. If not provide, use white color. + @note works for `SDImageCoder` + */ +FOUNDATION_EXPORT SDImageCoderOption _Nonnull const SDImageCoderEncodeBackgroundColor; + +/** + A CGSize value indicating the max image resolution in pixels during encoding. For vector image, this also effect the output vector data information about width and height. The encoder will not generate the encoded image larger than this limit. Note it always use the aspect ratio of input image.. + Defaults to CGSizeZero, which means no max size limit at all. + @note Supports for animated image as well. + @note The output image's width is limited to pixel size's width, the output image's height is limited to pixel size's height. For common cases, you can just pass a square size to limit both. + @note works for `SDImageCoder` + */ +FOUNDATION_EXPORT SDImageCoderOption _Nonnull const SDImageCoderEncodeMaxPixelSize; + +/** + A NSUInteger value specify the max output data bytes size after encoding. Some lossy format like JPEG/HEIF supports the hint for codec to automatically reduce the quality and match the file size you want. Note this option will override the `SDImageCoderEncodeCompressionQuality`, because now the quality is decided by the encoder. (NSNumber) + @note This is a hint, no guarantee for output size because of compression algorithm limit. And this options does not works for vector images. + @note works for `SDImageCoder` + */ +FOUNDATION_EXPORT SDImageCoderOption _Nonnull const SDImageCoderEncodeMaxFileSize; + +/** + A Boolean value indicating the encoding format should contains a thumbnail image into the output data. Only some of image format (like JPEG/HEIF/AVIF) support this behavior. The embed thumbnail will be used during next time thumbnail decoding (provided `.thumbnailPixelSize`), which is faster than full image thumbnail decoding. (NSNumber) + Defaults to NO, which does not embed any thumbnail. + @note The thumbnail image's pixel size is not defined, the encoder can choose the proper pixel size which is suitable for encoding quality. + @note works for `SDImageCoder` + */ +FOUNDATION_EXPORT SDImageCoderOption _Nonnull const SDImageCoderEncodeEmbedThumbnail; + +/** + A SDWebImageContext object which hold the original context options from top-level API. (SDWebImageContext) + This option is ignored for all built-in coders and take no effect. + But this may be useful for some custom coders, because some business logic may dependent on things other than image or image data information only. + See `SDWebImageContext` for more detailed information. + */ +FOUNDATION_EXPORT SDImageCoderOption _Nonnull const SDImageCoderWebImageContext API_DEPRECATED("The coder component will be seperated from Core subspec in the future. Update your code to not rely on this context option.", macos(10.10, API_TO_BE_DEPRECATED), ios(8.0, API_TO_BE_DEPRECATED), tvos(9.0, API_TO_BE_DEPRECATED), watchos(2.0, API_TO_BE_DEPRECATED)); + +#pragma mark - Coder +/** + This is the image coder protocol to provide custom image decoding/encoding. + These methods are all required to implement. + @note Pay attention that these methods are not called from main queue. + */ +@protocol SDImageCoder + +@required +#pragma mark - Decoding +/** + Returns YES if this coder can decode some data. Otherwise, the data should be passed to another coder. + + @param data The image data so we can look at it + @return YES if this coder can decode the data, NO otherwise + */ +- (BOOL)canDecodeFromData:(nullable NSData *)data; + +/** + Decode the image data to image. + @note This protocol may supports decode animated image frames. You can use `+[SDImageCoderHelper animatedImageWithFrames:]` to produce an animated image with frames. + + @param data The image data to be decoded + @param options A dictionary containing any decoding options. Pass @{SDImageCoderDecodeScaleFactor: @(1.0)} to specify scale factor for image. Pass @{SDImageCoderDecodeFirstFrameOnly: @(YES)} to decode the first frame only. + @return The decoded image from data + */ +- (nullable UIImage *)decodedImageWithData:(nullable NSData *)data + options:(nullable SDImageCoderOptions *)options; + +#pragma mark - Encoding + +/** + Returns YES if this coder can encode some image. Otherwise, it should be passed to another coder. + For custom coder which introduce new image format, you'd better define a new `SDImageFormat` using like this. If you're creating public coder plugin for new image format, also update `https://github.com/rs/SDWebImage/wiki/Coder-Plugin-List` to avoid same value been defined twice. + * @code + static const SDImageFormat SDImageFormatHEIF = 10; + * @endcode + + @param format The image format + @return YES if this coder can encode the image, NO otherwise + */ +- (BOOL)canEncodeToFormat:(SDImageFormat)format NS_SWIFT_NAME(canEncode(to:)); + +/** + Encode the image to image data. + @note This protocol may supports encode animated image frames. You can use `+[SDImageCoderHelper framesFromAnimatedImage:]` to assemble an animated image with frames. + + @param image The image to be encoded + @param format The image format to encode, you should note `SDImageFormatUndefined` format is also possible + @param options A dictionary containing any encoding options. Pass @{SDImageCoderEncodeCompressionQuality: @(1)} to specify compression quality. + @return The encoded image data + */ +- (nullable NSData *)encodedDataWithImage:(nullable UIImage *)image + format:(SDImageFormat)format + options:(nullable SDImageCoderOptions *)options; + +@end + +#pragma mark - Progressive Coder +/** + This is the image coder protocol to provide custom progressive image decoding. + These methods are all required to implement. + @note Pay attention that these methods are not called from main queue. + */ +@protocol SDProgressiveImageCoder + +@required +/** + Returns YES if this coder can incremental decode some data. Otherwise, it should be passed to another coder. + + @param data The image data so we can look at it + @return YES if this coder can decode the data, NO otherwise + */ +- (BOOL)canIncrementalDecodeFromData:(nullable NSData *)data; + +/** + Because incremental decoding need to keep the decoded context, we will alloc a new instance with the same class for each download operation to avoid conflicts + This init method should not return nil + + @param options A dictionary containing any progressive decoding options (instance-level). Pass @{SDImageCoderDecodeScaleFactor: @(1.0)} to specify scale factor for progressive animated image (each frames should use the same scale). + @return A new instance to do incremental decoding for the specify image format + */ +- (nonnull instancetype)initIncrementalWithOptions:(nullable SDImageCoderOptions *)options; + +/** + Update the incremental decoding when new image data available + + @param data The image data has been downloaded so far + @param finished Whether the download has finished + */ +- (void)updateIncrementalData:(nullable NSData *)data finished:(BOOL)finished; + +/** + Incremental decode the current image data to image. + @note Due to the performance issue for progressive decoding and the integration for image view. This method may only return the first frame image even if the image data is animated image. If you want progressive animated image decoding, conform to `SDAnimatedImageCoder` protocol as well and use `animatedImageFrameAtIndex:` instead. + + @param options A dictionary containing any progressive decoding options. Pass @{SDImageCoderDecodeScaleFactor: @(1.0)} to specify scale factor for progressive image + @return The decoded image from current data + */ +- (nullable UIImage *)incrementalDecodedImageWithOptions:(nullable SDImageCoderOptions *)options; + +@end + +#pragma mark - Animated Image Provider +/** + This is the animated image protocol to provide the basic function for animated image rendering. It's adopted by `SDAnimatedImage` and `SDAnimatedImageCoder` + */ +@protocol SDAnimatedImageProvider + +@required +/** + The original animated image data for current image. If current image is not an animated format, return nil. + We may use this method to grab back the original image data if need, such as NSCoding or compare. + + @return The animated image data + */ +@property (nonatomic, copy, readonly, nullable) NSData *animatedImageData; + +/** + Total animated frame count. + If the frame count is less than 1, then the methods below will be ignored. + + @return Total animated frame count. + */ +@property (nonatomic, assign, readonly) NSUInteger animatedImageFrameCount; +/** + Animation loop count, 0 means infinite looping. + + @return Animation loop count + */ +@property (nonatomic, assign, readonly) NSUInteger animatedImageLoopCount; +/** + Returns the frame image from a specified index. + @note The index maybe randomly if one image was set to different imageViews, keep it re-entrant. (It's not recommend to store the images into array because it's memory consuming) + + @param index Frame index (zero based). + @return Frame's image + */ +- (nullable UIImage *)animatedImageFrameAtIndex:(NSUInteger)index; +/** + Returns the frames's duration from a specified index. + @note The index maybe randomly if one image was set to different imageViews, keep it re-entrant. (It's recommend to store the durations into array because it's not memory-consuming) + + @param index Frame index (zero based). + @return Frame's duration + */ +- (NSTimeInterval)animatedImageDurationAtIndex:(NSUInteger)index; + +@end + +#pragma mark - Animated Coder +/** + This is the animated image coder protocol for custom animated image class like `SDAnimatedImage`. Through it inherit from `SDImageCoder`. We currentlly only use the method `canDecodeFromData:` to detect the proper coder for specify animated image format. + */ +@protocol SDAnimatedImageCoder + +@required +/** + Because animated image coder should keep the original data, we will alloc a new instance with the same class for the specify animated image data + The init method should return nil if it can't decode the specify animated image data to produce any frame. + After the instance created, we may call methods in `SDAnimatedImageProvider` to produce animated image frame. + + @param data The animated image data to be decode + @param options A dictionary containing any animated decoding options (instance-level). Pass @{SDImageCoderDecodeScaleFactor: @(1.0)} to specify scale factor for animated image (each frames should use the same scale). + @return A new instance to do animated decoding for specify image data + */ +- (nullable instancetype)initWithAnimatedImageData:(nullable NSData *)data options:(nullable SDImageCoderOptions *)options; + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageCoder.m b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageCoder.m new file mode 100644 index 0000000..0fda198 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageCoder.m @@ -0,0 +1,23 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDImageCoder.h" + +SDImageCoderOption const SDImageCoderDecodeFirstFrameOnly = @"decodeFirstFrameOnly"; +SDImageCoderOption const SDImageCoderDecodeScaleFactor = @"decodeScaleFactor"; +SDImageCoderOption const SDImageCoderDecodePreserveAspectRatio = @"decodePreserveAspectRatio"; +SDImageCoderOption const SDImageCoderDecodeThumbnailPixelSize = @"decodeThumbnailPixelSize"; + +SDImageCoderOption const SDImageCoderEncodeFirstFrameOnly = @"encodeFirstFrameOnly"; +SDImageCoderOption const SDImageCoderEncodeCompressionQuality = @"encodeCompressionQuality"; +SDImageCoderOption const SDImageCoderEncodeBackgroundColor = @"encodeBackgroundColor"; +SDImageCoderOption const SDImageCoderEncodeMaxPixelSize = @"encodeMaxPixelSize"; +SDImageCoderOption const SDImageCoderEncodeMaxFileSize = @"encodeMaxFileSize"; +SDImageCoderOption const SDImageCoderEncodeEmbedThumbnail = @"encodeEmbedThumbnail"; + +SDImageCoderOption const SDImageCoderWebImageContext = @"webImageContext"; diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageCoderHelper.h b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageCoderHelper.h new file mode 100644 index 0000000..28e1240 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageCoderHelper.h @@ -0,0 +1,153 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import +#import "SDWebImageCompat.h" +#import "SDImageFrame.h" + +typedef NS_ENUM(NSUInteger, SDImageCoderDecodeSolution) { + /// automatically choose the solution based on image format, hardware, OS version. This keep balance for compatibility and performance. Default after SDWebImage 5.13.0 + SDImageCoderDecodeSolutionAutomatic, + /// always use CoreGraphics to draw on bitmap context and trigger decode. Best compatibility. Default before SDWebImage 5.13.0 + SDImageCoderDecodeSolutionCoreGraphics, + /// available on iOS/tvOS 15+, use UIKit's new CGImageDecompressor/CMPhoto to decode. Best performance. If failed, will fallback to CoreGraphics as well + SDImageCoderDecodeSolutionUIKit +}; + +/** + Provide some common helper methods for building the image decoder/encoder. + */ +@interface SDImageCoderHelper : NSObject + +/** + Return an animated image with frames array. + For UIKit, this will apply the patch and then create animated UIImage. The patch is because that `+[UIImage animatedImageWithImages:duration:]` just use the average of duration for each image. So it will not work if different frame has different duration. Therefore we repeat the specify frame for specify times to let it work. + For AppKit, NSImage does not support animates other than GIF. This will try to encode the frames to GIF format and then create an animated NSImage for rendering. Attention the animated image may loss some detail if the input frames contain full alpha channel because GIF only supports 1 bit alpha channel. (For 1 pixel, either transparent or not) + + @param frames The frames array. If no frames or frames is empty, return nil + @return A animated image for rendering on UIImageView(UIKit) or NSImageView(AppKit) + */ ++ (UIImage * _Nullable)animatedImageWithFrames:(NSArray * _Nullable)frames; + +/** + Return frames array from an animated image. + For UIKit, this will unapply the patch for the description above and then create frames array. This will also work for normal animated UIImage. + For AppKit, NSImage does not support animates other than GIF. This will try to decode the GIF imageRep and then create frames array. + + @param animatedImage A animated image. If it's not animated, return nil + @return The frames array + */ ++ (NSArray * _Nullable)framesFromAnimatedImage:(UIImage * _Nullable)animatedImage NS_SWIFT_NAME(frames(from:)); + +/** + Return the shared device-dependent RGB color space. This follows The Get Rule. + On iOS, it's created with deviceRGB (if available, use sRGB). + On macOS, it's from the screen colorspace (if failed, use deviceRGB) + Because it's shared, you should not retain or release this object. + + @return The device-dependent RGB color space + */ ++ (CGColorSpaceRef _Nonnull)colorSpaceGetDeviceRGB CF_RETURNS_NOT_RETAINED; + +/** + Check whether CGImage contains alpha channel. + + @param cgImage The CGImage + @return Return YES if CGImage contains alpha channel, otherwise return NO + */ ++ (BOOL)CGImageContainsAlpha:(_Nonnull CGImageRef)cgImage; + +/** + Create a decoded CGImage by the provided CGImage. This follows The Create Rule and you are response to call release after usage. + It will detect whether image contains alpha channel, then create a new bitmap context with the same size of image, and draw it. This can ensure that the image do not need extra decoding after been set to the imageView. + @note This actually call `CGImageCreateDecoded:orientation:` with the Up orientation. + + @param cgImage The CGImage + @return A new created decoded image + */ ++ (CGImageRef _Nullable)CGImageCreateDecoded:(_Nonnull CGImageRef)cgImage CF_RETURNS_RETAINED; + +/** + Create a decoded CGImage by the provided CGImage and orientation. This follows The Create Rule and you are response to call release after usage. + It will detect whether image contains alpha channel, then create a new bitmap context with the same size of image, and draw it. This can ensure that the image do not need extra decoding after been set to the imageView. + + @param cgImage The CGImage + @param orientation The EXIF image orientation. + @return A new created decoded image + */ ++ (CGImageRef _Nullable)CGImageCreateDecoded:(_Nonnull CGImageRef)cgImage orientation:(CGImagePropertyOrientation)orientation CF_RETURNS_RETAINED; + +/** + Create a scaled CGImage by the provided CGImage and size. This follows The Create Rule and you are response to call release after usage. + It will detect whether the image size matching the scale size, if not, stretch the image to the target size. + @note If you need to keep aspect ratio, you can calculate the scale size by using `scaledSizeWithImageSize` first. + + @param cgImage The CGImage + @param size The scale size in pixel. + @return A new created scaled image + */ ++ (CGImageRef _Nullable)CGImageCreateScaled:(_Nonnull CGImageRef)cgImage size:(CGSize)size CF_RETURNS_RETAINED; + +/** Scale the image size based on provided scale size, whether or not to preserve aspect ratio, whether or not to scale up. + @note For example, if you implements thumnail decoding, pass `shouldScaleUp` to NO to avoid the calculated size larger than image size. + + @param imageSize The image size (in pixel or point defined by caller) + @param scaleSize The scale size (in pixel or point defined by caller) + @param preserveAspectRatio Whether or not to preserve aspect ratio + @param shouldScaleUp Whether or not to scale up (or scale down only) + */ ++ (CGSize)scaledSizeWithImageSize:(CGSize)imageSize scaleSize:(CGSize)scaleSize preserveAspectRatio:(BOOL)preserveAspectRatio shouldScaleUp:(BOOL)shouldScaleUp; + +/** + Return the decoded image by the provided image. This one unlike `CGImageCreateDecoded:`, will not decode the image which contains alpha channel or animated image + @param image The image to be decoded + @return The decoded image + */ ++ (UIImage * _Nullable)decodedImageWithImage:(UIImage * _Nullable)image; + +/** + Return the decoded and probably scaled down image by the provided image. If the image pixels bytes size large than the limit bytes, will try to scale down. Or just works as `decodedImageWithImage:`, never scale up. + @warning You should not pass too small bytes, the suggestion value should be larger than 1MB. Even we use Tile Decoding to avoid OOM, however, small bytes will consume much more CPU time because we need to iterate more times to draw each tile. + + @param image The image to be decoded and scaled down + @param bytes The limit bytes size. Provide 0 to use the build-in limit. + @return The decoded and probably scaled down image + */ ++ (UIImage * _Nullable)decodedAndScaledDownImageWithImage:(UIImage * _Nullable)image limitBytes:(NSUInteger)bytes; + +/** + Control the default force decode solution. Available solutions in `SDImageCoderDecodeSolution`. + @note Defaults to `SDImageCoderDecodeSolutionAutomatic`, which prefers to use UIKit for JPEG/HEIF, and fallback on CoreGraphics. If you want control on your hand, set the other solution. + */ +@property (class, readwrite) SDImageCoderDecodeSolution defaultDecodeSolution; + +/** + Control the default limit bytes to scale down largest images. + This value must be larger than 4 Bytes (at least 1x1 pixel). Defaults to 60MB on iOS/tvOS, 90MB on macOS, 30MB on watchOS. + */ +@property (class, readwrite) NSUInteger defaultScaleDownLimitBytes; + +#if SD_UIKIT || SD_WATCH +/** + Convert an EXIF image orientation to an iOS one. + + @param exifOrientation EXIF orientation + @return iOS orientation + */ ++ (UIImageOrientation)imageOrientationFromEXIFOrientation:(CGImagePropertyOrientation)exifOrientation NS_SWIFT_NAME(imageOrientation(from:)); + +/** + Convert an iOS orientation to an EXIF image orientation. + + @param imageOrientation iOS orientation + @return EXIF orientation + */ ++ (CGImagePropertyOrientation)exifOrientationFromImageOrientation:(UIImageOrientation)imageOrientation; +#endif + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageCoderHelper.m b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageCoderHelper.m new file mode 100644 index 0000000..da30b65 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageCoderHelper.m @@ -0,0 +1,826 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDImageCoderHelper.h" +#import "SDImageFrame.h" +#import "NSImage+Compatibility.h" +#import "NSData+ImageContentType.h" +#import "SDAnimatedImageRep.h" +#import "UIImage+ForceDecode.h" +#import "SDAssociatedObject.h" +#import "UIImage+Metadata.h" +#import "SDInternalMacros.h" +#import "SDGraphicsImageRenderer.h" +#import "SDInternalMacros.h" +#import + +static inline size_t SDByteAlign(size_t size, size_t alignment) { + return ((size + (alignment - 1)) / alignment) * alignment; +} + +#if SD_UIKIT +static inline UIImage *SDImageDecodeUIKit(UIImage *image) { + // See: https://developer.apple.com/documentation/uikit/uiimage/3750834-imagebypreparingfordisplay + // Need CGImage-based + if (@available(iOS 15, tvOS 15, *)) { + UIImage *decodedImage = [image imageByPreparingForDisplay]; + if (decodedImage) { + SDImageCopyAssociatedObject(image, decodedImage); + decodedImage.sd_isDecoded = YES; + return decodedImage; + } + } + return nil; +} + +static inline UIImage *SDImageDecodeAndScaleDownUIKit(UIImage *image, CGSize destResolution) { + // See: https://developer.apple.com/documentation/uikit/uiimage/3750835-imagebypreparingthumbnailofsize + // Need CGImage-based + if (@available(iOS 15, tvOS 15, *)) { + // Calculate thumbnail point size + CGFloat scale = image.scale ?: 1; + CGSize thumbnailSize = CGSizeMake(destResolution.width / scale, destResolution.height / scale); + UIImage *decodedImage = [image imageByPreparingThumbnailOfSize:thumbnailSize]; + if (decodedImage) { + SDImageCopyAssociatedObject(image, decodedImage); + decodedImage.sd_isDecoded = YES; + return decodedImage; + } + } + return nil; +} + +static inline BOOL SDImageSupportsHardwareHEVCDecoder(void) { + static dispatch_once_t onceToken; + static BOOL supportsHardware = NO; + dispatch_once(&onceToken, ^{ + SEL DeviceInfoSelector = SD_SEL_SPI(deviceInfoForKey:); + NSString *HEVCDecoder8bitSupported = @"N8lZxRgC7lfdRS3dRLn+Ag"; +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Warc-performSelector-leaks" + if ([UIDevice.currentDevice respondsToSelector:DeviceInfoSelector] && [UIDevice.currentDevice performSelector:DeviceInfoSelector withObject:HEVCDecoder8bitSupported]) { + supportsHardware = YES; + } +#pragma clang diagnostic pop + }); + return supportsHardware; +} +#endif + +static SDImageCoderDecodeSolution kDefaultDecodeSolution = SDImageCoderDecodeSolutionAutomatic; + +static const size_t kBytesPerPixel = 4; +static const size_t kBitsPerComponent = 8; + +static const CGFloat kBytesPerMB = 1024.0f * 1024.0f; +/* + * Defines the maximum size in MB of the decoded image when the flag `SDWebImageScaleDownLargeImages` is set + * Suggested value for iPad1 and iPhone 3GS: 60. + * Suggested value for iPad2 and iPhone 4: 120. + * Suggested value for iPhone 3G and iPod 2 and earlier devices: 30. + */ +#if SD_MAC +static CGFloat kDestImageLimitBytes = 90.f * kBytesPerMB; +#elif SD_UIKIT +static CGFloat kDestImageLimitBytes = 60.f * kBytesPerMB; +#elif SD_WATCH +static CGFloat kDestImageLimitBytes = 30.f * kBytesPerMB; +#endif + +static const CGFloat kDestSeemOverlap = 2.0f; // the numbers of pixels to overlap the seems where tiles meet. + +@implementation SDImageCoderHelper + ++ (UIImage *)animatedImageWithFrames:(NSArray *)frames { + NSUInteger frameCount = frames.count; + if (frameCount == 0) { + return nil; + } + + UIImage *animatedImage; + +#if SD_UIKIT || SD_WATCH + NSUInteger durations[frameCount]; + for (size_t i = 0; i < frameCount; i++) { + durations[i] = frames[i].duration * 1000; + } + NSUInteger const gcd = gcdArray(frameCount, durations); + __block NSTimeInterval totalDuration = 0; + NSMutableArray *animatedImages = [NSMutableArray arrayWithCapacity:frameCount]; + [frames enumerateObjectsUsingBlock:^(SDImageFrame * _Nonnull frame, NSUInteger idx, BOOL * _Nonnull stop) { + UIImage *image = frame.image; + NSUInteger duration = frame.duration * 1000; + totalDuration += frame.duration; + NSUInteger repeatCount; + if (gcd) { + repeatCount = duration / gcd; + } else { + repeatCount = 1; + } + for (size_t i = 0; i < repeatCount; ++i) { + [animatedImages addObject:image]; + } + }]; + + animatedImage = [UIImage animatedImageWithImages:animatedImages duration:totalDuration]; + +#else + + NSMutableData *imageData = [NSMutableData data]; + CFStringRef imageUTType = [NSData sd_UTTypeFromImageFormat:SDImageFormatGIF]; + // Create an image destination. GIF does not support EXIF image orientation + CGImageDestinationRef imageDestination = CGImageDestinationCreateWithData((__bridge CFMutableDataRef)imageData, imageUTType, frameCount, NULL); + if (!imageDestination) { + // Handle failure. + return nil; + } + + for (size_t i = 0; i < frameCount; i++) { + @autoreleasepool { + SDImageFrame *frame = frames[i]; + NSTimeInterval frameDuration = frame.duration; + CGImageRef frameImageRef = frame.image.CGImage; + NSDictionary *frameProperties = @{(__bridge NSString *)kCGImagePropertyGIFDictionary : @{(__bridge NSString *)kCGImagePropertyGIFDelayTime : @(frameDuration)}}; + CGImageDestinationAddImage(imageDestination, frameImageRef, (__bridge CFDictionaryRef)frameProperties); + } + } + // Finalize the destination. + if (CGImageDestinationFinalize(imageDestination) == NO) { + // Handle failure. + CFRelease(imageDestination); + return nil; + } + CFRelease(imageDestination); + CGFloat scale = MAX(frames.firstObject.image.scale, 1); + + SDAnimatedImageRep *imageRep = [[SDAnimatedImageRep alloc] initWithData:imageData]; + NSSize size = NSMakeSize(imageRep.pixelsWide / scale, imageRep.pixelsHigh / scale); + imageRep.size = size; + animatedImage = [[NSImage alloc] initWithSize:size]; + [animatedImage addRepresentation:imageRep]; +#endif + + return animatedImage; +} + ++ (NSArray *)framesFromAnimatedImage:(UIImage *)animatedImage { + if (!animatedImage) { + return nil; + } + + NSMutableArray *frames = [NSMutableArray array]; + NSUInteger frameCount = 0; + +#if SD_UIKIT || SD_WATCH + NSArray *animatedImages = animatedImage.images; + frameCount = animatedImages.count; + if (frameCount == 0) { + return nil; + } + + NSTimeInterval avgDuration = animatedImage.duration / frameCount; + if (avgDuration == 0) { + avgDuration = 0.1; // if it's a animated image but no duration, set it to default 100ms (this do not have that 10ms limit like GIF or WebP to allow custom coder provide the limit) + } + + __block NSUInteger repeatCount = 1; + __block UIImage *previousImage = animatedImages.firstObject; + [animatedImages enumerateObjectsUsingBlock:^(UIImage * _Nonnull image, NSUInteger idx, BOOL * _Nonnull stop) { + // ignore first + if (idx == 0) { + return; + } + if ([image isEqual:previousImage]) { + repeatCount++; + } else { + SDImageFrame *frame = [SDImageFrame frameWithImage:previousImage duration:avgDuration * repeatCount]; + [frames addObject:frame]; + repeatCount = 1; + } + previousImage = image; + }]; + // last one + SDImageFrame *frame = [SDImageFrame frameWithImage:previousImage duration:avgDuration * repeatCount]; + [frames addObject:frame]; + +#else + + NSRect imageRect = NSMakeRect(0, 0, animatedImage.size.width, animatedImage.size.height); + NSImageRep *imageRep = [animatedImage bestRepresentationForRect:imageRect context:nil hints:nil]; + NSBitmapImageRep *bitmapImageRep; + if ([imageRep isKindOfClass:[NSBitmapImageRep class]]) { + bitmapImageRep = (NSBitmapImageRep *)imageRep; + } + if (!bitmapImageRep) { + return nil; + } + frameCount = [[bitmapImageRep valueForProperty:NSImageFrameCount] unsignedIntegerValue]; + if (frameCount == 0) { + return nil; + } + CGFloat scale = animatedImage.scale; + + for (size_t i = 0; i < frameCount; i++) { + @autoreleasepool { + // NSBitmapImageRep need to manually change frame. "Good taste" API + [bitmapImageRep setProperty:NSImageCurrentFrame withValue:@(i)]; + NSTimeInterval frameDuration = [[bitmapImageRep valueForProperty:NSImageCurrentFrameDuration] doubleValue]; + NSImage *frameImage = [[NSImage alloc] initWithCGImage:bitmapImageRep.CGImage scale:scale orientation:kCGImagePropertyOrientationUp]; + SDImageFrame *frame = [SDImageFrame frameWithImage:frameImage duration:frameDuration]; + [frames addObject:frame]; + } + } +#endif + + return frames; +} + ++ (CGColorSpaceRef)colorSpaceGetDeviceRGB { + static CGColorSpaceRef colorSpace; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + colorSpace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB); + }); + return colorSpace; +} + ++ (BOOL)CGImageContainsAlpha:(CGImageRef)cgImage { + if (!cgImage) { + return NO; + } + CGImageAlphaInfo alphaInfo = CGImageGetAlphaInfo(cgImage); + BOOL hasAlpha = !(alphaInfo == kCGImageAlphaNone || + alphaInfo == kCGImageAlphaNoneSkipFirst || + alphaInfo == kCGImageAlphaNoneSkipLast); + return hasAlpha; +} + ++ (CGImageRef)CGImageCreateDecoded:(CGImageRef)cgImage { + return [self CGImageCreateDecoded:cgImage orientation:kCGImagePropertyOrientationUp]; +} + ++ (CGImageRef)CGImageCreateDecoded:(CGImageRef)cgImage orientation:(CGImagePropertyOrientation)orientation { + if (!cgImage) { + return NULL; + } + size_t width = CGImageGetWidth(cgImage); + size_t height = CGImageGetHeight(cgImage); + if (width == 0 || height == 0) return NULL; + size_t newWidth; + size_t newHeight; + switch (orientation) { + case kCGImagePropertyOrientationLeft: + case kCGImagePropertyOrientationLeftMirrored: + case kCGImagePropertyOrientationRight: + case kCGImagePropertyOrientationRightMirrored: { + // These orientation should swap width & height + newWidth = height; + newHeight = width; + } + break; + default: { + newWidth = width; + newHeight = height; + } + break; + } + + BOOL hasAlpha = [self CGImageContainsAlpha:cgImage]; + // kCGImageAlphaNone is not supported in CGBitmapContextCreate. + // Check #3330 for more detail about why this bitmap is choosen. + CGBitmapInfo bitmapInfo; + if (hasAlpha) { + // iPhone GPU prefer to use BGRA8888, see: https://forums.raywenderlich.com/t/why-mtlpixelformat-bgra8unorm/53489 + // BGRA8888 + bitmapInfo = kCGBitmapByteOrder32Host | kCGImageAlphaPremultipliedFirst; + } else { + // BGR888 previously works on iOS 8~iOS 14, however, iOS 15+ will result a black image. FB9958017 + // RGB888 + bitmapInfo = kCGBitmapByteOrderDefault | kCGImageAlphaNoneSkipLast; + } + CGContextRef context = CGBitmapContextCreate(NULL, newWidth, newHeight, 8, 0, [self colorSpaceGetDeviceRGB], bitmapInfo); + if (!context) { + return NULL; + } + + // Apply transform + CGAffineTransform transform = SDCGContextTransformFromOrientation(orientation, CGSizeMake(newWidth, newHeight)); + CGContextConcatCTM(context, transform); + CGContextDrawImage(context, CGRectMake(0, 0, width, height), cgImage); // The rect is bounding box of CGImage, don't swap width & height + CGImageRef newImageRef = CGBitmapContextCreateImage(context); + CGContextRelease(context); + + return newImageRef; +} + ++ (CGImageRef)CGImageCreateScaled:(CGImageRef)cgImage size:(CGSize)size { + if (!cgImage) { + return NULL; + } + size_t width = CGImageGetWidth(cgImage); + size_t height = CGImageGetHeight(cgImage); + if (width == size.width && height == size.height) { + CGImageRetain(cgImage); + return cgImage; + } + + __block vImage_Buffer input_buffer = {}, output_buffer = {}; + @onExit { + if (input_buffer.data) free(input_buffer.data); + if (output_buffer.data) free(output_buffer.data); + }; + BOOL hasAlpha = [self CGImageContainsAlpha:cgImage]; + // kCGImageAlphaNone is not supported in CGBitmapContextCreate. + // Check #3330 for more detail about why this bitmap is choosen. + CGBitmapInfo bitmapInfo; + if (hasAlpha) { + // iPhone GPU prefer to use BGRA8888, see: https://forums.raywenderlich.com/t/why-mtlpixelformat-bgra8unorm/53489 + // BGRA8888 + bitmapInfo = kCGBitmapByteOrder32Host | kCGImageAlphaPremultipliedFirst; + } else { + // BGR888 previously works on iOS 8~iOS 14, however, iOS 15+ will result a black image. FB9958017 + // RGB888 + bitmapInfo = kCGBitmapByteOrderDefault | kCGImageAlphaNoneSkipLast; + } + vImage_CGImageFormat format = (vImage_CGImageFormat) { + .bitsPerComponent = 8, + .bitsPerPixel = 32, + .colorSpace = NULL, + .bitmapInfo = bitmapInfo, + .version = 0, + .decode = NULL, + .renderingIntent = CGImageGetRenderingIntent(cgImage) + }; + + vImage_Error a_ret = vImageBuffer_InitWithCGImage(&input_buffer, &format, NULL, cgImage, kvImageNoFlags); + if (a_ret != kvImageNoError) return NULL; + output_buffer.width = MAX(size.width, 0); + output_buffer.height = MAX(size.height, 0); + output_buffer.rowBytes = SDByteAlign(output_buffer.width * 4, 64); + output_buffer.data = malloc(output_buffer.rowBytes * output_buffer.height); + if (!output_buffer.data) return NULL; + + vImage_Error ret = vImageScale_ARGB8888(&input_buffer, &output_buffer, NULL, kvImageHighQualityResampling); + if (ret != kvImageNoError) return NULL; + + CGImageRef outputImage = vImageCreateCGImageFromBuffer(&output_buffer, &format, NULL, NULL, kvImageNoFlags, &ret); + if (ret != kvImageNoError) { + CGImageRelease(outputImage); + return NULL; + } + + return outputImage; +} + ++ (CGSize)scaledSizeWithImageSize:(CGSize)imageSize scaleSize:(CGSize)scaleSize preserveAspectRatio:(BOOL)preserveAspectRatio shouldScaleUp:(BOOL)shouldScaleUp { + CGFloat width = imageSize.width; + CGFloat height = imageSize.height; + CGFloat resultWidth; + CGFloat resultHeight; + + if (width <= 0 || height <= 0 || scaleSize.width <= 0 || scaleSize.height <= 0) { + // Protect + resultWidth = width; + resultHeight = height; + } else { + // Scale to fit + if (preserveAspectRatio) { + CGFloat pixelRatio = width / height; + CGFloat scaleRatio = scaleSize.width / scaleSize.height; + if (pixelRatio > scaleRatio) { + resultWidth = scaleSize.width; + resultHeight = ceil(scaleSize.width / pixelRatio); + } else { + resultHeight = scaleSize.height; + resultWidth = ceil(scaleSize.height * pixelRatio); + } + } else { + // Stretch + resultWidth = scaleSize.width; + resultHeight = scaleSize.height; + } + if (!shouldScaleUp) { + // Scale down only + resultWidth = MIN(width, resultWidth); + resultHeight = MIN(height, resultHeight); + } + } + + return CGSizeMake(resultWidth, resultHeight); +} + ++ (UIImage *)decodedImageWithImage:(UIImage *)image { + if (![self shouldDecodeImage:image]) { + return image; + } + + UIImage *decodedImage; +#if SD_UIKIT + SDImageCoderDecodeSolution decodeSolution = self.defaultDecodeSolution; + if (decodeSolution == SDImageCoderDecodeSolutionAutomatic) { + // See #3365, CMPhoto iOS 15 only supports JPEG/HEIF format, or it will print an error log :( + SDImageFormat format = image.sd_imageFormat; + if ((format == SDImageFormatHEIC || format == SDImageFormatHEIF) && SDImageSupportsHardwareHEVCDecoder()) { + decodedImage = SDImageDecodeUIKit(image); + } else if (format == SDImageFormatJPEG) { + decodedImage = SDImageDecodeUIKit(image); + } + } else if (decodeSolution == SDImageCoderDecodeSolutionUIKit) { + // Arbitrarily call CMPhoto + decodedImage = SDImageDecodeUIKit(image); + } + if (decodedImage) { + return decodedImage; + } +#endif + + CGImageRef imageRef = image.CGImage; + if (!imageRef) { + return image; + } + BOOL hasAlpha = [self CGImageContainsAlpha:imageRef]; + // Prefer to use new Image Renderer to re-draw image, instead of low-level CGBitmapContext and CGContextDrawImage + // This can keep both OS compatible and don't fight with Apple's performance optimization + SDGraphicsImageRendererFormat *format = [[SDGraphicsImageRendererFormat alloc] init]; + format.opaque = !hasAlpha; + format.scale = image.scale; + CGSize imageSize = image.size; + SDGraphicsImageRenderer *renderer = [[SDGraphicsImageRenderer alloc] initWithSize:imageSize format:format]; + decodedImage = [renderer imageWithActions:^(CGContextRef _Nonnull context) { + [image drawInRect:CGRectMake(0, 0, imageSize.width, imageSize.height)]; + }]; + SDImageCopyAssociatedObject(image, decodedImage); + decodedImage.sd_isDecoded = YES; + return decodedImage; +} + ++ (UIImage *)decodedAndScaledDownImageWithImage:(UIImage *)image limitBytes:(NSUInteger)bytes { + if (![self shouldDecodeImage:image]) { + return image; + } + + CGFloat destTotalPixels; + CGFloat tileTotalPixels; + if (bytes == 0) { + bytes = [self defaultScaleDownLimitBytes]; + } + bytes = MAX(bytes, kBytesPerPixel); + destTotalPixels = bytes / kBytesPerPixel; + tileTotalPixels = destTotalPixels / 3; + + CGImageRef sourceImageRef = image.CGImage; + CGSize sourceResolution = CGSizeZero; + sourceResolution.width = CGImageGetWidth(sourceImageRef); + sourceResolution.height = CGImageGetHeight(sourceImageRef); + + if (![self shouldScaleDownImagePixelSize:sourceResolution limitBytes:bytes]) { + return [self decodedImageWithImage:image]; + } + + CGFloat sourceTotalPixels = sourceResolution.width * sourceResolution.height; + // Determine the scale ratio to apply to the input image + // that results in an output image of the defined size. + // see kDestImageSizeMB, and how it relates to destTotalPixels. + CGFloat imageScale = sqrt(destTotalPixels / sourceTotalPixels); + CGSize destResolution = CGSizeZero; + destResolution.width = MAX(1, (int)(sourceResolution.width * imageScale)); + destResolution.height = MAX(1, (int)(sourceResolution.height * imageScale)); + + UIImage *decodedImage; +#if SD_UIKIT + SDImageCoderDecodeSolution decodeSolution = self.defaultDecodeSolution; + if (decodeSolution == SDImageCoderDecodeSolutionAutomatic) { + // See #3365, CMPhoto iOS 15 only supports JPEG/HEIF format, or it will print an error log :( + SDImageFormat format = image.sd_imageFormat; + if ((format == SDImageFormatHEIC || format == SDImageFormatHEIF) && SDImageSupportsHardwareHEVCDecoder()) { + decodedImage = SDImageDecodeAndScaleDownUIKit(image, destResolution); + } else if (format == SDImageFormatJPEG) { + decodedImage = SDImageDecodeAndScaleDownUIKit(image, destResolution); + } + } else if (decodeSolution == SDImageCoderDecodeSolutionUIKit) { + // Arbitrarily call CMPhoto + decodedImage = SDImageDecodeAndScaleDownUIKit(image, destResolution); + } + if (decodedImage) { + return decodedImage; + } +#endif + + // autorelease the bitmap context and all vars to help system to free memory when there are memory warning. + // on iOS7, do not forget to call [[SDImageCache sharedImageCache] clearMemory]; + @autoreleasepool { + // device color space + CGColorSpaceRef colorspaceRef = [self colorSpaceGetDeviceRGB]; + BOOL hasAlpha = [self CGImageContainsAlpha:sourceImageRef]; + + // kCGImageAlphaNone is not supported in CGBitmapContextCreate. + // Check #3330 for more detail about why this bitmap is choosen. + CGBitmapInfo bitmapInfo; + if (hasAlpha) { + // iPhone GPU prefer to use BGRA8888, see: https://forums.raywenderlich.com/t/why-mtlpixelformat-bgra8unorm/53489 + // BGRA8888 + bitmapInfo = kCGBitmapByteOrder32Host | kCGImageAlphaPremultipliedFirst; + } else { + // BGR888 previously works on iOS 8~iOS 14, however, iOS 15+ will result a black image. FB9958017 + // RGB888 + bitmapInfo = kCGBitmapByteOrderDefault | kCGImageAlphaNoneSkipLast; + } + CGContextRef destContext = CGBitmapContextCreate(NULL, + destResolution.width, + destResolution.height, + kBitsPerComponent, + 0, + colorspaceRef, + bitmapInfo); + + if (destContext == NULL) { + return image; + } + CGContextSetInterpolationQuality(destContext, kCGInterpolationHigh); + + // Now define the size of the rectangle to be used for the + // incremental bits from the input image to the output image. + // we use a source tile width equal to the width of the source + // image due to the way that iOS retrieves image data from disk. + // iOS must decode an image from disk in full width 'bands', even + // if current graphics context is clipped to a subrect within that + // band. Therefore we fully utilize all of the pixel data that results + // from a decoding operation by anchoring our tile size to the full + // width of the input image. + CGRect sourceTile = CGRectZero; + sourceTile.size.width = sourceResolution.width; + // The source tile height is dynamic. Since we specified the size + // of the source tile in MB, see how many rows of pixels high it + // can be given the input image width. + sourceTile.size.height = MAX(1, (int)(tileTotalPixels / sourceTile.size.width)); + sourceTile.origin.x = 0.0f; + // The output tile is the same proportions as the input tile, but + // scaled to image scale. + CGRect destTile; + destTile.size.width = destResolution.width; + destTile.size.height = sourceTile.size.height * imageScale; + destTile.origin.x = 0.0f; + // The source seem overlap is proportionate to the destination seem overlap. + // this is the amount of pixels to overlap each tile as we assemble the output image. + float sourceSeemOverlap = (int)((kDestSeemOverlap/destResolution.height)*sourceResolution.height); + CGImageRef sourceTileImageRef; + // calculate the number of read/write operations required to assemble the + // output image. + int iterations = (int)( sourceResolution.height / sourceTile.size.height ); + // If tile height doesn't divide the image height evenly, add another iteration + // to account for the remaining pixels. + int remainder = (int)sourceResolution.height % (int)sourceTile.size.height; + if(remainder) { + iterations++; + } + // Add seem overlaps to the tiles, but save the original tile height for y coordinate calculations. + float sourceTileHeightMinusOverlap = sourceTile.size.height; + sourceTile.size.height += sourceSeemOverlap; + destTile.size.height += kDestSeemOverlap; + for( int y = 0; y < iterations; ++y ) { + @autoreleasepool { + sourceTile.origin.y = y * sourceTileHeightMinusOverlap + sourceSeemOverlap; + destTile.origin.y = destResolution.height - (( y + 1 ) * sourceTileHeightMinusOverlap * imageScale + kDestSeemOverlap); + sourceTileImageRef = CGImageCreateWithImageInRect( sourceImageRef, sourceTile ); + if( y == iterations - 1 && remainder ) { + float dify = destTile.size.height; + destTile.size.height = CGImageGetHeight( sourceTileImageRef ) * imageScale; + dify -= destTile.size.height; + destTile.origin.y = MIN(0, destTile.origin.y + dify); + } + CGContextDrawImage( destContext, destTile, sourceTileImageRef ); + CGImageRelease( sourceTileImageRef ); + } + } + + CGImageRef destImageRef = CGBitmapContextCreateImage(destContext); + CGContextRelease(destContext); + if (destImageRef == NULL) { + return image; + } +#if SD_MAC + decodedImage = [[UIImage alloc] initWithCGImage:destImageRef scale:image.scale orientation:kCGImagePropertyOrientationUp]; +#else + decodedImage = [[UIImage alloc] initWithCGImage:destImageRef scale:image.scale orientation:image.imageOrientation]; +#endif + CGImageRelease(destImageRef); + SDImageCopyAssociatedObject(image, decodedImage); + decodedImage.sd_isDecoded = YES; + return decodedImage; + } +} + ++ (SDImageCoderDecodeSolution)defaultDecodeSolution { + return kDefaultDecodeSolution; +} + ++ (void)setDefaultDecodeSolution:(SDImageCoderDecodeSolution)defaultDecodeSolution { + kDefaultDecodeSolution = defaultDecodeSolution; +} + ++ (NSUInteger)defaultScaleDownLimitBytes { + return kDestImageLimitBytes; +} + ++ (void)setDefaultScaleDownLimitBytes:(NSUInteger)defaultScaleDownLimitBytes { + if (defaultScaleDownLimitBytes < kBytesPerPixel) { + return; + } + kDestImageLimitBytes = defaultScaleDownLimitBytes; +} + +#if SD_UIKIT || SD_WATCH +// Convert an EXIF image orientation to an iOS one. ++ (UIImageOrientation)imageOrientationFromEXIFOrientation:(CGImagePropertyOrientation)exifOrientation { + UIImageOrientation imageOrientation = UIImageOrientationUp; + switch (exifOrientation) { + case kCGImagePropertyOrientationUp: + imageOrientation = UIImageOrientationUp; + break; + case kCGImagePropertyOrientationDown: + imageOrientation = UIImageOrientationDown; + break; + case kCGImagePropertyOrientationLeft: + imageOrientation = UIImageOrientationLeft; + break; + case kCGImagePropertyOrientationRight: + imageOrientation = UIImageOrientationRight; + break; + case kCGImagePropertyOrientationUpMirrored: + imageOrientation = UIImageOrientationUpMirrored; + break; + case kCGImagePropertyOrientationDownMirrored: + imageOrientation = UIImageOrientationDownMirrored; + break; + case kCGImagePropertyOrientationLeftMirrored: + imageOrientation = UIImageOrientationLeftMirrored; + break; + case kCGImagePropertyOrientationRightMirrored: + imageOrientation = UIImageOrientationRightMirrored; + break; + default: + break; + } + return imageOrientation; +} + +// Convert an iOS orientation to an EXIF image orientation. ++ (CGImagePropertyOrientation)exifOrientationFromImageOrientation:(UIImageOrientation)imageOrientation { + CGImagePropertyOrientation exifOrientation = kCGImagePropertyOrientationUp; + switch (imageOrientation) { + case UIImageOrientationUp: + exifOrientation = kCGImagePropertyOrientationUp; + break; + case UIImageOrientationDown: + exifOrientation = kCGImagePropertyOrientationDown; + break; + case UIImageOrientationLeft: + exifOrientation = kCGImagePropertyOrientationLeft; + break; + case UIImageOrientationRight: + exifOrientation = kCGImagePropertyOrientationRight; + break; + case UIImageOrientationUpMirrored: + exifOrientation = kCGImagePropertyOrientationUpMirrored; + break; + case UIImageOrientationDownMirrored: + exifOrientation = kCGImagePropertyOrientationDownMirrored; + break; + case UIImageOrientationLeftMirrored: + exifOrientation = kCGImagePropertyOrientationLeftMirrored; + break; + case UIImageOrientationRightMirrored: + exifOrientation = kCGImagePropertyOrientationRightMirrored; + break; + default: + break; + } + return exifOrientation; +} +#endif + +#pragma mark - Helper Function ++ (BOOL)shouldDecodeImage:(nullable UIImage *)image { + // Prevent "CGBitmapContextCreateImage: invalid context 0x0" error + if (image == nil) { + return NO; + } + // Avoid extra decode + if (image.sd_isDecoded) { + return NO; + } + // do not decode animated images + if (image.sd_isAnimated) { + return NO; + } + // do not decode vector images + if (image.sd_isVector) { + return NO; + } + + return YES; +} + ++ (BOOL)shouldScaleDownImagePixelSize:(CGSize)sourceResolution limitBytes:(NSUInteger)bytes { + BOOL shouldScaleDown = YES; + + CGFloat sourceTotalPixels = sourceResolution.width * sourceResolution.height; + if (sourceTotalPixels <= 0) { + return NO; + } + CGFloat destTotalPixels; + if (bytes == 0) { + bytes = [self defaultScaleDownLimitBytes]; + } + bytes = MAX(bytes, kBytesPerPixel); + destTotalPixels = bytes / kBytesPerPixel; + CGFloat imageScale = destTotalPixels / sourceTotalPixels; + if (imageScale < 1) { + shouldScaleDown = YES; + } else { + shouldScaleDown = NO; + } + + return shouldScaleDown; +} + +static inline CGAffineTransform SDCGContextTransformFromOrientation(CGImagePropertyOrientation orientation, CGSize size) { + // Inspiration from @libfeihu + // We need to calculate the proper transformation to make the image upright. + // We do it in 2 steps: Rotate if Left/Right/Down, and then flip if Mirrored. + CGAffineTransform transform = CGAffineTransformIdentity; + + switch (orientation) { + case kCGImagePropertyOrientationDown: + case kCGImagePropertyOrientationDownMirrored: + transform = CGAffineTransformTranslate(transform, size.width, size.height); + transform = CGAffineTransformRotate(transform, M_PI); + break; + + case kCGImagePropertyOrientationLeft: + case kCGImagePropertyOrientationLeftMirrored: + transform = CGAffineTransformTranslate(transform, size.width, 0); + transform = CGAffineTransformRotate(transform, M_PI_2); + break; + + case kCGImagePropertyOrientationRight: + case kCGImagePropertyOrientationRightMirrored: + transform = CGAffineTransformTranslate(transform, 0, size.height); + transform = CGAffineTransformRotate(transform, -M_PI_2); + break; + case kCGImagePropertyOrientationUp: + case kCGImagePropertyOrientationUpMirrored: + break; + } + + switch (orientation) { + case kCGImagePropertyOrientationUpMirrored: + case kCGImagePropertyOrientationDownMirrored: + transform = CGAffineTransformTranslate(transform, size.width, 0); + transform = CGAffineTransformScale(transform, -1, 1); + break; + + case kCGImagePropertyOrientationLeftMirrored: + case kCGImagePropertyOrientationRightMirrored: + transform = CGAffineTransformTranslate(transform, size.height, 0); + transform = CGAffineTransformScale(transform, -1, 1); + break; + case kCGImagePropertyOrientationUp: + case kCGImagePropertyOrientationDown: + case kCGImagePropertyOrientationLeft: + case kCGImagePropertyOrientationRight: + break; + } + + return transform; +} + +#if SD_UIKIT || SD_WATCH +static NSUInteger gcd(NSUInteger a, NSUInteger b) { + NSUInteger c; + while (a != 0) { + c = a; + a = b % a; + b = c; + } + return b; +} + +static NSUInteger gcdArray(size_t const count, NSUInteger const * const values) { + if (count == 0) { + return 0; + } + NSUInteger result = values[0]; + for (size_t i = 1; i < count; ++i) { + result = gcd(values[i], result); + } + return result; +} +#endif + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageCodersManager.h b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageCodersManager.h new file mode 100644 index 0000000..14b655d --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageCodersManager.h @@ -0,0 +1,58 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import +#import "SDImageCoder.h" + +/** + Global object holding the array of coders, so that we avoid passing them from object to object. + Uses a priority queue behind scenes, which means the latest added coders have the highest priority. + This is done so when encoding/decoding something, we go through the list and ask each coder if they can handle the current data. + That way, users can add their custom coders while preserving our existing prebuilt ones + + Note: the `coders` getter will return the coders in their reversed order + Example: + - by default we internally set coders = `IOCoder`, `GIFCoder`, `APNGCoder` + - calling `coders` will return `@[IOCoder, GIFCoder, APNGCoder]` + - call `[addCoder:[MyCrazyCoder new]]` + - calling `coders` now returns `@[IOCoder, GIFCoder, APNGCoder, MyCrazyCoder]` + + Coders + ------ + A coder must conform to the `SDImageCoder` protocol or even to `SDProgressiveImageCoder` if it supports progressive decoding + Conformance is important because that way, they will implement `canDecodeFromData` or `canEncodeToFormat` + Those methods are called on each coder in the array (using the priority order) until one of them returns YES. + That means that coder can decode that data / encode to that format + */ +@interface SDImageCodersManager : NSObject + +/** + Returns the global shared coders manager instance. + */ +@property (nonatomic, class, readonly, nonnull) SDImageCodersManager *sharedManager; + +/** + All coders in coders manager. The coders array is a priority queue, which means the later added coder will have the highest priority + */ +@property (nonatomic, copy, nullable) NSArray> *coders; + +/** + Add a new coder to the end of coders array. Which has the highest priority. + + @param coder coder + */ +- (void)addCoder:(nonnull id)coder; + +/** + Remove a coder in the coders array. + + @param coder coder + */ +- (void)removeCoder:(nonnull id)coder; + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageCodersManager.m b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageCodersManager.m new file mode 100644 index 0000000..00653d1 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageCodersManager.m @@ -0,0 +1,130 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDImageCodersManager.h" +#import "SDImageIOCoder.h" +#import "SDImageGIFCoder.h" +#import "SDImageAPNGCoder.h" +#import "SDImageHEICCoder.h" +#import "SDInternalMacros.h" + +@interface SDImageCodersManager () + +@property (nonatomic, strong, nonnull) NSMutableArray> *imageCoders; + +@end + +@implementation SDImageCodersManager { + SD_LOCK_DECLARE(_codersLock); +} + ++ (nonnull instancetype)sharedManager { + static dispatch_once_t once; + static id instance; + dispatch_once(&once, ^{ + instance = [self new]; + }); + return instance; +} + +- (instancetype)init { + if (self = [super init]) { + // initialize with default coders + _imageCoders = [NSMutableArray arrayWithArray:@[[SDImageIOCoder sharedCoder], [SDImageGIFCoder sharedCoder], [SDImageAPNGCoder sharedCoder]]]; + SD_LOCK_INIT(_codersLock); + } + return self; +} + +- (NSArray> *)coders { + SD_LOCK(_codersLock); + NSArray> *coders = [_imageCoders copy]; + SD_UNLOCK(_codersLock); + return coders; +} + +- (void)setCoders:(NSArray> *)coders { + SD_LOCK(_codersLock); + [_imageCoders removeAllObjects]; + if (coders.count) { + [_imageCoders addObjectsFromArray:coders]; + } + SD_UNLOCK(_codersLock); +} + +#pragma mark - Coder IO operations + +- (void)addCoder:(nonnull id)coder { + if (![coder conformsToProtocol:@protocol(SDImageCoder)]) { + return; + } + SD_LOCK(_codersLock); + [_imageCoders addObject:coder]; + SD_UNLOCK(_codersLock); +} + +- (void)removeCoder:(nonnull id)coder { + if (![coder conformsToProtocol:@protocol(SDImageCoder)]) { + return; + } + SD_LOCK(_codersLock); + [_imageCoders removeObject:coder]; + SD_UNLOCK(_codersLock); +} + +#pragma mark - SDImageCoder +- (BOOL)canDecodeFromData:(NSData *)data { + NSArray> *coders = self.coders; + for (id coder in coders.reverseObjectEnumerator) { + if ([coder canDecodeFromData:data]) { + return YES; + } + } + return NO; +} + +- (BOOL)canEncodeToFormat:(SDImageFormat)format { + NSArray> *coders = self.coders; + for (id coder in coders.reverseObjectEnumerator) { + if ([coder canEncodeToFormat:format]) { + return YES; + } + } + return NO; +} + +- (UIImage *)decodedImageWithData:(NSData *)data options:(nullable SDImageCoderOptions *)options { + if (!data) { + return nil; + } + UIImage *image; + NSArray> *coders = self.coders; + for (id coder in coders.reverseObjectEnumerator) { + if ([coder canDecodeFromData:data]) { + image = [coder decodedImageWithData:data options:options]; + break; + } + } + + return image; +} + +- (NSData *)encodedDataWithImage:(UIImage *)image format:(SDImageFormat)format options:(nullable SDImageCoderOptions *)options { + if (!image) { + return nil; + } + NSArray> *coders = self.coders; + for (id coder in coders.reverseObjectEnumerator) { + if ([coder canEncodeToFormat:format]) { + return [coder encodedDataWithImage:image format:format options:options]; + } + } + return nil; +} + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageFrame.h b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageFrame.h new file mode 100644 index 0000000..a93fd9c --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageFrame.h @@ -0,0 +1,36 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import +#import "SDWebImageCompat.h" + +/** + This class is used for creating animated images via `animatedImageWithFrames` in `SDImageCoderHelper`. + @note If you need to specify animated images loop count, use `sd_imageLoopCount` property in `UIImage+Metadata.h`. + */ +@interface SDImageFrame : NSObject + +/** + The image of current frame. You should not set an animated image. + */ +@property (nonatomic, strong, readonly, nonnull) UIImage *image; +/** + The duration of current frame to be displayed. The number is seconds but not milliseconds. You should not set this to zero. + */ +@property (nonatomic, readonly, assign) NSTimeInterval duration; + +/** + Create a frame instance with specify image and duration + + @param image current frame's image + @param duration current frame's duration + @return frame instance + */ ++ (instancetype _Nonnull)frameWithImage:(UIImage * _Nonnull)image duration:(NSTimeInterval)duration; + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageFrame.m b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageFrame.m new file mode 100644 index 0000000..f035af5 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageFrame.m @@ -0,0 +1,28 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDImageFrame.h" + +@interface SDImageFrame () + +@property (nonatomic, strong, readwrite, nonnull) UIImage *image; +@property (nonatomic, readwrite, assign) NSTimeInterval duration; + +@end + +@implementation SDImageFrame + ++ (instancetype)frameWithImage:(UIImage *)image duration:(NSTimeInterval)duration { + SDImageFrame *frame = [[SDImageFrame alloc] init]; + frame.image = image; + frame.duration = duration; + + return frame; +} + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageGIFCoder.h b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageGIFCoder.h new file mode 100644 index 0000000..5ef67ac --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageGIFCoder.h @@ -0,0 +1,22 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import +#import "SDImageIOAnimatedCoder.h" + +/** + Built in coder using ImageIO that supports animated GIF encoding/decoding + @note `SDImageIOCoder` supports GIF but only as static (will use the 1st frame). + @note Use `SDImageGIFCoder` for fully animated GIFs. For `UIImageView`, it will produce animated `UIImage`(`NSImage` on macOS) for rendering. For `SDAnimatedImageView`, it will use `SDAnimatedImage` for rendering. + @note The recommended approach for animated GIFs is using `SDAnimatedImage` with `SDAnimatedImageView`. It's more performant than `UIImageView` for GIF displaying(especially on memory usage) + */ +@interface SDImageGIFCoder : SDImageIOAnimatedCoder + +@property (nonatomic, class, readonly, nonnull) SDImageGIFCoder *sharedCoder; + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageGIFCoder.m b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageGIFCoder.m new file mode 100644 index 0000000..a1838b1 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageGIFCoder.m @@ -0,0 +1,58 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDImageGIFCoder.h" +#import "SDImageIOAnimatedCoderInternal.h" +#if SD_MAC +#import +#else +#import +#endif + +@implementation SDImageGIFCoder + ++ (instancetype)sharedCoder { + static SDImageGIFCoder *coder; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + coder = [[SDImageGIFCoder alloc] init]; + }); + return coder; +} + +#pragma mark - Subclass Override + ++ (SDImageFormat)imageFormat { + return SDImageFormatGIF; +} + ++ (NSString *)imageUTType { + return (__bridge NSString *)kSDUTTypeGIF; +} + ++ (NSString *)dictionaryProperty { + return (__bridge NSString *)kCGImagePropertyGIFDictionary; +} + ++ (NSString *)unclampedDelayTimeProperty { + return (__bridge NSString *)kCGImagePropertyGIFUnclampedDelayTime; +} + ++ (NSString *)delayTimeProperty { + return (__bridge NSString *)kCGImagePropertyGIFDelayTime; +} + ++ (NSString *)loopCountProperty { + return (__bridge NSString *)kCGImagePropertyGIFLoopCount; +} + ++ (NSUInteger)defaultLoopCount { + return 1; +} + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageGraphics.h b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageGraphics.h new file mode 100644 index 0000000..131d685 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageGraphics.h @@ -0,0 +1,28 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageCompat.h" +#import + +/** + These following graphics context method are provided to easily write cross-platform(AppKit/UIKit) code. + For UIKit, these methods just call the same method in `UIGraphics.h`. See the documentation for usage. + For AppKit, these methods use `NSGraphicsContext` to create image context and match the behavior like UIKit. + @note If you don't care bitmap format (ARGB8888) and just draw image, use `SDGraphicsImageRenderer` instead. It's more performant on RAM usage.` + */ + +/// Returns the current graphics context. +FOUNDATION_EXPORT CGContextRef __nullable SDGraphicsGetCurrentContext(void) CF_RETURNS_NOT_RETAINED; +/// Creates a bitmap-based graphics context and makes it the current context. +FOUNDATION_EXPORT void SDGraphicsBeginImageContext(CGSize size); +/// Creates a bitmap-based graphics context with the specified options. +FOUNDATION_EXPORT void SDGraphicsBeginImageContextWithOptions(CGSize size, BOOL opaque, CGFloat scale); +/// Removes the current bitmap-based graphics context from the top of the stack. +FOUNDATION_EXPORT void SDGraphicsEndImageContext(void); +/// Returns an image based on the contents of the current bitmap-based graphics context. +FOUNDATION_EXPORT UIImage * __nullable SDGraphicsGetImageFromCurrentImageContext(void); diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageGraphics.m b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageGraphics.m new file mode 100644 index 0000000..d1a1ca6 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageGraphics.m @@ -0,0 +1,127 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDImageGraphics.h" +#import "NSImage+Compatibility.h" +#import "SDImageCoderHelper.h" +#import "objc/runtime.h" + +#if SD_MAC +static void *kNSGraphicsContextScaleFactorKey; + +static CGContextRef SDCGContextCreateBitmapContext(CGSize size, BOOL opaque, CGFloat scale) { + if (scale == 0) { + // Match `UIGraphicsBeginImageContextWithOptions`, reset to the scale factor of the device’s main screen if scale is 0. + NSScreen *mainScreen = nil; + if (@available(macOS 10.12, *)) { + mainScreen = [NSScreen mainScreen]; + } else { + mainScreen = [NSScreen screens].firstObject; + } + scale = mainScreen.backingScaleFactor ?: 1.0f; + } + size_t width = ceil(size.width * scale); + size_t height = ceil(size.height * scale); + if (width < 1 || height < 1) return NULL; + + CGColorSpaceRef space = [SDImageCoderHelper colorSpaceGetDeviceRGB]; + // kCGImageAlphaNone is not supported in CGBitmapContextCreate. + // Check #3330 for more detail about why this bitmap is choosen. + CGBitmapInfo bitmapInfo; + if (!opaque) { + // iPhone GPU prefer to use BGRA8888, see: https://forums.raywenderlich.com/t/why-mtlpixelformat-bgra8unorm/53489 + // BGRA8888 + bitmapInfo = kCGBitmapByteOrder32Host | kCGImageAlphaPremultipliedFirst; + } else { + // BGR888 previously works on iOS 8~iOS 14, however, iOS 15+ will result a black image. FB9958017 + // RGB888 + bitmapInfo = kCGBitmapByteOrderDefault | kCGImageAlphaNoneSkipLast; + } + CGContextRef context = CGBitmapContextCreate(NULL, width, height, 8, 0, space, bitmapInfo); + if (!context) { + return NULL; + } + CGContextScaleCTM(context, scale, scale); + + return context; +} +#endif + +CGContextRef SDGraphicsGetCurrentContext(void) { +#if SD_UIKIT || SD_WATCH + return UIGraphicsGetCurrentContext(); +#else + return NSGraphicsContext.currentContext.CGContext; +#endif +} + +void SDGraphicsBeginImageContext(CGSize size) { +#if SD_UIKIT || SD_WATCH + UIGraphicsBeginImageContext(size); +#else + SDGraphicsBeginImageContextWithOptions(size, NO, 1.0); +#endif +} + +void SDGraphicsBeginImageContextWithOptions(CGSize size, BOOL opaque, CGFloat scale) { +#if SD_UIKIT || SD_WATCH + UIGraphicsBeginImageContextWithOptions(size, opaque, scale); +#else + CGContextRef context = SDCGContextCreateBitmapContext(size, opaque, scale); + if (!context) { + return; + } + NSGraphicsContext *graphicsContext = [NSGraphicsContext graphicsContextWithCGContext:context flipped:NO]; + objc_setAssociatedObject(graphicsContext, &kNSGraphicsContextScaleFactorKey, @(scale), OBJC_ASSOCIATION_RETAIN); + CGContextRelease(context); + [NSGraphicsContext saveGraphicsState]; + NSGraphicsContext.currentContext = graphicsContext; +#endif +} + +void SDGraphicsEndImageContext(void) { +#if SD_UIKIT || SD_WATCH + UIGraphicsEndImageContext(); +#else + [NSGraphicsContext restoreGraphicsState]; +#endif +} + +UIImage * SDGraphicsGetImageFromCurrentImageContext(void) { +#if SD_UIKIT || SD_WATCH + return UIGraphicsGetImageFromCurrentImageContext(); +#else + NSGraphicsContext *context = NSGraphicsContext.currentContext; + CGContextRef contextRef = context.CGContext; + if (!contextRef) { + return nil; + } + CGImageRef imageRef = CGBitmapContextCreateImage(contextRef); + if (!imageRef) { + return nil; + } + CGFloat scale = 0; + NSNumber *scaleFactor = objc_getAssociatedObject(context, &kNSGraphicsContextScaleFactorKey); + if ([scaleFactor isKindOfClass:[NSNumber class]]) { + scale = scaleFactor.doubleValue; + } + if (!scale) { + // reset to the scale factor of the device’s main screen if scale is 0. + NSScreen *mainScreen = nil; + if (@available(macOS 10.12, *)) { + mainScreen = [NSScreen mainScreen]; + } else { + mainScreen = [NSScreen screens].firstObject; + } + scale = mainScreen.backingScaleFactor ?: 1.0f; + } + NSImage *image = [[NSImage alloc] initWithCGImage:imageRef scale:scale orientation:kCGImagePropertyOrientationUp]; + CGImageRelease(imageRef); + return image; +#endif +} diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageHEICCoder.h b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageHEICCoder.h new file mode 100644 index 0000000..f7dd661 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageHEICCoder.h @@ -0,0 +1,25 @@ +/* +* This file is part of the SDWebImage package. +* (c) Olivier Poitrey +* +* For the full copyright and license information, please view the LICENSE +* file that was distributed with this source code. +*/ + +#import +#import "SDImageIOAnimatedCoder.h" + +/** + This coder is used for HEIC (HEIF with HEVC container codec) image format. + Image/IO provide the static HEIC (.heic) support in iOS 11/macOS 10.13/tvOS 11/watchOS 4+. + Image/IO provide the animated HEIC (.heics) support in iOS 13/macOS 10.15/tvOS 13/watchOS 6+. + See https://nokiatech.github.io/heif/technical.html for the standard. + @note This coder is not in the default coder list for now, since HEIC animated image is really rare, and Apple's implementation still contains performance issues. You can enable if you need this. + @note If you need to support lower firmware version for HEIF, you can have a try at https://github.com/SDWebImage/SDWebImageHEIFCoder + */ +API_AVAILABLE(ios(13.0), tvos(13.0), macos(10.15), watchos(6.0)) +@interface SDImageHEICCoder : SDImageIOAnimatedCoder + +@property (nonatomic, class, readonly, nonnull) SDImageHEICCoder *sharedCoder; + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageHEICCoder.m b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageHEICCoder.m new file mode 100644 index 0000000..dd83aea --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageHEICCoder.m @@ -0,0 +1,101 @@ +/* +* This file is part of the SDWebImage package. +* (c) Olivier Poitrey +* +* For the full copyright and license information, please view the LICENSE +* file that was distributed with this source code. +*/ + +#import "SDImageHEICCoder.h" +#import "SDImageIOAnimatedCoderInternal.h" + +// These constants are available from iOS 13+ and Xcode 11. This raw value is used for toolchain and firmware compatibility +static NSString * kSDCGImagePropertyHEICSDictionary = @"{HEICS}"; +static NSString * kSDCGImagePropertyHEICSLoopCount = @"LoopCount"; +static NSString * kSDCGImagePropertyHEICSDelayTime = @"DelayTime"; +static NSString * kSDCGImagePropertyHEICSUnclampedDelayTime = @"UnclampedDelayTime"; + +@implementation SDImageHEICCoder + ++ (void)initialize { + if (@available(iOS 13, tvOS 13, macOS 10.15, watchOS 6, *)) { + // Use SDK instead of raw value + kSDCGImagePropertyHEICSDictionary = (__bridge NSString *)kCGImagePropertyHEICSDictionary; + kSDCGImagePropertyHEICSLoopCount = (__bridge NSString *)kCGImagePropertyHEICSLoopCount; + kSDCGImagePropertyHEICSDelayTime = (__bridge NSString *)kCGImagePropertyHEICSDelayTime; + kSDCGImagePropertyHEICSUnclampedDelayTime = (__bridge NSString *)kCGImagePropertyHEICSUnclampedDelayTime; + } +} + ++ (instancetype)sharedCoder { + static SDImageHEICCoder *coder; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + coder = [[SDImageHEICCoder alloc] init]; + }); + return coder; +} + +#pragma mark - SDImageCoder + +- (BOOL)canDecodeFromData:(nullable NSData *)data { + switch ([NSData sd_imageFormatForImageData:data]) { + case SDImageFormatHEIC: + // Check HEIC decoding compatibility + return [self.class canDecodeFromFormat:SDImageFormatHEIC]; + case SDImageFormatHEIF: + // Check HEIF decoding compatibility + return [self.class canDecodeFromFormat:SDImageFormatHEIF]; + default: + return NO; + } +} + +- (BOOL)canIncrementalDecodeFromData:(NSData *)data { + return [self canDecodeFromData:data]; +} + +- (BOOL)canEncodeToFormat:(SDImageFormat)format { + switch (format) { + case SDImageFormatHEIC: + // Check HEIC encoding compatibility + return [self.class canEncodeToFormat:SDImageFormatHEIC]; + case SDImageFormatHEIF: + // Check HEIF encoding compatibility + return [self.class canEncodeToFormat:SDImageFormatHEIF]; + default: + return NO; + } +} + +#pragma mark - Subclass Override + ++ (SDImageFormat)imageFormat { + return SDImageFormatHEIC; +} + ++ (NSString *)imageUTType { + return (__bridge NSString *)kSDUTTypeHEIC; +} + ++ (NSString *)dictionaryProperty { + return kSDCGImagePropertyHEICSDictionary; +} + ++ (NSString *)unclampedDelayTimeProperty { + return kSDCGImagePropertyHEICSUnclampedDelayTime; +} + ++ (NSString *)delayTimeProperty { + return kSDCGImagePropertyHEICSDelayTime; +} + ++ (NSString *)loopCountProperty { + return kSDCGImagePropertyHEICSLoopCount; +} + ++ (NSUInteger)defaultLoopCount { + return 0; +} + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageIOAnimatedCoder.h b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageIOAnimatedCoder.h new file mode 100644 index 0000000..a314c57 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageIOAnimatedCoder.h @@ -0,0 +1,59 @@ +/* +* This file is part of the SDWebImage package. +* (c) Olivier Poitrey +* +* For the full copyright and license information, please view the LICENSE +* file that was distributed with this source code. +*/ + +#import +#import +#import "SDImageCoder.h" + +/** + This is the abstract class for all animated coder, which use the Image/IO API. You can not use this directly as real coders. A exception will be raised if you use this class. + All of the properties need the subclass to implement and works as expected. + For Image/IO, See Apple's documentation: https://developer.apple.com/documentation/imageio + */ +@interface SDImageIOAnimatedCoder : NSObject + +#pragma mark - Subclass Override +/** + The supported animated image format. Such as `SDImageFormatGIF`. + @note Subclass override. + */ +@property (class, readonly) SDImageFormat imageFormat; +/** + The supported image format UTI Type. Such as `kSDUTTypeGIF`. + This can be used for cases when we can not detect `SDImageFormat. Such as progressive decoding's hint format `kCGImageSourceTypeIdentifierHint`. + @note Subclass override. + */ +@property (class, readonly, nonnull) NSString *imageUTType; +/** + The image container property key used in Image/IO API. Such as `kCGImagePropertyGIFDictionary`. + @note Subclass override. + */ +@property (class, readonly, nonnull) NSString *dictionaryProperty; +/** + The image unclamped delay time property key used in Image/IO API. Such as `kCGImagePropertyGIFUnclampedDelayTime` + @note Subclass override. + */ +@property (class, readonly, nonnull) NSString *unclampedDelayTimeProperty; +/** + The image delay time property key used in Image/IO API. Such as `kCGImagePropertyGIFDelayTime`. + @note Subclass override. + */ +@property (class, readonly, nonnull) NSString *delayTimeProperty; +/** + The image loop count property key used in Image/IO API. Such as `kCGImagePropertyGIFLoopCount`. + @note Subclass override. + */ +@property (class, readonly, nonnull) NSString *loopCountProperty; +/** + The default loop count when there are no any loop count information inside image container metadata. + For example, for GIF format, the standard use 1 (play once). For APNG format, the standard use 0 (infinity loop). + @note Subclass override. + */ +@property (class, readonly) NSUInteger defaultLoopCount; + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageIOAnimatedCoder.m b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageIOAnimatedCoder.m new file mode 100644 index 0000000..922d018 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageIOAnimatedCoder.m @@ -0,0 +1,645 @@ +/* +* This file is part of the SDWebImage package. +* (c) Olivier Poitrey +* +* For the full copyright and license information, please view the LICENSE +* file that was distributed with this source code. +*/ + +#import "SDImageIOAnimatedCoder.h" +#import "NSImage+Compatibility.h" +#import "UIImage+Metadata.h" +#import "NSData+ImageContentType.h" +#import "SDImageCoderHelper.h" +#import "SDAnimatedImageRep.h" +#import "UIImage+ForceDecode.h" + +// Specify DPI for vector format in CGImageSource, like PDF +static NSString * kSDCGImageSourceRasterizationDPI = @"kCGImageSourceRasterizationDPI"; +// Specify File Size for lossy format encoding, like JPEG +static NSString * kSDCGImageDestinationRequestedFileSize = @"kCGImageDestinationRequestedFileSize"; + +@interface SDImageIOCoderFrame : NSObject + +@property (nonatomic, assign) NSUInteger index; // Frame index (zero based) +@property (nonatomic, assign) NSTimeInterval duration; // Frame duration in seconds + +@end + +@implementation SDImageIOCoderFrame +@end + +@implementation SDImageIOAnimatedCoder { + size_t _width, _height; + CGImageSourceRef _imageSource; + NSData *_imageData; + CGFloat _scale; + NSUInteger _loopCount; + NSUInteger _frameCount; + NSArray *_frames; + BOOL _finished; + BOOL _preserveAspectRatio; + CGSize _thumbnailSize; +} + +- (void)dealloc +{ + if (_imageSource) { + CFRelease(_imageSource); + _imageSource = NULL; + } +#if SD_UIKIT + [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidReceiveMemoryWarningNotification object:nil]; +#endif +} + +- (void)didReceiveMemoryWarning:(NSNotification *)notification +{ + if (_imageSource) { + for (size_t i = 0; i < _frameCount; i++) { + CGImageSourceRemoveCacheAtIndex(_imageSource, i); + } + } +} + +#pragma mark - Subclass Override + ++ (SDImageFormat)imageFormat { + @throw [NSException exceptionWithName:NSInternalInconsistencyException + reason:[NSString stringWithFormat:@"For `SDImageIOAnimatedCoder` subclass, you must override %@ method", NSStringFromSelector(_cmd)] + userInfo:nil]; +} + ++ (NSString *)imageUTType { + @throw [NSException exceptionWithName:NSInternalInconsistencyException + reason:[NSString stringWithFormat:@"For `SDImageIOAnimatedCoder` subclass, you must override %@ method", NSStringFromSelector(_cmd)] + userInfo:nil]; +} + ++ (NSString *)dictionaryProperty { + @throw [NSException exceptionWithName:NSInternalInconsistencyException + reason:[NSString stringWithFormat:@"For `SDImageIOAnimatedCoder` subclass, you must override %@ method", NSStringFromSelector(_cmd)] + userInfo:nil]; +} + ++ (NSString *)unclampedDelayTimeProperty { + @throw [NSException exceptionWithName:NSInternalInconsistencyException + reason:[NSString stringWithFormat:@"For `SDImageIOAnimatedCoder` subclass, you must override %@ method", NSStringFromSelector(_cmd)] + userInfo:nil]; +} + ++ (NSString *)delayTimeProperty { + @throw [NSException exceptionWithName:NSInternalInconsistencyException + reason:[NSString stringWithFormat:@"For `SDImageIOAnimatedCoder` subclass, you must override %@ method", NSStringFromSelector(_cmd)] + userInfo:nil]; +} + ++ (NSString *)loopCountProperty { + @throw [NSException exceptionWithName:NSInternalInconsistencyException + reason:[NSString stringWithFormat:@"For `SDImageIOAnimatedCoder` subclass, you must override %@ method", NSStringFromSelector(_cmd)] + userInfo:nil]; +} + ++ (NSUInteger)defaultLoopCount { + @throw [NSException exceptionWithName:NSInternalInconsistencyException + reason:[NSString stringWithFormat:@"For `SDImageIOAnimatedCoder` subclass, you must override %@ method", NSStringFromSelector(_cmd)] + userInfo:nil]; +} + +#pragma mark - Utils + ++ (BOOL)canDecodeFromFormat:(SDImageFormat)format { + static dispatch_once_t onceToken; + static NSSet *imageUTTypeSet; + dispatch_once(&onceToken, ^{ + NSArray *imageUTTypes = (__bridge_transfer NSArray *)CGImageSourceCopyTypeIdentifiers(); + imageUTTypeSet = [NSSet setWithArray:imageUTTypes]; + }); + CFStringRef imageUTType = [NSData sd_UTTypeFromImageFormat:format]; + if ([imageUTTypeSet containsObject:(__bridge NSString *)(imageUTType)]) { + // Can decode from target format + return YES; + } + return NO; +} + ++ (BOOL)canEncodeToFormat:(SDImageFormat)format { + static dispatch_once_t onceToken; + static NSSet *imageUTTypeSet; + dispatch_once(&onceToken, ^{ + NSArray *imageUTTypes = (__bridge_transfer NSArray *)CGImageDestinationCopyTypeIdentifiers(); + imageUTTypeSet = [NSSet setWithArray:imageUTTypes]; + }); + CFStringRef imageUTType = [NSData sd_UTTypeFromImageFormat:format]; + if ([imageUTTypeSet containsObject:(__bridge NSString *)(imageUTType)]) { + // Can encode to target format + return YES; + } + return NO; +} + ++ (NSUInteger)imageLoopCountWithSource:(CGImageSourceRef)source { + NSUInteger loopCount = self.defaultLoopCount; + NSDictionary *imageProperties = (__bridge_transfer NSDictionary *)CGImageSourceCopyProperties(source, NULL); + NSDictionary *containerProperties = imageProperties[self.dictionaryProperty]; + if (containerProperties) { + NSNumber *containerLoopCount = containerProperties[self.loopCountProperty]; + if (containerLoopCount != nil) { + loopCount = containerLoopCount.unsignedIntegerValue; + } + } + return loopCount; +} + ++ (NSTimeInterval)frameDurationAtIndex:(NSUInteger)index source:(CGImageSourceRef)source { + NSDictionary *options = @{ + (__bridge NSString *)kCGImageSourceShouldCacheImmediately : @(YES), + (__bridge NSString *)kCGImageSourceShouldCache : @(YES) // Always cache to reduce CPU usage + }; + NSTimeInterval frameDuration = 0.1; + CFDictionaryRef cfFrameProperties = CGImageSourceCopyPropertiesAtIndex(source, index, (__bridge CFDictionaryRef)options); + if (!cfFrameProperties) { + return frameDuration; + } + NSDictionary *frameProperties = (__bridge NSDictionary *)cfFrameProperties; + NSDictionary *containerProperties = frameProperties[self.dictionaryProperty]; + + NSNumber *delayTimeUnclampedProp = containerProperties[self.unclampedDelayTimeProperty]; + if (delayTimeUnclampedProp != nil) { + frameDuration = [delayTimeUnclampedProp doubleValue]; + } else { + NSNumber *delayTimeProp = containerProperties[self.delayTimeProperty]; + if (delayTimeProp != nil) { + frameDuration = [delayTimeProp doubleValue]; + } + } + + // Many annoying ads specify a 0 duration to make an image flash as quickly as possible. + // We follow Firefox's behavior and use a duration of 100 ms for any frames that specify + // a duration of <= 10 ms. See and + // for more information. + + if (frameDuration < 0.011) { + frameDuration = 0.1; + } + + CFRelease(cfFrameProperties); + return frameDuration; +} + ++ (UIImage *)createFrameAtIndex:(NSUInteger)index source:(CGImageSourceRef)source scale:(CGFloat)scale preserveAspectRatio:(BOOL)preserveAspectRatio thumbnailSize:(CGSize)thumbnailSize options:(NSDictionary *)options { + // Some options need to pass to `CGImageSourceCopyPropertiesAtIndex` before `CGImageSourceCreateImageAtIndex`, or ImageIO will ignore them because they parse once :) + // Parse the image properties + NSDictionary *properties = (__bridge_transfer NSDictionary *)CGImageSourceCopyPropertiesAtIndex(source, index, (__bridge CFDictionaryRef)options); + CGFloat pixelWidth = [properties[(__bridge NSString *)kCGImagePropertyPixelWidth] doubleValue]; + CGFloat pixelHeight = [properties[(__bridge NSString *)kCGImagePropertyPixelHeight] doubleValue]; + CGImagePropertyOrientation exifOrientation = (CGImagePropertyOrientation)[properties[(__bridge NSString *)kCGImagePropertyOrientation] unsignedIntegerValue]; + if (!exifOrientation) { + exifOrientation = kCGImagePropertyOrientationUp; + } + + NSMutableDictionary *decodingOptions; + if (options) { + decodingOptions = [NSMutableDictionary dictionaryWithDictionary:options]; + } else { + decodingOptions = [NSMutableDictionary dictionary]; + } + CGImageRef imageRef; + BOOL createFullImage = thumbnailSize.width == 0 || thumbnailSize.height == 0 || pixelWidth == 0 || pixelHeight == 0 || (pixelWidth <= thumbnailSize.width && pixelHeight <= thumbnailSize.height); + if (createFullImage) { + imageRef = CGImageSourceCreateImageAtIndex(source, index, (__bridge CFDictionaryRef)[decodingOptions copy]); + } else { + decodingOptions[(__bridge NSString *)kCGImageSourceCreateThumbnailWithTransform] = @(preserveAspectRatio); + CGFloat maxPixelSize; + if (preserveAspectRatio) { + CGFloat pixelRatio = pixelWidth / pixelHeight; + CGFloat thumbnailRatio = thumbnailSize.width / thumbnailSize.height; + if (pixelRatio > thumbnailRatio) { + maxPixelSize = MAX(thumbnailSize.width, thumbnailSize.width / pixelRatio); + } else { + maxPixelSize = MAX(thumbnailSize.height, thumbnailSize.height * pixelRatio); + } + } else { + maxPixelSize = MAX(thumbnailSize.width, thumbnailSize.height); + } + decodingOptions[(__bridge NSString *)kCGImageSourceThumbnailMaxPixelSize] = @(maxPixelSize); + decodingOptions[(__bridge NSString *)kCGImageSourceCreateThumbnailFromImageAlways] = @(YES); + imageRef = CGImageSourceCreateThumbnailAtIndex(source, index, (__bridge CFDictionaryRef)[decodingOptions copy]); + } + if (!imageRef) { + return nil; + } + // Thumbnail image post-process + if (!createFullImage) { + if (preserveAspectRatio) { + // kCGImageSourceCreateThumbnailWithTransform will apply EXIF transform as well, we should not apply twice + exifOrientation = kCGImagePropertyOrientationUp; + } else { + // `CGImageSourceCreateThumbnailAtIndex` take only pixel dimension, if not `preserveAspectRatio`, we should manual scale to the target size + CGImageRef scaledImageRef = [SDImageCoderHelper CGImageCreateScaled:imageRef size:thumbnailSize]; + CGImageRelease(imageRef); + imageRef = scaledImageRef; + } + } + +#if SD_UIKIT || SD_WATCH + UIImageOrientation imageOrientation = [SDImageCoderHelper imageOrientationFromEXIFOrientation:exifOrientation]; + UIImage *image = [[UIImage alloc] initWithCGImage:imageRef scale:scale orientation:imageOrientation]; +#else + UIImage *image = [[UIImage alloc] initWithCGImage:imageRef scale:scale orientation:exifOrientation]; +#endif + CGImageRelease(imageRef); + return image; +} + +#pragma mark - Decode +- (BOOL)canDecodeFromData:(nullable NSData *)data { + return ([NSData sd_imageFormatForImageData:data] == self.class.imageFormat); +} + +- (UIImage *)decodedImageWithData:(NSData *)data options:(nullable SDImageCoderOptions *)options { + if (!data) { + return nil; + } + CGFloat scale = 1; + NSNumber *scaleFactor = options[SDImageCoderDecodeScaleFactor]; + if (scaleFactor != nil) { + scale = MAX([scaleFactor doubleValue], 1); + } + + CGSize thumbnailSize = CGSizeZero; + NSValue *thumbnailSizeValue = options[SDImageCoderDecodeThumbnailPixelSize]; + if (thumbnailSizeValue != nil) { +#if SD_MAC + thumbnailSize = thumbnailSizeValue.sizeValue; +#else + thumbnailSize = thumbnailSizeValue.CGSizeValue; +#endif + } + + BOOL preserveAspectRatio = YES; + NSNumber *preserveAspectRatioValue = options[SDImageCoderDecodePreserveAspectRatio]; + if (preserveAspectRatioValue != nil) { + preserveAspectRatio = preserveAspectRatioValue.boolValue; + } + +#if SD_MAC + // If don't use thumbnail, prefers the built-in generation of frames (GIF/APNG) + // Which decode frames in time and reduce memory usage + if (thumbnailSize.width == 0 || thumbnailSize.height == 0) { + SDAnimatedImageRep *imageRep = [[SDAnimatedImageRep alloc] initWithData:data]; + if (imageRep) { + NSSize size = NSMakeSize(imageRep.pixelsWide / scale, imageRep.pixelsHigh / scale); + imageRep.size = size; + NSImage *animatedImage = [[NSImage alloc] initWithSize:size]; + [animatedImage addRepresentation:imageRep]; + animatedImage.sd_imageFormat = self.class.imageFormat; + return animatedImage; + } + } +#endif + + CGImageSourceRef source = CGImageSourceCreateWithData((__bridge CFDataRef)data, NULL); + if (!source) { + return nil; + } + size_t count = CGImageSourceGetCount(source); + UIImage *animatedImage; + + BOOL decodeFirstFrame = [options[SDImageCoderDecodeFirstFrameOnly] boolValue]; + if (decodeFirstFrame || count <= 1) { + animatedImage = [self.class createFrameAtIndex:0 source:source scale:scale preserveAspectRatio:preserveAspectRatio thumbnailSize:thumbnailSize options:nil]; + } else { + NSMutableArray *frames = [NSMutableArray array]; + + for (size_t i = 0; i < count; i++) { + UIImage *image = [self.class createFrameAtIndex:i source:source scale:scale preserveAspectRatio:preserveAspectRatio thumbnailSize:thumbnailSize options:nil]; + if (!image) { + continue; + } + + NSTimeInterval duration = [self.class frameDurationAtIndex:i source:source]; + + SDImageFrame *frame = [SDImageFrame frameWithImage:image duration:duration]; + [frames addObject:frame]; + } + + NSUInteger loopCount = [self.class imageLoopCountWithSource:source]; + + animatedImage = [SDImageCoderHelper animatedImageWithFrames:frames]; + animatedImage.sd_imageLoopCount = loopCount; + } + animatedImage.sd_imageFormat = self.class.imageFormat; + CFRelease(source); + + return animatedImage; +} + +#pragma mark - Progressive Decode + +- (BOOL)canIncrementalDecodeFromData:(NSData *)data { + return ([NSData sd_imageFormatForImageData:data] == self.class.imageFormat); +} + +- (instancetype)initIncrementalWithOptions:(nullable SDImageCoderOptions *)options { + self = [super init]; + if (self) { + NSString *imageUTType = self.class.imageUTType; + _imageSource = CGImageSourceCreateIncremental((__bridge CFDictionaryRef)@{(__bridge NSString *)kCGImageSourceTypeIdentifierHint : imageUTType}); + CGFloat scale = 1; + NSNumber *scaleFactor = options[SDImageCoderDecodeScaleFactor]; + if (scaleFactor != nil) { + scale = MAX([scaleFactor doubleValue], 1); + } + _scale = scale; + CGSize thumbnailSize = CGSizeZero; + NSValue *thumbnailSizeValue = options[SDImageCoderDecodeThumbnailPixelSize]; + if (thumbnailSizeValue != nil) { + #if SD_MAC + thumbnailSize = thumbnailSizeValue.sizeValue; + #else + thumbnailSize = thumbnailSizeValue.CGSizeValue; + #endif + } + _thumbnailSize = thumbnailSize; + BOOL preserveAspectRatio = YES; + NSNumber *preserveAspectRatioValue = options[SDImageCoderDecodePreserveAspectRatio]; + if (preserveAspectRatioValue != nil) { + preserveAspectRatio = preserveAspectRatioValue.boolValue; + } + _preserveAspectRatio = preserveAspectRatio; +#if SD_UIKIT + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didReceiveMemoryWarning:) name:UIApplicationDidReceiveMemoryWarningNotification object:nil]; +#endif + } + return self; +} + +- (void)updateIncrementalData:(NSData *)data finished:(BOOL)finished { + if (_finished) { + return; + } + _imageData = data; + _finished = finished; + + // The following code is from http://www.cocoaintheshell.com/2011/05/progressive-images-download-imageio/ + // Thanks to the author @Nyx0uf + + // Update the data source, we must pass ALL the data, not just the new bytes + CGImageSourceUpdateData(_imageSource, (__bridge CFDataRef)data, finished); + + if (_width + _height == 0) { + NSDictionary *options = @{ + (__bridge NSString *)kCGImageSourceShouldCacheImmediately : @(YES), + (__bridge NSString *)kCGImageSourceShouldCache : @(YES) // Always cache to reduce CPU usage + }; + CFDictionaryRef properties = CGImageSourceCopyPropertiesAtIndex(_imageSource, 0, (__bridge CFDictionaryRef)options); + if (properties) { + CFTypeRef val = CFDictionaryGetValue(properties, kCGImagePropertyPixelHeight); + if (val) CFNumberGetValue(val, kCFNumberLongType, &_height); + val = CFDictionaryGetValue(properties, kCGImagePropertyPixelWidth); + if (val) CFNumberGetValue(val, kCFNumberLongType, &_width); + CFRelease(properties); + } + } + + // For animated image progressive decoding because the frame count and duration may be changed. + [self scanAndCheckFramesValidWithImageSource:_imageSource]; +} + +- (UIImage *)incrementalDecodedImageWithOptions:(SDImageCoderOptions *)options { + UIImage *image; + + if (_width + _height > 0) { + // Create the image + CGFloat scale = _scale; + NSNumber *scaleFactor = options[SDImageCoderDecodeScaleFactor]; + if (scaleFactor != nil) { + scale = MAX([scaleFactor doubleValue], 1); + } + image = [self.class createFrameAtIndex:0 source:_imageSource scale:scale preserveAspectRatio:_preserveAspectRatio thumbnailSize:_thumbnailSize options:nil]; + if (image) { + image.sd_imageFormat = self.class.imageFormat; + } + } + + return image; +} + +#pragma mark - Encode +- (BOOL)canEncodeToFormat:(SDImageFormat)format { + return (format == self.class.imageFormat); +} + +- (NSData *)encodedDataWithImage:(UIImage *)image format:(SDImageFormat)format options:(nullable SDImageCoderOptions *)options { + if (!image) { + return nil; + } + CGImageRef imageRef = image.CGImage; + if (!imageRef) { + // Earily return, supports CGImage only + return nil; + } + + if (format != self.class.imageFormat) { + return nil; + } + + NSMutableData *imageData = [NSMutableData data]; + CFStringRef imageUTType = [NSData sd_UTTypeFromImageFormat:format]; + NSArray *frames = [SDImageCoderHelper framesFromAnimatedImage:image]; + + // Create an image destination. Animated Image does not support EXIF image orientation TODO + // The `CGImageDestinationCreateWithData` will log a warning when count is 0, use 1 instead. + CGImageDestinationRef imageDestination = CGImageDestinationCreateWithData((__bridge CFMutableDataRef)imageData, imageUTType, frames.count ?: 1, NULL); + if (!imageDestination) { + // Handle failure. + return nil; + } + NSMutableDictionary *properties = [NSMutableDictionary dictionary]; + // Encoding Options + double compressionQuality = 1; + if (options[SDImageCoderEncodeCompressionQuality]) { + compressionQuality = [options[SDImageCoderEncodeCompressionQuality] doubleValue]; + } + properties[(__bridge NSString *)kCGImageDestinationLossyCompressionQuality] = @(compressionQuality); + CGColorRef backgroundColor = [options[SDImageCoderEncodeBackgroundColor] CGColor]; + if (backgroundColor) { + properties[(__bridge NSString *)kCGImageDestinationBackgroundColor] = (__bridge id)(backgroundColor); + } + CGSize maxPixelSize = CGSizeZero; + NSValue *maxPixelSizeValue = options[SDImageCoderEncodeMaxPixelSize]; + if (maxPixelSizeValue != nil) { +#if SD_MAC + maxPixelSize = maxPixelSizeValue.sizeValue; +#else + maxPixelSize = maxPixelSizeValue.CGSizeValue; +#endif + } + CGFloat pixelWidth = (CGFloat)CGImageGetWidth(imageRef); + CGFloat pixelHeight = (CGFloat)CGImageGetHeight(imageRef); + CGFloat finalPixelSize = 0; + BOOL encodeFullImage = maxPixelSize.width == 0 || maxPixelSize.height == 0 || pixelWidth == 0 || pixelHeight == 0 || (pixelWidth <= maxPixelSize.width && pixelHeight <= maxPixelSize.height); + if (!encodeFullImage) { + // Thumbnail Encoding + CGFloat pixelRatio = pixelWidth / pixelHeight; + CGFloat maxPixelSizeRatio = maxPixelSize.width / maxPixelSize.height; + if (pixelRatio > maxPixelSizeRatio) { + finalPixelSize = MAX(maxPixelSize.width, maxPixelSize.width / pixelRatio); + } else { + finalPixelSize = MAX(maxPixelSize.height, maxPixelSize.height * pixelRatio); + } + properties[(__bridge NSString *)kCGImageDestinationImageMaxPixelSize] = @(finalPixelSize); + } + NSUInteger maxFileSize = [options[SDImageCoderEncodeMaxFileSize] unsignedIntegerValue]; + if (maxFileSize > 0) { + properties[kSDCGImageDestinationRequestedFileSize] = @(maxFileSize); + // Remove the quality if we have file size limit + properties[(__bridge NSString *)kCGImageDestinationLossyCompressionQuality] = nil; + } + BOOL embedThumbnail = NO; + if (options[SDImageCoderEncodeEmbedThumbnail]) { + embedThumbnail = [options[SDImageCoderEncodeEmbedThumbnail] boolValue]; + } + properties[(__bridge NSString *)kCGImageDestinationEmbedThumbnail] = @(embedThumbnail); + + BOOL encodeFirstFrame = [options[SDImageCoderEncodeFirstFrameOnly] boolValue]; + if (encodeFirstFrame || frames.count == 0) { + // for static single images + CGImageDestinationAddImage(imageDestination, imageRef, (__bridge CFDictionaryRef)properties); + } else { + // for animated images + NSUInteger loopCount = image.sd_imageLoopCount; + NSDictionary *containerProperties = @{ + self.class.dictionaryProperty: @{self.class.loopCountProperty : @(loopCount)} + }; + // container level properties (applies for `CGImageDestinationSetProperties`, not individual frames) + CGImageDestinationSetProperties(imageDestination, (__bridge CFDictionaryRef)containerProperties); + + for (size_t i = 0; i < frames.count; i++) { + SDImageFrame *frame = frames[i]; + NSTimeInterval frameDuration = frame.duration; + CGImageRef frameImageRef = frame.image.CGImage; + properties[self.class.dictionaryProperty] = @{self.class.delayTimeProperty : @(frameDuration)}; + CGImageDestinationAddImage(imageDestination, frameImageRef, (__bridge CFDictionaryRef)properties); + } + } + // Finalize the destination. + if (CGImageDestinationFinalize(imageDestination) == NO) { + // Handle failure. + imageData = nil; + } + + CFRelease(imageDestination); + + return [imageData copy]; +} + +#pragma mark - SDAnimatedImageCoder +- (nullable instancetype)initWithAnimatedImageData:(nullable NSData *)data options:(nullable SDImageCoderOptions *)options { + if (!data) { + return nil; + } + self = [super init]; + if (self) { + CGImageSourceRef imageSource = CGImageSourceCreateWithData((__bridge CFDataRef)data, NULL); + if (!imageSource) { + return nil; + } + BOOL framesValid = [self scanAndCheckFramesValidWithImageSource:imageSource]; + if (!framesValid) { + CFRelease(imageSource); + return nil; + } + CGFloat scale = 1; + NSNumber *scaleFactor = options[SDImageCoderDecodeScaleFactor]; + if (scaleFactor != nil) { + scale = MAX([scaleFactor doubleValue], 1); + } + _scale = scale; + CGSize thumbnailSize = CGSizeZero; + NSValue *thumbnailSizeValue = options[SDImageCoderDecodeThumbnailPixelSize]; + if (thumbnailSizeValue != nil) { + #if SD_MAC + thumbnailSize = thumbnailSizeValue.sizeValue; + #else + thumbnailSize = thumbnailSizeValue.CGSizeValue; + #endif + } + _thumbnailSize = thumbnailSize; + BOOL preserveAspectRatio = YES; + NSNumber *preserveAspectRatioValue = options[SDImageCoderDecodePreserveAspectRatio]; + if (preserveAspectRatioValue != nil) { + preserveAspectRatio = preserveAspectRatioValue.boolValue; + } + _preserveAspectRatio = preserveAspectRatio; + _imageSource = imageSource; + _imageData = data; +#if SD_UIKIT + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didReceiveMemoryWarning:) name:UIApplicationDidReceiveMemoryWarningNotification object:nil]; +#endif + } + return self; +} + +- (BOOL)scanAndCheckFramesValidWithImageSource:(CGImageSourceRef)imageSource { + if (!imageSource) { + return NO; + } + NSUInteger frameCount = CGImageSourceGetCount(imageSource); + NSUInteger loopCount = [self.class imageLoopCountWithSource:imageSource]; + NSMutableArray *frames = [NSMutableArray array]; + + for (size_t i = 0; i < frameCount; i++) { + SDImageIOCoderFrame *frame = [[SDImageIOCoderFrame alloc] init]; + frame.index = i; + frame.duration = [self.class frameDurationAtIndex:i source:imageSource]; + [frames addObject:frame]; + } + + _frameCount = frameCount; + _loopCount = loopCount; + _frames = [frames copy]; + + return YES; +} + +- (NSData *)animatedImageData { + return _imageData; +} + +- (NSUInteger)animatedImageLoopCount { + return _loopCount; +} + +- (NSUInteger)animatedImageFrameCount { + return _frameCount; +} + +- (NSTimeInterval)animatedImageDurationAtIndex:(NSUInteger)index { + if (index >= _frameCount) { + return 0; + } + return _frames[index].duration; +} + +- (UIImage *)animatedImageFrameAtIndex:(NSUInteger)index { + if (index >= _frameCount) { + return nil; + } + // Animated Image should not use the CGContext solution to force decode. Prefers to use Image/IO built in method, which is safer and memory friendly, see https://github.com/SDWebImage/SDWebImage/issues/2961 + NSDictionary *options = @{ + (__bridge NSString *)kCGImageSourceShouldCacheImmediately : @(YES), + (__bridge NSString *)kCGImageSourceShouldCache : @(YES) // Always cache to reduce CPU usage + }; + UIImage *image = [self.class createFrameAtIndex:index source:_imageSource scale:_scale preserveAspectRatio:_preserveAspectRatio thumbnailSize:_thumbnailSize options:options]; + if (!image) { + return nil; + } + image.sd_imageFormat = self.class.imageFormat; + image.sd_isDecoded = YES; + return image; +} + +@end + diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageIOCoder.h b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageIOCoder.h new file mode 100644 index 0000000..98682ed --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageIOCoder.h @@ -0,0 +1,30 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import +#import "SDImageCoder.h" + +/** + Built in coder that supports PNG, JPEG, TIFF, includes support for progressive decoding. + + GIF + Also supports static GIF (meaning will only handle the 1st frame). + For a full GIF support, we recommend `SDAnimatedImageView` to keep both CPU and memory balanced. + + HEIC + This coder also supports HEIC format because ImageIO supports it natively. But it depends on the system capabilities, so it won't work on all devices, see: https://devstreaming-cdn.apple.com/videos/wwdc/2017/511tj33587vdhds/511/511_working_with_heif_and_hevc.pdf + Decode(Software): !Simulator && (iOS 11 || tvOS 11 || macOS 10.13) + Decode(Hardware): !Simulator && ((iOS 11 && A9Chip) || (macOS 10.13 && 6thGenerationIntelCPU)) + Encode(Software): macOS 10.13 + Encode(Hardware): !Simulator && ((iOS 11 && A10FusionChip) || (macOS 10.13 && 6thGenerationIntelCPU)) + */ +@interface SDImageIOCoder : NSObject + +@property (nonatomic, class, readonly, nonnull) SDImageIOCoder *sharedCoder; + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageIOCoder.m b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageIOCoder.m new file mode 100644 index 0000000..42f7084 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageIOCoder.m @@ -0,0 +1,347 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDImageIOCoder.h" +#import "SDImageCoderHelper.h" +#import "NSImage+Compatibility.h" +#import +#import "UIImage+Metadata.h" +#import "SDImageIOAnimatedCoderInternal.h" + +// Specify DPI for vector format in CGImageSource, like PDF +static NSString * kSDCGImageSourceRasterizationDPI = @"kCGImageSourceRasterizationDPI"; +// Specify File Size for lossy format encoding, like JPEG +static NSString * kSDCGImageDestinationRequestedFileSize = @"kCGImageDestinationRequestedFileSize"; + +@implementation SDImageIOCoder { + size_t _width, _height; + CGImagePropertyOrientation _orientation; + CGImageSourceRef _imageSource; + CGFloat _scale; + BOOL _finished; + BOOL _preserveAspectRatio; + CGSize _thumbnailSize; +} + +- (void)dealloc { + if (_imageSource) { + CFRelease(_imageSource); + _imageSource = NULL; + } +#if SD_UIKIT + [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidReceiveMemoryWarningNotification object:nil]; +#endif +} + +- (void)didReceiveMemoryWarning:(NSNotification *)notification +{ + if (_imageSource) { + CGImageSourceRemoveCacheAtIndex(_imageSource, 0); + } +} + ++ (instancetype)sharedCoder { + static SDImageIOCoder *coder; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + coder = [[SDImageIOCoder alloc] init]; + }); + return coder; +} + +#pragma mark - Utils ++ (CGRect)boxRectFromPDFFData:(nonnull NSData *)data { + CGDataProviderRef provider = CGDataProviderCreateWithCFData((__bridge CFDataRef)data); + if (!provider) { + return CGRectZero; + } + CGPDFDocumentRef document = CGPDFDocumentCreateWithProvider(provider); + CGDataProviderRelease(provider); + if (!document) { + return CGRectZero; + } + + // `CGPDFDocumentGetPage` page number is 1-indexed. + CGPDFPageRef page = CGPDFDocumentGetPage(document, 1); + if (!page) { + CGPDFDocumentRelease(document); + return CGRectZero; + } + + CGRect boxRect = CGPDFPageGetBoxRect(page, kCGPDFMediaBox); + CGPDFDocumentRelease(document); + + return boxRect; +} + +#pragma mark - Decode +- (BOOL)canDecodeFromData:(nullable NSData *)data { + return YES; +} + +- (UIImage *)decodedImageWithData:(NSData *)data options:(nullable SDImageCoderOptions *)options { + if (!data) { + return nil; + } + CGFloat scale = 1; + NSNumber *scaleFactor = options[SDImageCoderDecodeScaleFactor]; + if (scaleFactor != nil) { + scale = MAX([scaleFactor doubleValue], 1) ; + } + + CGSize thumbnailSize = CGSizeZero; + NSValue *thumbnailSizeValue = options[SDImageCoderDecodeThumbnailPixelSize]; + if (thumbnailSizeValue != nil) { +#if SD_MAC + thumbnailSize = thumbnailSizeValue.sizeValue; +#else + thumbnailSize = thumbnailSizeValue.CGSizeValue; +#endif + } + + BOOL preserveAspectRatio = YES; + NSNumber *preserveAspectRatioValue = options[SDImageCoderDecodePreserveAspectRatio]; + if (preserveAspectRatioValue != nil) { + preserveAspectRatio = preserveAspectRatioValue.boolValue; + } + + CGImageSourceRef source = CGImageSourceCreateWithData((__bridge CFDataRef)data, NULL); + if (!source) { + return nil; + } + + CFStringRef uttype = CGImageSourceGetType(source); + SDImageFormat imageFormat = [NSData sd_imageFormatFromUTType:uttype]; + // Check vector format + NSDictionary *decodingOptions = nil; + if (imageFormat == SDImageFormatPDF) { + // Use 72 DPI (1:1 inch to pixel) by default, matching Apple's PDFKit behavior + NSUInteger rasterizationDPI = 72; + CGFloat maxPixelSize = MAX(thumbnailSize.width, thumbnailSize.height); + if (maxPixelSize > 0) { + // Calculate DPI based on PDF box and pixel size + CGRect boxRect = [self.class boxRectFromPDFFData:data]; + CGFloat maxBoxSize = MAX(boxRect.size.width, boxRect.size.height); + if (maxBoxSize > 0) { + rasterizationDPI = rasterizationDPI * (maxPixelSize / maxBoxSize); + } + } + decodingOptions = @{ + // This option will cause ImageIO return the pixel size from `CGImageSourceCopyProperties` + // If not provided, it always return 0 size + kSDCGImageSourceRasterizationDPI : @(rasterizationDPI), + }; + // Already calculated DPI, avoid re-calculation based on thumbnail information + preserveAspectRatio = YES; + thumbnailSize = CGSizeZero; + } + + UIImage *image = [SDImageIOAnimatedCoder createFrameAtIndex:0 source:source scale:scale preserveAspectRatio:preserveAspectRatio thumbnailSize:thumbnailSize options:decodingOptions]; + CFRelease(source); + if (!image) { + return nil; + } + + image.sd_imageFormat = imageFormat; + return image; +} + +#pragma mark - Progressive Decode + +- (BOOL)canIncrementalDecodeFromData:(NSData *)data { + return [self canDecodeFromData:data]; +} + +- (instancetype)initIncrementalWithOptions:(nullable SDImageCoderOptions *)options { + self = [super init]; + if (self) { + _imageSource = CGImageSourceCreateIncremental(NULL); + CGFloat scale = 1; + NSNumber *scaleFactor = options[SDImageCoderDecodeScaleFactor]; + if (scaleFactor != nil) { + scale = MAX([scaleFactor doubleValue], 1); + } + _scale = scale; + CGSize thumbnailSize = CGSizeZero; + NSValue *thumbnailSizeValue = options[SDImageCoderDecodeThumbnailPixelSize]; + if (thumbnailSizeValue != nil) { + #if SD_MAC + thumbnailSize = thumbnailSizeValue.sizeValue; + #else + thumbnailSize = thumbnailSizeValue.CGSizeValue; + #endif + } + _thumbnailSize = thumbnailSize; + BOOL preserveAspectRatio = YES; + NSNumber *preserveAspectRatioValue = options[SDImageCoderDecodePreserveAspectRatio]; + if (preserveAspectRatioValue != nil) { + preserveAspectRatio = preserveAspectRatioValue.boolValue; + } + _preserveAspectRatio = preserveAspectRatio; +#if SD_UIKIT + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didReceiveMemoryWarning:) name:UIApplicationDidReceiveMemoryWarningNotification object:nil]; +#endif + } + return self; +} + +- (void)updateIncrementalData:(NSData *)data finished:(BOOL)finished { + if (_finished) { + return; + } + _finished = finished; + + // The following code is from http://www.cocoaintheshell.com/2011/05/progressive-images-download-imageio/ + // Thanks to the author @Nyx0uf + + // Update the data source, we must pass ALL the data, not just the new bytes + CGImageSourceUpdateData(_imageSource, (__bridge CFDataRef)data, finished); + + if (_width + _height == 0) { + CFDictionaryRef properties = CGImageSourceCopyPropertiesAtIndex(_imageSource, 0, NULL); + if (properties) { + NSInteger orientationValue = 1; + CFTypeRef val = CFDictionaryGetValue(properties, kCGImagePropertyPixelHeight); + if (val) CFNumberGetValue(val, kCFNumberLongType, &_height); + val = CFDictionaryGetValue(properties, kCGImagePropertyPixelWidth); + if (val) CFNumberGetValue(val, kCFNumberLongType, &_width); + val = CFDictionaryGetValue(properties, kCGImagePropertyOrientation); + if (val) CFNumberGetValue(val, kCFNumberNSIntegerType, &orientationValue); + CFRelease(properties); + + // When we draw to Core Graphics, we lose orientation information, + // which means the image below born of initWithCGIImage will be + // oriented incorrectly sometimes. (Unlike the image born of initWithData + // in didCompleteWithError.) So save it here and pass it on later. + _orientation = (CGImagePropertyOrientation)orientationValue; + } + } +} + +- (UIImage *)incrementalDecodedImageWithOptions:(SDImageCoderOptions *)options { + UIImage *image; + + if (_width + _height > 0) { + // Create the image + CGFloat scale = _scale; + NSNumber *scaleFactor = options[SDImageCoderDecodeScaleFactor]; + if (scaleFactor != nil) { + scale = MAX([scaleFactor doubleValue], 1); + } + image = [SDImageIOAnimatedCoder createFrameAtIndex:0 source:_imageSource scale:scale preserveAspectRatio:_preserveAspectRatio thumbnailSize:_thumbnailSize options:nil]; + if (image) { + CFStringRef uttype = CGImageSourceGetType(_imageSource); + image.sd_imageFormat = [NSData sd_imageFormatFromUTType:uttype]; + } + } + + return image; +} + +#pragma mark - Encode +- (BOOL)canEncodeToFormat:(SDImageFormat)format { + return YES; +} + +- (NSData *)encodedDataWithImage:(UIImage *)image format:(SDImageFormat)format options:(nullable SDImageCoderOptions *)options { + if (!image) { + return nil; + } + CGImageRef imageRef = image.CGImage; + if (!imageRef) { + // Earily return, supports CGImage only + return nil; + } + + if (format == SDImageFormatUndefined) { + BOOL hasAlpha = [SDImageCoderHelper CGImageContainsAlpha:imageRef]; + if (hasAlpha) { + format = SDImageFormatPNG; + } else { + format = SDImageFormatJPEG; + } + } + + NSMutableData *imageData = [NSMutableData data]; + CFStringRef imageUTType = [NSData sd_UTTypeFromImageFormat:format]; + + // Create an image destination. + CGImageDestinationRef imageDestination = CGImageDestinationCreateWithData((__bridge CFMutableDataRef)imageData, imageUTType, 1, NULL); + if (!imageDestination) { + // Handle failure. + return nil; + } + + NSMutableDictionary *properties = [NSMutableDictionary dictionary]; +#if SD_UIKIT || SD_WATCH + CGImagePropertyOrientation exifOrientation = [SDImageCoderHelper exifOrientationFromImageOrientation:image.imageOrientation]; +#else + CGImagePropertyOrientation exifOrientation = kCGImagePropertyOrientationUp; +#endif + properties[(__bridge NSString *)kCGImagePropertyOrientation] = @(exifOrientation); + // Encoding Options + double compressionQuality = 1; + if (options[SDImageCoderEncodeCompressionQuality]) { + compressionQuality = [options[SDImageCoderEncodeCompressionQuality] doubleValue]; + } + properties[(__bridge NSString *)kCGImageDestinationLossyCompressionQuality] = @(compressionQuality); + CGColorRef backgroundColor = [options[SDImageCoderEncodeBackgroundColor] CGColor]; + if (backgroundColor) { + properties[(__bridge NSString *)kCGImageDestinationBackgroundColor] = (__bridge id)(backgroundColor); + } + CGSize maxPixelSize = CGSizeZero; + NSValue *maxPixelSizeValue = options[SDImageCoderEncodeMaxPixelSize]; + if (maxPixelSizeValue != nil) { +#if SD_MAC + maxPixelSize = maxPixelSizeValue.sizeValue; +#else + maxPixelSize = maxPixelSizeValue.CGSizeValue; +#endif + } + CGFloat pixelWidth = (CGFloat)CGImageGetWidth(imageRef); + CGFloat pixelHeight = (CGFloat)CGImageGetHeight(imageRef); + CGFloat finalPixelSize = 0; + BOOL encodeFullImage = maxPixelSize.width == 0 || maxPixelSize.height == 0 || pixelWidth == 0 || pixelHeight == 0 || (pixelWidth <= maxPixelSize.width && pixelHeight <= maxPixelSize.height); + if (!encodeFullImage) { + // Thumbnail Encoding + CGFloat pixelRatio = pixelWidth / pixelHeight; + CGFloat maxPixelSizeRatio = maxPixelSize.width / maxPixelSize.height; + if (pixelRatio > maxPixelSizeRatio) { + finalPixelSize = MAX(maxPixelSize.width, maxPixelSize.width / pixelRatio); + } else { + finalPixelSize = MAX(maxPixelSize.height, maxPixelSize.height * pixelRatio); + } + properties[(__bridge NSString *)kCGImageDestinationImageMaxPixelSize] = @(finalPixelSize); + } + NSUInteger maxFileSize = [options[SDImageCoderEncodeMaxFileSize] unsignedIntegerValue]; + if (maxFileSize > 0) { + properties[kSDCGImageDestinationRequestedFileSize] = @(maxFileSize); + // Remove the quality if we have file size limit + properties[(__bridge NSString *)kCGImageDestinationLossyCompressionQuality] = nil; + } + BOOL embedThumbnail = NO; + if (options[SDImageCoderEncodeEmbedThumbnail]) { + embedThumbnail = [options[SDImageCoderEncodeEmbedThumbnail] boolValue]; + } + properties[(__bridge NSString *)kCGImageDestinationEmbedThumbnail] = @(embedThumbnail); + + // Add your image to the destination. + CGImageDestinationAddImage(imageDestination, imageRef, (__bridge CFDictionaryRef)properties); + + // Finalize the destination. + if (CGImageDestinationFinalize(imageDestination) == NO) { + // Handle failure. + imageData = nil; + } + + CFRelease(imageDestination); + + return [imageData copy]; +} + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageLoader.h b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageLoader.h new file mode 100644 index 0000000..addad83 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageLoader.h @@ -0,0 +1,146 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageCompat.h" +#import "SDWebImageDefine.h" +#import "SDWebImageOperation.h" +#import "SDImageCoder.h" + +typedef void(^SDImageLoaderProgressBlock)(NSInteger receivedSize, NSInteger expectedSize, NSURL * _Nullable targetURL); +typedef void(^SDImageLoaderCompletedBlock)(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, BOOL finished); + +#pragma mark - Context Options + +/** + A `UIImage` instance from `SDWebImageManager` when you specify `SDWebImageRefreshCached` and image cache hit. + This can be a hint for image loader to load the image from network and refresh the image from remote location if needed. If the image from remote location does not change, you should call the completion with `SDWebImageErrorCacheNotModified` error. (UIImage) + @note If you don't implement `SDWebImageRefreshCached` support, you do not need to care about this context option. + */ +FOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextLoaderCachedImage; + +#pragma mark - Helper method + +/** + This is the built-in decoding process for image download from network or local file. + @note If you want to implement your custom loader with `requestImageWithURL:options:context:progress:completed:` API, but also want to keep compatible with SDWebImage's behavior, you'd better use this to produce image. + + @param imageData The image data from the network. Should not be nil + @param imageURL The image URL from the input. Should not be nil + @param options The options arg from the input + @param context The context arg from the input + @return The decoded image for current image data load from the network + */ +FOUNDATION_EXPORT UIImage * _Nullable SDImageLoaderDecodeImageData(NSData * _Nonnull imageData, NSURL * _Nonnull imageURL, SDWebImageOptions options, SDWebImageContext * _Nullable context); + +/** + This is the built-in decoding process for image progressive download from network. It's used when `SDWebImageProgressiveLoad` option is set. (It's not required when your loader does not support progressive image loading) + @note If you want to implement your custom loader with `requestImageWithURL:options:context:progress:completed:` API, but also want to keep compatible with SDWebImage's behavior, you'd better use this to produce image. + + @param imageData The image data from the network so far. Should not be nil + @param imageURL The image URL from the input. Should not be nil + @param finished Pass NO to specify the download process has not finished. Pass YES when all image data has finished. + @param operation The loader operation associated with current progressive download. Why to provide this is because progressive decoding need to store the partial decoded context for each operation to avoid conflict. You should provide the operation from `loadImageWithURL:` method return value. + @param options The options arg from the input + @param context The context arg from the input + @return The decoded progressive image for current image data load from the network + */ +FOUNDATION_EXPORT UIImage * _Nullable SDImageLoaderDecodeProgressiveImageData(NSData * _Nonnull imageData, NSURL * _Nonnull imageURL, BOOL finished, id _Nonnull operation, SDWebImageOptions options, SDWebImageContext * _Nullable context); + +/** + This function get the progressive decoder for current loading operation. If no progressive decoding is happended or decoder is not able to construct, return nil. + @return The progressive decoder associated with the loading operation. + */ +FOUNDATION_EXPORT id _Nullable SDImageLoaderGetProgressiveCoder(id _Nonnull operation); + +/** + This function set the progressive decoder for current loading operation. If no progressive decoding is happended, pass nil. + @param operation The loading operation to associate the progerssive decoder. + */ +FOUNDATION_EXPORT void SDImageLoaderSetProgressiveCoder(id _Nonnull operation, id _Nullable progressiveCoder); + +#pragma mark - SDImageLoader + +/** + This is the protocol to specify custom image load process. You can create your own class to conform this protocol and use as a image loader to load image from network or any available remote resources defined by yourself. + If you want to implement custom loader for image download from network or local file, you just need to concentrate on image data download only. After the download finish, call `SDImageLoaderDecodeImageData` or `SDImageLoaderDecodeProgressiveImageData` to use the built-in decoding process and produce image (Remember to call in the global queue). And finally callback the completion block. + If you directly get the image instance using some third-party SDKs, such as image directly from Photos framework. You can process the image data and image instance by yourself without that built-in decoding process. And finally callback the completion block. + @note It's your responsibility to load the image in the desired global queue(to avoid block main queue). We do not dispatch these method call in a global queue but just from the call queue (For `SDWebImageManager`, it typically call from the main queue). +*/ +@protocol SDImageLoader + +@required +/** + Whether current image loader supports to load the provide image URL. + This will be checked every time a new image request come for loader. If this return NO, we will mark this image load as failed. If return YES, we will start to call `requestImageWithURL:options:context:progress:completed:`. + + @param url The image URL to be loaded. + @return YES to continue download, NO to stop download. + */ +- (BOOL)canRequestImageForURL:(nullable NSURL *)url API_DEPRECATED("Use canRequestImageForURL:options:context: instead", macos(10.10, API_TO_BE_DEPRECATED), ios(8.0, API_TO_BE_DEPRECATED), tvos(9.0, API_TO_BE_DEPRECATED), watchos(2.0, API_TO_BE_DEPRECATED)); + +@optional +/** + Whether current image loader supports to load the provide image URL, with associated options and context. + This will be checked every time a new image request come for loader. If this return NO, we will mark this image load as failed. If return YES, we will start to call `requestImageWithURL:options:context:progress:completed:`. + + @param url The image URL to be loaded. + @param options A mask to specify options to use for this request + @param context A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold. + @return YES to continue download, NO to stop download. + */ +- (BOOL)canRequestImageForURL:(nullable NSURL *)url + options:(SDWebImageOptions)options + context:(nullable SDWebImageContext *)context; + +@required +/** + Load the image and image data with the given URL and return the image data. You're responsible for producing the image instance. + + @param url The URL represent the image. Note this may not be a HTTP URL + @param options A mask to specify options to use for this request + @param context A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold. + @param progressBlock A block called while image is downloading + * @note the progress block is executed on a background queue + @param completedBlock A block called when operation has been completed. + @return An operation which allow the user to cancel the current request. + */ +- (nullable id)requestImageWithURL:(nullable NSURL *)url + options:(SDWebImageOptions)options + context:(nullable SDWebImageContext *)context + progress:(nullable SDImageLoaderProgressBlock)progressBlock + completed:(nullable SDImageLoaderCompletedBlock)completedBlock; + + +/** + Whether the error from image loader should be marked indeed un-recoverable or not. + If this return YES, failed URL which does not using `SDWebImageRetryFailed` will be blocked into black list. Else not. + + @param url The URL represent the image. Note this may not be a HTTP URL + @param error The URL's loading error, from previous `requestImageWithURL:options:context:progress:completed:` completedBlock's error. + @return Whether to block this url or not. Return YES to mark this URL as failed. + */ +- (BOOL)shouldBlockFailedURLWithURL:(nonnull NSURL *)url + error:(nonnull NSError *)error API_DEPRECATED("Use shouldBlockFailedURLWithURL:error:options:context: instead", macos(10.10, API_TO_BE_DEPRECATED), ios(8.0, API_TO_BE_DEPRECATED), tvos(9.0, API_TO_BE_DEPRECATED), watchos(2.0, API_TO_BE_DEPRECATED)); + +@optional +/** + Whether the error from image loader should be marked indeed un-recoverable or not, with associated options and context. + If this return YES, failed URL which does not using `SDWebImageRetryFailed` will be blocked into black list. Else not. + + @param url The URL represent the image. Note this may not be a HTTP URL + @param error The URL's loading error, from previous `requestImageWithURL:options:context:progress:completed:` completedBlock's error. + @param options A mask to specify options to use for this request + @param context A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold. + @return Whether to block this url or not. Return YES to mark this URL as failed. + */ +- (BOOL)shouldBlockFailedURLWithURL:(nonnull NSURL *)url + error:(nonnull NSError *)error + options:(SDWebImageOptions)options + context:(nullable SDWebImageContext *)context; + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageLoader.m b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageLoader.m new file mode 100644 index 0000000..77d3073 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageLoader.m @@ -0,0 +1,196 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDImageLoader.h" +#import "SDWebImageCacheKeyFilter.h" +#import "SDImageCodersManager.h" +#import "SDImageCoderHelper.h" +#import "SDAnimatedImage.h" +#import "UIImage+Metadata.h" +#import "SDInternalMacros.h" +#import "SDImageCacheDefine.h" +#import "objc/runtime.h" + +SDWebImageContextOption const SDWebImageContextLoaderCachedImage = @"loaderCachedImage"; + +static void * SDImageLoaderProgressiveCoderKey = &SDImageLoaderProgressiveCoderKey; + +id SDImageLoaderGetProgressiveCoder(id operation) { + NSCParameterAssert(operation); + return objc_getAssociatedObject(operation, SDImageLoaderProgressiveCoderKey); +} + +void SDImageLoaderSetProgressiveCoder(id operation, id progressiveCoder) { + NSCParameterAssert(operation); + objc_setAssociatedObject(operation, SDImageLoaderProgressiveCoderKey, progressiveCoder, OBJC_ASSOCIATION_RETAIN_NONATOMIC); +} + +UIImage * _Nullable SDImageLoaderDecodeImageData(NSData * _Nonnull imageData, NSURL * _Nonnull imageURL, SDWebImageOptions options, SDWebImageContext * _Nullable context) { + NSCParameterAssert(imageData); + NSCParameterAssert(imageURL); + + UIImage *image; + id cacheKeyFilter = context[SDWebImageContextCacheKeyFilter]; + NSString *cacheKey; + if (cacheKeyFilter) { + cacheKey = [cacheKeyFilter cacheKeyForURL:imageURL]; + } else { + cacheKey = imageURL.absoluteString; + } + SDImageCoderOptions *coderOptions = SDGetDecodeOptionsFromContext(context, options, cacheKey); + BOOL decodeFirstFrame = SD_OPTIONS_CONTAINS(options, SDWebImageDecodeFirstFrameOnly); + CGFloat scale = [coderOptions[SDImageCoderDecodeScaleFactor] doubleValue]; + + // Grab the image coder + id imageCoder; + if ([context[SDWebImageContextImageCoder] conformsToProtocol:@protocol(SDImageCoder)]) { + imageCoder = context[SDWebImageContextImageCoder]; + } else { + imageCoder = [SDImageCodersManager sharedManager]; + } + + if (!decodeFirstFrame) { + // check whether we should use `SDAnimatedImage` + Class animatedImageClass = context[SDWebImageContextAnimatedImageClass]; + if ([animatedImageClass isSubclassOfClass:[UIImage class]] && [animatedImageClass conformsToProtocol:@protocol(SDAnimatedImage)]) { + image = [[animatedImageClass alloc] initWithData:imageData scale:scale options:coderOptions]; + if (image) { + // Preload frames if supported + if (options & SDWebImagePreloadAllFrames && [image respondsToSelector:@selector(preloadAllFrames)]) { + [((id)image) preloadAllFrames]; + } + } else { + // Check image class matching + if (options & SDWebImageMatchAnimatedImageClass) { + return nil; + } + } + } + } + if (!image) { + image = [imageCoder decodedImageWithData:imageData options:coderOptions]; + } + if (image) { + BOOL shouldDecode = !SD_OPTIONS_CONTAINS(options, SDWebImageAvoidDecodeImage); + if ([image.class conformsToProtocol:@protocol(SDAnimatedImage)]) { + // `SDAnimatedImage` do not decode + shouldDecode = NO; + } else if (image.sd_isAnimated) { + // animated image do not decode + shouldDecode = NO; + } + + if (shouldDecode) { + image = [SDImageCoderHelper decodedImageWithImage:image]; + } + // assign the decode options, to let manager check whether to re-decode if needed + image.sd_decodeOptions = coderOptions; + } + + return image; +} + +UIImage * _Nullable SDImageLoaderDecodeProgressiveImageData(NSData * _Nonnull imageData, NSURL * _Nonnull imageURL, BOOL finished, id _Nonnull operation, SDWebImageOptions options, SDWebImageContext * _Nullable context) { + NSCParameterAssert(imageData); + NSCParameterAssert(imageURL); + NSCParameterAssert(operation); + + UIImage *image; + id cacheKeyFilter = context[SDWebImageContextCacheKeyFilter]; + NSString *cacheKey; + if (cacheKeyFilter) { + cacheKey = [cacheKeyFilter cacheKeyForURL:imageURL]; + } else { + cacheKey = imageURL.absoluteString; + } + BOOL decodeFirstFrame = SD_OPTIONS_CONTAINS(options, SDWebImageDecodeFirstFrameOnly); + NSNumber *scaleValue = context[SDWebImageContextImageScaleFactor]; + CGFloat scale = scaleValue.doubleValue >= 1 ? scaleValue.doubleValue : SDImageScaleFactorForKey(cacheKey); + NSNumber *preserveAspectRatioValue = context[SDWebImageContextImagePreserveAspectRatio]; + NSValue *thumbnailSizeValue; + BOOL shouldScaleDown = SD_OPTIONS_CONTAINS(options, SDWebImageScaleDownLargeImages); + if (shouldScaleDown) { + CGFloat thumbnailPixels = SDImageCoderHelper.defaultScaleDownLimitBytes / 4; + CGFloat dimension = ceil(sqrt(thumbnailPixels)); + thumbnailSizeValue = @(CGSizeMake(dimension, dimension)); + } + if (context[SDWebImageContextImageThumbnailPixelSize]) { + thumbnailSizeValue = context[SDWebImageContextImageThumbnailPixelSize]; + } + + SDImageCoderMutableOptions *mutableCoderOptions = [NSMutableDictionary dictionaryWithCapacity:2]; + mutableCoderOptions[SDImageCoderDecodeFirstFrameOnly] = @(decodeFirstFrame); + mutableCoderOptions[SDImageCoderDecodeScaleFactor] = @(scale); + mutableCoderOptions[SDImageCoderDecodePreserveAspectRatio] = preserveAspectRatioValue; + mutableCoderOptions[SDImageCoderDecodeThumbnailPixelSize] = thumbnailSizeValue; + mutableCoderOptions[SDImageCoderWebImageContext] = context; + SDImageCoderOptions *coderOptions = [mutableCoderOptions copy]; + + // Grab the progressive image coder + id progressiveCoder = SDImageLoaderGetProgressiveCoder(operation); + if (!progressiveCoder) { + id imageCoder = context[SDWebImageContextImageCoder]; + // Check the progressive coder if provided + if ([imageCoder conformsToProtocol:@protocol(SDProgressiveImageCoder)]) { + progressiveCoder = [[[imageCoder class] alloc] initIncrementalWithOptions:coderOptions]; + } else { + // We need to create a new instance for progressive decoding to avoid conflicts + for (id coder in [SDImageCodersManager sharedManager].coders.reverseObjectEnumerator) { + if ([coder conformsToProtocol:@protocol(SDProgressiveImageCoder)] && + [((id)coder) canIncrementalDecodeFromData:imageData]) { + progressiveCoder = [[[coder class] alloc] initIncrementalWithOptions:coderOptions]; + break; + } + } + } + SDImageLoaderSetProgressiveCoder(operation, progressiveCoder); + } + // If we can't find any progressive coder, disable progressive download + if (!progressiveCoder) { + return nil; + } + + [progressiveCoder updateIncrementalData:imageData finished:finished]; + if (!decodeFirstFrame) { + // check whether we should use `SDAnimatedImage` + Class animatedImageClass = context[SDWebImageContextAnimatedImageClass]; + if ([animatedImageClass isSubclassOfClass:[UIImage class]] && [animatedImageClass conformsToProtocol:@protocol(SDAnimatedImage)] && [progressiveCoder conformsToProtocol:@protocol(SDAnimatedImageCoder)]) { + image = [[animatedImageClass alloc] initWithAnimatedCoder:(id)progressiveCoder scale:scale]; + if (image) { + // Progressive decoding does not preload frames + } else { + // Check image class matching + if (options & SDWebImageMatchAnimatedImageClass) { + return nil; + } + } + } + } + if (!image) { + image = [progressiveCoder incrementalDecodedImageWithOptions:coderOptions]; + } + if (image) { + BOOL shouldDecode = !SD_OPTIONS_CONTAINS(options, SDWebImageAvoidDecodeImage); + if ([image.class conformsToProtocol:@protocol(SDAnimatedImage)]) { + // `SDAnimatedImage` do not decode + shouldDecode = NO; + } else if (image.sd_isAnimated) { + // animated image do not decode + shouldDecode = NO; + } + if (shouldDecode) { + image = [SDImageCoderHelper decodedImageWithImage:image]; + } + // mark the image as progressive (completed one are not mark as progressive) + image.sd_isIncremental = !finished; + // assign the decode options, to let manager check whether to re-decode if needed + image.sd_decodeOptions = coderOptions; + } + + return image; +} diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageLoadersManager.h b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageLoadersManager.h new file mode 100644 index 0000000..9886f45 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageLoadersManager.h @@ -0,0 +1,40 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDImageLoader.h" + +/** + A loaders manager to manage multiple loaders + */ +@interface SDImageLoadersManager : NSObject + +/** + Returns the global shared loaders manager instance. By default we will set [`SDWebImageDownloader.sharedDownloader`] into the loaders array. + */ +@property (nonatomic, class, readonly, nonnull) SDImageLoadersManager *sharedManager; + +/** + All image loaders in manager. The loaders array is a priority queue, which means the later added loader will have the highest priority + */ +@property (nonatomic, copy, nullable) NSArray>* loaders; + +/** + Add a new image loader to the end of loaders array. Which has the highest priority. + + @param loader loader + */ +- (void)addLoader:(nonnull id)loader; + +/** + Remove an image loader in the loaders array. + + @param loader loader + */ +- (void)removeLoader:(nonnull id)loader; + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageLoadersManager.m b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageLoadersManager.m new file mode 100644 index 0000000..ac86c29 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageLoadersManager.m @@ -0,0 +1,123 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDImageLoadersManager.h" +#import "SDWebImageDownloader.h" +#import "SDInternalMacros.h" + +@interface SDImageLoadersManager () + +@property (nonatomic, strong, nonnull) NSMutableArray> *imageLoaders; + +@end + +@implementation SDImageLoadersManager { + SD_LOCK_DECLARE(_loadersLock); +} + ++ (SDImageLoadersManager *)sharedManager { + static dispatch_once_t onceToken; + static SDImageLoadersManager *manager; + dispatch_once(&onceToken, ^{ + manager = [[SDImageLoadersManager alloc] init]; + }); + return manager; +} + +- (instancetype)init { + self = [super init]; + if (self) { + // initialize with default image loaders + _imageLoaders = [NSMutableArray arrayWithObject:[SDWebImageDownloader sharedDownloader]]; + SD_LOCK_INIT(_loadersLock); + } + return self; +} + +- (NSArray> *)loaders { + SD_LOCK(_loadersLock); + NSArray>* loaders = [_imageLoaders copy]; + SD_UNLOCK(_loadersLock); + return loaders; +} + +- (void)setLoaders:(NSArray> *)loaders { + SD_LOCK(_loadersLock); + [_imageLoaders removeAllObjects]; + if (loaders.count) { + [_imageLoaders addObjectsFromArray:loaders]; + } + SD_UNLOCK(_loadersLock); +} + +#pragma mark - Loader Property + +- (void)addLoader:(id)loader { + if (![loader conformsToProtocol:@protocol(SDImageLoader)]) { + return; + } + SD_LOCK(_loadersLock); + [_imageLoaders addObject:loader]; + SD_UNLOCK(_loadersLock); +} + +- (void)removeLoader:(id)loader { + if (![loader conformsToProtocol:@protocol(SDImageLoader)]) { + return; + } + SD_LOCK(_loadersLock); + [_imageLoaders removeObject:loader]; + SD_UNLOCK(_loadersLock); +} + +#pragma mark - SDImageLoader + +- (BOOL)canRequestImageForURL:(nullable NSURL *)url { + return [self canRequestImageForURL:url options:0 context:nil]; +} + +- (BOOL)canRequestImageForURL:(NSURL *)url options:(SDWebImageOptions)options context:(SDWebImageContext *)context { + NSArray> *loaders = self.loaders; + for (id loader in loaders.reverseObjectEnumerator) { + if ([loader respondsToSelector:@selector(canRequestImageForURL:options:context:)]) { + if ([loader canRequestImageForURL:url options:options context:context]) { + return YES; + } + } else { + if ([loader canRequestImageForURL:url]) { + return YES; + } + } + } + return NO; +} + +- (id)requestImageWithURL:(NSURL *)url options:(SDWebImageOptions)options context:(SDWebImageContext *)context progress:(SDImageLoaderProgressBlock)progressBlock completed:(SDImageLoaderCompletedBlock)completedBlock { + if (!url) { + return nil; + } + NSArray> *loaders = self.loaders; + for (id loader in loaders.reverseObjectEnumerator) { + if ([loader canRequestImageForURL:url]) { + return [loader requestImageWithURL:url options:options context:context progress:progressBlock completed:completedBlock]; + } + } + return nil; +} + +- (BOOL)shouldBlockFailedURLWithURL:(NSURL *)url error:(NSError *)error { + NSArray> *loaders = self.loaders; + for (id loader in loaders.reverseObjectEnumerator) { + if ([loader canRequestImageForURL:url]) { + return [loader shouldBlockFailedURLWithURL:url error:error]; + } + } + return NO; +} + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageTransformer.h b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageTransformer.h new file mode 100644 index 0000000..3031bfe --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageTransformer.h @@ -0,0 +1,241 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageCompat.h" +#import "UIImage+Transform.h" + +/** + Return the transformed cache key which applied with specify transformerKey. + + @param key The original cache key + @param transformerKey The transformer key from the transformer + @return The transformed cache key + */ +FOUNDATION_EXPORT NSString * _Nullable SDTransformedKeyForKey(NSString * _Nullable key, NSString * _Nonnull transformerKey); + +/** + Return the thumbnailed cache key which applied with specify thumbnailSize and preserveAspectRatio control. + @param key The original cache key + @param thumbnailPixelSize The thumbnail pixel size + @param preserveAspectRatio The preserve aspect ratio option + @return The thumbnailed cache key + @note If you have both transformer and thumbnail applied for image, call `SDThumbnailedKeyForKey` firstly and then with `SDTransformedKeyForKey`.` + */ +FOUNDATION_EXPORT NSString * _Nullable SDThumbnailedKeyForKey(NSString * _Nullable key, CGSize thumbnailPixelSize, BOOL preserveAspectRatio); + +/** + A transformer protocol to transform the image load from cache or from download. + You can provide transformer to cache and manager (Through the `transformer` property or context option `SDWebImageContextImageTransformer`). + + @note The transform process is called from a global queue in order to not to block the main queue. + */ +@protocol SDImageTransformer + +@required +/** + For each transformer, it must contains its cache key to used to store the image cache or query from the cache. This key will be appened after the original cache key generated by URL or from user. + + @return The cache key to appended after the original cache key. Should not be nil. + */ +@property (nonatomic, copy, readonly, nonnull) NSString *transformerKey; + +/** + Transform the image to another image. + + @param image The image to be transformed + @param key The cache key associated to the image. This arg is a hint for image source, not always useful and should be nullable. In the future we will remove this arg. + @return The transformed image, or nil if transform failed + */ +- (nullable UIImage *)transformedImageWithImage:(nonnull UIImage *)image forKey:(nonnull NSString *)key API_DEPRECATED("The key arg will be removed in the future. Update your code and don't rely on that.", macos(10.10, API_TO_BE_DEPRECATED), ios(8.0, API_TO_BE_DEPRECATED), tvos(9.0, API_TO_BE_DEPRECATED), watchos(2.0, API_TO_BE_DEPRECATED)); + +@end + +#pragma mark - Pipeline + +/** + Pipeline transformer. Which you can bind multiple transformers together to let the image to be transformed one by one in order and generate the final image. + @note Because transformers are lightweight, if you want to append or arrange transformers, create another pipeline transformer instead. This class is considered as immutable. + */ +@interface SDImagePipelineTransformer : NSObject + +/** + All transformers in pipeline + */ +@property (nonatomic, copy, readonly, nonnull) NSArray> *transformers; + +- (nonnull instancetype)init NS_UNAVAILABLE; ++ (nonnull instancetype)transformerWithTransformers:(nonnull NSArray> *)transformers; + +@end + +// There are some built-in transformers based on the `UIImage+Transformer` category to provide the common image geometry, image blending and image effect process. Those transform are useful for static image only but you can create your own to support animated image as well. +// Because transformers are lightweight, these class are considered as immutable. +#pragma mark - Image Geometry + +/** + Image round corner transformer + */ +@interface SDImageRoundCornerTransformer: NSObject + +/** + The radius of each corner oval. Values larger than half the + rectangle's width or height are clamped appropriately to + half the width or height. + */ +@property (nonatomic, assign, readonly) CGFloat cornerRadius; + +/** + A bitmask value that identifies the corners that you want + rounded. You can use this parameter to round only a subset + of the corners of the rectangle. + */ +@property (nonatomic, assign, readonly) SDRectCorner corners; + +/** + The inset border line width. Values larger than half the rectangle's + width or height are clamped appropriately to half the width + or height. + */ +@property (nonatomic, assign, readonly) CGFloat borderWidth; + +/** + The border stroke color. nil means clear color. + */ +@property (nonatomic, strong, readonly, nullable) UIColor *borderColor; + +- (nonnull instancetype)init NS_UNAVAILABLE; ++ (nonnull instancetype)transformerWithRadius:(CGFloat)cornerRadius corners:(SDRectCorner)corners borderWidth:(CGFloat)borderWidth borderColor:(nullable UIColor *)borderColor; + +@end + +/** + Image resizing transformer + */ +@interface SDImageResizingTransformer : NSObject + +/** + The new size to be resized, values should be positive. + */ +@property (nonatomic, assign, readonly) CGSize size; + +/** + The scale mode for image content. + */ +@property (nonatomic, assign, readonly) SDImageScaleMode scaleMode; + +- (nonnull instancetype)init NS_UNAVAILABLE; ++ (nonnull instancetype)transformerWithSize:(CGSize)size scaleMode:(SDImageScaleMode)scaleMode; + +@end + +/** + Image cropping transformer + */ +@interface SDImageCroppingTransformer : NSObject + +/** + Image's inner rect. + */ +@property (nonatomic, assign, readonly) CGRect rect; + +- (nonnull instancetype)init NS_UNAVAILABLE; ++ (nonnull instancetype)transformerWithRect:(CGRect)rect; + +@end + +/** + Image flipping transformer + */ +@interface SDImageFlippingTransformer : NSObject + +/** + YES to flip the image horizontally. ⇋ + */ +@property (nonatomic, assign, readonly) BOOL horizontal; + +/** + YES to flip the image vertically. ⥯ + */ +@property (nonatomic, assign, readonly) BOOL vertical; + +- (nonnull instancetype)init NS_UNAVAILABLE; ++ (nonnull instancetype)transformerWithHorizontal:(BOOL)horizontal vertical:(BOOL)vertical; + +@end + +/** + Image rotation transformer + */ +@interface SDImageRotationTransformer : NSObject + +/** + Rotated radians in counterclockwise.⟲ + */ +@property (nonatomic, assign, readonly) CGFloat angle; + +/** + YES: new image's size is extend to fit all content. + NO: image's size will not change, content may be clipped. + */ +@property (nonatomic, assign, readonly) BOOL fitSize; + +- (nonnull instancetype)init NS_UNAVAILABLE; ++ (nonnull instancetype)transformerWithAngle:(CGFloat)angle fitSize:(BOOL)fitSize; + +@end + +#pragma mark - Image Blending + +/** + Image tint color transformer + */ +@interface SDImageTintTransformer : NSObject + +/** + The tint color. + */ +@property (nonatomic, strong, readonly, nonnull) UIColor *tintColor; + +- (nonnull instancetype)init NS_UNAVAILABLE; ++ (nonnull instancetype)transformerWithColor:(nonnull UIColor *)tintColor; + +@end + +#pragma mark - Image Effect + +/** + Image blur effect transformer + */ +@interface SDImageBlurTransformer : NSObject + +/** + The radius of the blur in points, 0 means no blur effect. + */ +@property (nonatomic, assign, readonly) CGFloat blurRadius; + +- (nonnull instancetype)init NS_UNAVAILABLE; ++ (nonnull instancetype)transformerWithRadius:(CGFloat)blurRadius; + +@end + +#if SD_UIKIT || SD_MAC +/** + Core Image filter transformer + */ +@interface SDImageFilterTransformer: NSObject + +/** + The CIFilter to be applied to the image. + */ +@property (nonatomic, strong, readonly, nonnull) CIFilter *filter; + +- (nonnull instancetype)init NS_UNAVAILABLE; ++ (nonnull instancetype)transformerWithFilter:(nonnull CIFilter *)filter; + +@end +#endif diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageTransformer.m b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageTransformer.m new file mode 100644 index 0000000..8e7a3e2 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDImageTransformer.m @@ -0,0 +1,331 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDImageTransformer.h" +#import "UIColor+SDHexString.h" +#if SD_UIKIT || SD_MAC +#import +#endif + +// Separator for different transformerKey, for example, `image.png` |> flip(YES,NO) |> rotate(pi/4,YES) => 'image-SDImageFlippingTransformer(1,0)-SDImageRotationTransformer(0.78539816339,1).png' +static NSString * const SDImageTransformerKeySeparator = @"-"; + +NSString * _Nullable SDTransformedKeyForKey(NSString * _Nullable key, NSString * _Nonnull transformerKey) { + if (!key || !transformerKey) { + return nil; + } + // Find the file extension + NSURL *keyURL = [NSURL URLWithString:key]; + NSString *ext = keyURL ? keyURL.pathExtension : key.pathExtension; + if (ext.length > 0) { + // For non-file URL + if (keyURL && !keyURL.isFileURL) { + // keep anything except path (like URL query) + NSURLComponents *component = [NSURLComponents componentsWithURL:keyURL resolvingAgainstBaseURL:NO]; + component.path = [[[component.path.stringByDeletingPathExtension stringByAppendingString:SDImageTransformerKeySeparator] stringByAppendingString:transformerKey] stringByAppendingPathExtension:ext]; + return component.URL.absoluteString; + } else { + // file URL + return [[[key.stringByDeletingPathExtension stringByAppendingString:SDImageTransformerKeySeparator] stringByAppendingString:transformerKey] stringByAppendingPathExtension:ext]; + } + } else { + return [[key stringByAppendingString:SDImageTransformerKeySeparator] stringByAppendingString:transformerKey]; + } +} + +NSString * _Nullable SDThumbnailedKeyForKey(NSString * _Nullable key, CGSize thumbnailPixelSize, BOOL preserveAspectRatio) { + NSString *thumbnailKey = [NSString stringWithFormat:@"Thumbnail({%f,%f},%d)", thumbnailPixelSize.width, thumbnailPixelSize.height, preserveAspectRatio]; + return SDTransformedKeyForKey(key, thumbnailKey); +} + +@interface SDImagePipelineTransformer () + +@property (nonatomic, copy, readwrite, nonnull) NSArray> *transformers; +@property (nonatomic, copy, readwrite) NSString *transformerKey; + +@end + +@implementation SDImagePipelineTransformer + ++ (instancetype)transformerWithTransformers:(NSArray> *)transformers { + SDImagePipelineTransformer *transformer = [SDImagePipelineTransformer new]; + transformer.transformers = transformers; + transformer.transformerKey = [[self class] cacheKeyForTransformers:transformers]; + + return transformer; +} + ++ (NSString *)cacheKeyForTransformers:(NSArray> *)transformers { + if (transformers.count == 0) { + return @""; + } + NSMutableArray *cacheKeys = [NSMutableArray arrayWithCapacity:transformers.count]; + [transformers enumerateObjectsUsingBlock:^(id _Nonnull transformer, NSUInteger idx, BOOL * _Nonnull stop) { + NSString *cacheKey = transformer.transformerKey; + [cacheKeys addObject:cacheKey]; + }]; + + return [cacheKeys componentsJoinedByString:SDImageTransformerKeySeparator]; +} + +- (UIImage *)transformedImageWithImage:(UIImage *)image forKey:(NSString *)key { + if (!image) { + return nil; + } + UIImage *transformedImage = image; + for (id transformer in self.transformers) { + transformedImage = [transformer transformedImageWithImage:transformedImage forKey:key]; + } + return transformedImage; +} + +@end + +@interface SDImageRoundCornerTransformer () + +@property (nonatomic, assign) CGFloat cornerRadius; +@property (nonatomic, assign) SDRectCorner corners; +@property (nonatomic, assign) CGFloat borderWidth; +@property (nonatomic, strong, nullable) UIColor *borderColor; + +@end + +@implementation SDImageRoundCornerTransformer + ++ (instancetype)transformerWithRadius:(CGFloat)cornerRadius corners:(SDRectCorner)corners borderWidth:(CGFloat)borderWidth borderColor:(UIColor *)borderColor { + SDImageRoundCornerTransformer *transformer = [SDImageRoundCornerTransformer new]; + transformer.cornerRadius = cornerRadius; + transformer.corners = corners; + transformer.borderWidth = borderWidth; + transformer.borderColor = borderColor; + + return transformer; +} + +- (NSString *)transformerKey { + return [NSString stringWithFormat:@"SDImageRoundCornerTransformer(%f,%lu,%f,%@)", self.cornerRadius, (unsigned long)self.corners, self.borderWidth, self.borderColor.sd_hexString]; +} + +- (UIImage *)transformedImageWithImage:(UIImage *)image forKey:(NSString *)key { + if (!image) { + return nil; + } + return [image sd_roundedCornerImageWithRadius:self.cornerRadius corners:self.corners borderWidth:self.borderWidth borderColor:self.borderColor]; +} + +@end + +@interface SDImageResizingTransformer () + +@property (nonatomic, assign) CGSize size; +@property (nonatomic, assign) SDImageScaleMode scaleMode; + +@end + +@implementation SDImageResizingTransformer + ++ (instancetype)transformerWithSize:(CGSize)size scaleMode:(SDImageScaleMode)scaleMode { + SDImageResizingTransformer *transformer = [SDImageResizingTransformer new]; + transformer.size = size; + transformer.scaleMode = scaleMode; + + return transformer; +} + +- (NSString *)transformerKey { + CGSize size = self.size; + return [NSString stringWithFormat:@"SDImageResizingTransformer({%f,%f},%lu)", size.width, size.height, (unsigned long)self.scaleMode]; +} + +- (UIImage *)transformedImageWithImage:(UIImage *)image forKey:(NSString *)key { + if (!image) { + return nil; + } + return [image sd_resizedImageWithSize:self.size scaleMode:self.scaleMode]; +} + +@end + +@interface SDImageCroppingTransformer () + +@property (nonatomic, assign) CGRect rect; + +@end + +@implementation SDImageCroppingTransformer + ++ (instancetype)transformerWithRect:(CGRect)rect { + SDImageCroppingTransformer *transformer = [SDImageCroppingTransformer new]; + transformer.rect = rect; + + return transformer; +} + +- (NSString *)transformerKey { + CGRect rect = self.rect; + return [NSString stringWithFormat:@"SDImageCroppingTransformer({%f,%f,%f,%f})", rect.origin.x, rect.origin.y, rect.size.width, rect.size.height]; +} + +- (UIImage *)transformedImageWithImage:(UIImage *)image forKey:(NSString *)key { + if (!image) { + return nil; + } + return [image sd_croppedImageWithRect:self.rect]; +} + +@end + +@interface SDImageFlippingTransformer () + +@property (nonatomic, assign) BOOL horizontal; +@property (nonatomic, assign) BOOL vertical; + +@end + +@implementation SDImageFlippingTransformer + ++ (instancetype)transformerWithHorizontal:(BOOL)horizontal vertical:(BOOL)vertical { + SDImageFlippingTransformer *transformer = [SDImageFlippingTransformer new]; + transformer.horizontal = horizontal; + transformer.vertical = vertical; + + return transformer; +} + +- (NSString *)transformerKey { + return [NSString stringWithFormat:@"SDImageFlippingTransformer(%d,%d)", self.horizontal, self.vertical]; +} + +- (UIImage *)transformedImageWithImage:(UIImage *)image forKey:(NSString *)key { + if (!image) { + return nil; + } + return [image sd_flippedImageWithHorizontal:self.horizontal vertical:self.vertical]; +} + +@end + +@interface SDImageRotationTransformer () + +@property (nonatomic, assign) CGFloat angle; +@property (nonatomic, assign) BOOL fitSize; + +@end + +@implementation SDImageRotationTransformer + ++ (instancetype)transformerWithAngle:(CGFloat)angle fitSize:(BOOL)fitSize { + SDImageRotationTransformer *transformer = [SDImageRotationTransformer new]; + transformer.angle = angle; + transformer.fitSize = fitSize; + + return transformer; +} + +- (NSString *)transformerKey { + return [NSString stringWithFormat:@"SDImageRotationTransformer(%f,%d)", self.angle, self.fitSize]; +} + +- (UIImage *)transformedImageWithImage:(UIImage *)image forKey:(NSString *)key { + if (!image) { + return nil; + } + return [image sd_rotatedImageWithAngle:self.angle fitSize:self.fitSize]; +} + +@end + +#pragma mark - Image Blending + +@interface SDImageTintTransformer () + +@property (nonatomic, strong, nonnull) UIColor *tintColor; + +@end + +@implementation SDImageTintTransformer + ++ (instancetype)transformerWithColor:(UIColor *)tintColor { + SDImageTintTransformer *transformer = [SDImageTintTransformer new]; + transformer.tintColor = tintColor; + + return transformer; +} + +- (NSString *)transformerKey { + return [NSString stringWithFormat:@"SDImageTintTransformer(%@)", self.tintColor.sd_hexString]; +} + +- (UIImage *)transformedImageWithImage:(UIImage *)image forKey:(NSString *)key { + if (!image) { + return nil; + } + return [image sd_tintedImageWithColor:self.tintColor]; +} + +@end + +#pragma mark - Image Effect + +@interface SDImageBlurTransformer () + +@property (nonatomic, assign) CGFloat blurRadius; + +@end + +@implementation SDImageBlurTransformer + ++ (instancetype)transformerWithRadius:(CGFloat)blurRadius { + SDImageBlurTransformer *transformer = [SDImageBlurTransformer new]; + transformer.blurRadius = blurRadius; + + return transformer; +} + +- (NSString *)transformerKey { + return [NSString stringWithFormat:@"SDImageBlurTransformer(%f)", self.blurRadius]; +} + +- (UIImage *)transformedImageWithImage:(UIImage *)image forKey:(NSString *)key { + if (!image) { + return nil; + } + return [image sd_blurredImageWithRadius:self.blurRadius]; +} + +@end + +#if SD_UIKIT || SD_MAC +@interface SDImageFilterTransformer () + +@property (nonatomic, strong, nonnull) CIFilter *filter; + +@end + +@implementation SDImageFilterTransformer + ++ (instancetype)transformerWithFilter:(CIFilter *)filter { + SDImageFilterTransformer *transformer = [SDImageFilterTransformer new]; + transformer.filter = filter; + + return transformer; +} + +- (NSString *)transformerKey { + return [NSString stringWithFormat:@"SDImageFilterTransformer(%@)", self.filter.name]; +} + +- (UIImage *)transformedImageWithImage:(UIImage *)image forKey:(NSString *)key { + if (!image) { + return nil; + } + return [image sd_filteredImageWithFilter:self.filter]; +} + +@end +#endif diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDMemoryCache.h b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDMemoryCache.h new file mode 100644 index 0000000..43c39e8 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDMemoryCache.h @@ -0,0 +1,78 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageCompat.h" + +@class SDImageCacheConfig; +/** + A protocol to allow custom memory cache used in SDImageCache. + */ +@protocol SDMemoryCache + +@required + +/** + Create a new memory cache instance with the specify cache config. You can check `maxMemoryCost` and `maxMemoryCount` used for memory cache. + + @param config The cache config to be used to create the cache. + @return The new memory cache instance. + */ +- (nonnull instancetype)initWithConfig:(nonnull SDImageCacheConfig *)config; + +/** + Returns the value associated with a given key. + + @param key An object identifying the value. If nil, just return nil. + @return The value associated with key, or nil if no value is associated with key. + */ +- (nullable id)objectForKey:(nonnull id)key; + +/** + Sets the value of the specified key in the cache (0 cost). + + @param object The object to be stored in the cache. If nil, it calls `removeObjectForKey:`. + @param key The key with which to associate the value. If nil, this method has no effect. + @discussion Unlike an NSMutableDictionary object, a cache does not copy the key + objects that are put into it. + */ +- (void)setObject:(nullable id)object forKey:(nonnull id)key; + +/** + Sets the value of the specified key in the cache, and associates the key-value + pair with the specified cost. + + @param object The object to store in the cache. If nil, it calls `removeObjectForKey`. + @param key The key with which to associate the value. If nil, this method has no effect. + @param cost The cost with which to associate the key-value pair. + @discussion Unlike an NSMutableDictionary object, a cache does not copy the key + objects that are put into it. + */ +- (void)setObject:(nullable id)object forKey:(nonnull id)key cost:(NSUInteger)cost; + +/** + Removes the value of the specified key in the cache. + + @param key The key identifying the value to be removed. If nil, this method has no effect. + */ +- (void)removeObjectForKey:(nonnull id)key; + +/** + Empties the cache immediately. + */ +- (void)removeAllObjects; + +@end + +/** + A memory cache which auto purge the cache on memory warning and support weak cache. + */ +@interface SDMemoryCache : NSCache + +@property (nonatomic, strong, nonnull, readonly) SDImageCacheConfig *config; + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDMemoryCache.m b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDMemoryCache.m new file mode 100644 index 0000000..7bcc385 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDMemoryCache.m @@ -0,0 +1,158 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDMemoryCache.h" +#import "SDImageCacheConfig.h" +#import "UIImage+MemoryCacheCost.h" +#import "SDInternalMacros.h" + +static void * SDMemoryCacheContext = &SDMemoryCacheContext; + +@interface SDMemoryCache () { +#if SD_UIKIT + SD_LOCK_DECLARE(_weakCacheLock); // a lock to keep the access to `weakCache` thread-safe +#endif +} + +@property (nonatomic, strong, nullable) SDImageCacheConfig *config; +#if SD_UIKIT +@property (nonatomic, strong, nonnull) NSMapTable *weakCache; // strong-weak cache +#endif +@end + +@implementation SDMemoryCache + +- (void)dealloc { + [_config removeObserver:self forKeyPath:NSStringFromSelector(@selector(maxMemoryCost)) context:SDMemoryCacheContext]; + [_config removeObserver:self forKeyPath:NSStringFromSelector(@selector(maxMemoryCount)) context:SDMemoryCacheContext]; +#if SD_UIKIT + [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidReceiveMemoryWarningNotification object:nil]; +#endif + self.delegate = nil; +} + +- (instancetype)init { + self = [super init]; + if (self) { + _config = [[SDImageCacheConfig alloc] init]; + [self commonInit]; + } + return self; +} + +- (instancetype)initWithConfig:(SDImageCacheConfig *)config { + self = [super init]; + if (self) { + _config = config; + [self commonInit]; + } + return self; +} + +- (void)commonInit { + SDImageCacheConfig *config = self.config; + self.totalCostLimit = config.maxMemoryCost; + self.countLimit = config.maxMemoryCount; + + [config addObserver:self forKeyPath:NSStringFromSelector(@selector(maxMemoryCost)) options:0 context:SDMemoryCacheContext]; + [config addObserver:self forKeyPath:NSStringFromSelector(@selector(maxMemoryCount)) options:0 context:SDMemoryCacheContext]; + +#if SD_UIKIT + self.weakCache = [[NSMapTable alloc] initWithKeyOptions:NSPointerFunctionsStrongMemory valueOptions:NSPointerFunctionsWeakMemory capacity:0]; + SD_LOCK_INIT(_weakCacheLock); + + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(didReceiveMemoryWarning:) + name:UIApplicationDidReceiveMemoryWarningNotification + object:nil]; +#endif +} + +// Current this seems no use on macOS (macOS use virtual memory and do not clear cache when memory warning). So we only override on iOS/tvOS platform. +#if SD_UIKIT +- (void)didReceiveMemoryWarning:(NSNotification *)notification { + // Only remove cache, but keep weak cache + [super removeAllObjects]; +} + +// `setObject:forKey:` just call this with 0 cost. Override this is enough +- (void)setObject:(id)obj forKey:(id)key cost:(NSUInteger)g { + [super setObject:obj forKey:key cost:g]; + if (!self.config.shouldUseWeakMemoryCache) { + return; + } + if (key && obj) { + // Store weak cache + SD_LOCK(_weakCacheLock); + [self.weakCache setObject:obj forKey:key]; + SD_UNLOCK(_weakCacheLock); + } +} + +- (id)objectForKey:(id)key { + id obj = [super objectForKey:key]; + if (!self.config.shouldUseWeakMemoryCache) { + return obj; + } + if (key && !obj) { + // Check weak cache + SD_LOCK(_weakCacheLock); + obj = [self.weakCache objectForKey:key]; + SD_UNLOCK(_weakCacheLock); + if (obj) { + // Sync cache + NSUInteger cost = 0; + if ([obj isKindOfClass:[UIImage class]]) { + cost = [(UIImage *)obj sd_memoryCost]; + } + [super setObject:obj forKey:key cost:cost]; + } + } + return obj; +} + +- (void)removeObjectForKey:(id)key { + [super removeObjectForKey:key]; + if (!self.config.shouldUseWeakMemoryCache) { + return; + } + if (key) { + // Remove weak cache + SD_LOCK(_weakCacheLock); + [self.weakCache removeObjectForKey:key]; + SD_UNLOCK(_weakCacheLock); + } +} + +- (void)removeAllObjects { + [super removeAllObjects]; + if (!self.config.shouldUseWeakMemoryCache) { + return; + } + // Manually remove should also remove weak cache + SD_LOCK(_weakCacheLock); + [self.weakCache removeAllObjects]; + SD_UNLOCK(_weakCacheLock); +} +#endif + +#pragma mark - KVO + +- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { + if (context == SDMemoryCacheContext) { + if ([keyPath isEqualToString:NSStringFromSelector(@selector(maxMemoryCost))]) { + self.totalCostLimit = self.config.maxMemoryCost; + } else if ([keyPath isEqualToString:NSStringFromSelector(@selector(maxMemoryCount))]) { + self.countLimit = self.config.maxMemoryCount; + } + } else { + [super observeValueForKeyPath:keyPath ofObject:object change:change context:context]; + } +} + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageCacheKeyFilter.h b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageCacheKeyFilter.h new file mode 100644 index 0000000..4f54dd8 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageCacheKeyFilter.h @@ -0,0 +1,32 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import +#import "SDWebImageCompat.h" + +typedef NSString * _Nullable(^SDWebImageCacheKeyFilterBlock)(NSURL * _Nonnull url); + +/** + This is the protocol for cache key filter. + We can use a block to specify the cache key filter. But Using protocol can make this extensible, and allow Swift user to use it easily instead of using `@convention(block)` to store a block into context options. + */ +@protocol SDWebImageCacheKeyFilter + +- (nullable NSString *)cacheKeyForURL:(nonnull NSURL *)url; + +@end + +/** + A cache key filter class with block. + */ +@interface SDWebImageCacheKeyFilter : NSObject + +- (nonnull instancetype)initWithBlock:(nonnull SDWebImageCacheKeyFilterBlock)block; ++ (nonnull instancetype)cacheKeyFilterWithBlock:(nonnull SDWebImageCacheKeyFilterBlock)block; + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageCacheKeyFilter.m b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageCacheKeyFilter.m new file mode 100644 index 0000000..b4ebb8b --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageCacheKeyFilter.m @@ -0,0 +1,39 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageCacheKeyFilter.h" + +@interface SDWebImageCacheKeyFilter () + +@property (nonatomic, copy, nonnull) SDWebImageCacheKeyFilterBlock block; + +@end + +@implementation SDWebImageCacheKeyFilter + +- (instancetype)initWithBlock:(SDWebImageCacheKeyFilterBlock)block { + self = [super init]; + if (self) { + self.block = block; + } + return self; +} + ++ (instancetype)cacheKeyFilterWithBlock:(SDWebImageCacheKeyFilterBlock)block { + SDWebImageCacheKeyFilter *cacheKeyFilter = [[SDWebImageCacheKeyFilter alloc] initWithBlock:block]; + return cacheKeyFilter; +} + +- (NSString *)cacheKeyForURL:(NSURL *)url { + if (!self.block) { + return nil; + } + return self.block(url); +} + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageCacheSerializer.h b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageCacheSerializer.h new file mode 100644 index 0000000..3c271b1 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageCacheSerializer.h @@ -0,0 +1,36 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import +#import "SDWebImageCompat.h" + +typedef NSData * _Nullable(^SDWebImageCacheSerializerBlock)(UIImage * _Nonnull image, NSData * _Nullable data, NSURL * _Nullable imageURL); + +/** + This is the protocol for cache serializer. + We can use a block to specify the cache serializer. But Using protocol can make this extensible, and allow Swift user to use it easily instead of using `@convention(block)` to store a block into context options. + */ +@protocol SDWebImageCacheSerializer + +/// Provide the image data associated to the image and store to disk cache +/// @param image The loaded image +/// @param data The original loaded image data +/// @param imageURL The image URL +- (nullable NSData *)cacheDataWithImage:(nonnull UIImage *)image originalData:(nullable NSData *)data imageURL:(nullable NSURL *)imageURL; + +@end + +/** + A cache serializer class with block. + */ +@interface SDWebImageCacheSerializer : NSObject + +- (nonnull instancetype)initWithBlock:(nonnull SDWebImageCacheSerializerBlock)block; ++ (nonnull instancetype)cacheSerializerWithBlock:(nonnull SDWebImageCacheSerializerBlock)block; + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageCacheSerializer.m b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageCacheSerializer.m new file mode 100644 index 0000000..51528e6 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageCacheSerializer.m @@ -0,0 +1,39 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageCacheSerializer.h" + +@interface SDWebImageCacheSerializer () + +@property (nonatomic, copy, nonnull) SDWebImageCacheSerializerBlock block; + +@end + +@implementation SDWebImageCacheSerializer + +- (instancetype)initWithBlock:(SDWebImageCacheSerializerBlock)block { + self = [super init]; + if (self) { + self.block = block; + } + return self; +} + ++ (instancetype)cacheSerializerWithBlock:(SDWebImageCacheSerializerBlock)block { + SDWebImageCacheSerializer *cacheSerializer = [[SDWebImageCacheSerializer alloc] initWithBlock:block]; + return cacheSerializer; +} + +- (NSData *)cacheDataWithImage:(UIImage *)image originalData:(NSData *)data imageURL:(nullable NSURL *)imageURL { + if (!self.block) { + return nil; + } + return self.block(image, data, imageURL); +} + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageCompat.h b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageCompat.h new file mode 100644 index 0000000..f47a248 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageCompat.h @@ -0,0 +1,95 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * (c) Jamie Pinkham + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import + +#ifdef __OBJC_GC__ + #error SDWebImage does not support Objective-C Garbage Collection +#endif + +// Seems like TARGET_OS_MAC is always defined (on all platforms). +// To determine if we are running on macOS, use TARGET_OS_OSX in Xcode 8 +#if TARGET_OS_OSX + #define SD_MAC 1 +#else + #define SD_MAC 0 +#endif + +// iOS and tvOS are very similar, UIKit exists on both platforms +// Note: watchOS also has UIKit, but it's very limited +#if TARGET_OS_IOS || TARGET_OS_TV + #define SD_UIKIT 1 +#else + #define SD_UIKIT 0 +#endif + +#if TARGET_OS_IOS + #define SD_IOS 1 +#else + #define SD_IOS 0 +#endif + +#if TARGET_OS_TV + #define SD_TV 1 +#else + #define SD_TV 0 +#endif + +#if TARGET_OS_WATCH + #define SD_WATCH 1 +#else + #define SD_WATCH 0 +#endif + + +#if SD_MAC + #import + #ifndef UIImage + #define UIImage NSImage + #endif + #ifndef UIImageView + #define UIImageView NSImageView + #endif + #ifndef UIView + #define UIView NSView + #endif + #ifndef UIColor + #define UIColor NSColor + #endif +#else + #if SD_UIKIT + #import + #endif + #if SD_WATCH + #import + #ifndef UIView + #define UIView WKInterfaceObject + #endif + #ifndef UIImageView + #define UIImageView WKInterfaceImage + #endif + #endif +#endif + +#ifndef NS_ENUM +#define NS_ENUM(_type, _name) enum _name : _type _name; enum _name : _type +#endif + +#ifndef NS_OPTIONS +#define NS_OPTIONS(_type, _name) enum _name : _type _name; enum _name : _type +#endif + +#ifndef dispatch_main_async_safe +#define dispatch_main_async_safe(block)\ + if (dispatch_queue_get_label(DISPATCH_CURRENT_QUEUE_LABEL) == dispatch_queue_get_label(dispatch_get_main_queue())) {\ + block();\ + } else {\ + dispatch_async(dispatch_get_main_queue(), block);\ + } +#endif diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageCompat.m b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageCompat.m new file mode 100644 index 0000000..1297401 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageCompat.m @@ -0,0 +1,17 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageCompat.h" + +#if !__has_feature(objc_arc) + #error SDWebImage is ARC only. Either turn on ARC for the project or use -fobjc-arc flag +#endif + +#if !OS_OBJECT_USE_OBJC + #error SDWebImage need ARC for dispatch object +#endif diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageDefine.h b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageDefine.h new file mode 100644 index 0000000..3fb0976 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageDefine.h @@ -0,0 +1,326 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageCompat.h" + +typedef void(^SDWebImageNoParamsBlock)(void); +typedef NSString * SDWebImageContextOption NS_EXTENSIBLE_STRING_ENUM; +typedef NSDictionary SDWebImageContext; +typedef NSMutableDictionary SDWebImageMutableContext; + +#pragma mark - Image scale + +/** + Return the image scale factor for the specify key, supports file name and url key. + This is the built-in way to check the scale factor when we have no context about it. Because scale factor is not stored in image data (It's typically from filename). + However, you can also provide custom scale factor as well, see `SDWebImageContextImageScaleFactor`. + + @param key The image cache key + @return The scale factor for image + */ +FOUNDATION_EXPORT CGFloat SDImageScaleFactorForKey(NSString * _Nullable key); + +/** + Scale the image with the scale factor for the specify key. If no need to scale, return the original image. + This works for `UIImage`(UIKit) or `NSImage`(AppKit). And this function also preserve the associated value in `UIImage+Metadata.h`. + @note This is actually a convenience function, which firstly call `SDImageScaleFactorForKey` and then call `SDScaledImageForScaleFactor`, kept for backward compatibility. + + @param key The image cache key + @param image The image + @return The scaled image + */ +FOUNDATION_EXPORT UIImage * _Nullable SDScaledImageForKey(NSString * _Nullable key, UIImage * _Nullable image); + +/** + Scale the image with the scale factor. If no need to scale, return the original image. + This works for `UIImage`(UIKit) or `NSImage`(AppKit). And this function also preserve the associated value in `UIImage+Metadata.h`. + + @param scale The image scale factor + @param image The image + @return The scaled image + */ +FOUNDATION_EXPORT UIImage * _Nullable SDScaledImageForScaleFactor(CGFloat scale, UIImage * _Nullable image); + +#pragma mark - WebCache Options + +/// WebCache options +typedef NS_OPTIONS(NSUInteger, SDWebImageOptions) { + /** + * By default, when a URL fail to be downloaded, the URL is blacklisted so the library won't keep trying. + * This flag disable this blacklisting. + */ + SDWebImageRetryFailed = 1 << 0, + + /** + * By default, image downloads are started during UI interactions, this flags disable this feature, + * leading to delayed download on UIScrollView deceleration for instance. + */ + SDWebImageLowPriority = 1 << 1, + + /** + * This flag enables progressive download, the image is displayed progressively during download as a browser would do. + * By default, the image is only displayed once completely downloaded. + */ + SDWebImageProgressiveLoad = 1 << 2, + + /** + * Even if the image is cached, respect the HTTP response cache control, and refresh the image from remote location if needed. + * The disk caching will be handled by NSURLCache instead of SDWebImage leading to slight performance degradation. + * This option helps deal with images changing behind the same request URL, e.g. Facebook graph api profile pics. + * If a cached image is refreshed, the completion block is called once with the cached image and again with the final image. + * + * Use this flag only if you can't make your URLs static with embedded cache busting parameter. + */ + SDWebImageRefreshCached = 1 << 3, + + /** + * In iOS 4+, continue the download of the image if the app goes to background. This is achieved by asking the system for + * extra time in background to let the request finish. If the background task expires the operation will be cancelled. + */ + SDWebImageContinueInBackground = 1 << 4, + + /** + * Handles cookies stored in NSHTTPCookieStore by setting + * NSMutableURLRequest.HTTPShouldHandleCookies = YES; + */ + SDWebImageHandleCookies = 1 << 5, + + /** + * Enable to allow untrusted SSL certificates. + * Useful for testing purposes. Use with caution in production. + */ + SDWebImageAllowInvalidSSLCertificates = 1 << 6, + + /** + * By default, images are loaded in the order in which they were queued. This flag moves them to + * the front of the queue. + */ + SDWebImageHighPriority = 1 << 7, + + /** + * By default, placeholder images are loaded while the image is loading. This flag will delay the loading + * of the placeholder image until after the image has finished loading. + * @note This is used to treate placeholder as an **Error Placeholder** but not **Loading Placeholder** by defaults. if the image loading is cancelled or error, the placeholder will be always set. + * @note Therefore, if you want both **Error Placeholder** and **Loading Placeholder** exist, use `SDWebImageAvoidAutoSetImage` to manually set the two placeholders and final loaded image by your hand depends on loading result. + */ + SDWebImageDelayPlaceholder = 1 << 8, + + /** + * We usually don't apply transform on animated images as most transformers could not manage animated images. + * Use this flag to transform them anyway. + */ + SDWebImageTransformAnimatedImage = 1 << 9, + + /** + * By default, image is added to the imageView after download. But in some cases, we want to + * have the hand before setting the image (apply a filter or add it with cross-fade animation for instance) + * Use this flag if you want to manually set the image in the completion when success + */ + SDWebImageAvoidAutoSetImage = 1 << 10, + + /** + * By default, images are decoded respecting their original size. + * This flag will scale down the images to a size compatible with the constrained memory of devices. + * To control the limit memory bytes, check `SDImageCoderHelper.defaultScaleDownLimitBytes` (Defaults to 60MB on iOS) + * This will actually translate to use context option `.imageThumbnailPixelSize` from v5.5.0 (Defaults to (3966, 3966) on iOS). Previously does not. + * This flags effect the progressive and animated images as well from v5.5.0. Previously does not. + * @note If you need detail controls, it's better to use context option `imageThumbnailPixelSize` and `imagePreserveAspectRatio` instead. + */ + SDWebImageScaleDownLargeImages = 1 << 11, + + /** + * By default, we do not query image data when the image is already cached in memory. This mask can force to query image data at the same time. However, this query is asynchronously unless you specify `SDWebImageQueryMemoryDataSync` + */ + SDWebImageQueryMemoryData = 1 << 12, + + /** + * By default, when you only specify `SDWebImageQueryMemoryData`, we query the memory image data asynchronously. Combined this mask as well to query the memory image data synchronously. + * @note Query data synchronously is not recommend, unless you want to ensure the image is loaded in the same runloop to avoid flashing during cell reusing. + */ + SDWebImageQueryMemoryDataSync = 1 << 13, + + /** + * By default, when the memory cache miss, we query the disk cache asynchronously. This mask can force to query disk cache (when memory cache miss) synchronously. + * @note These 3 query options can be combined together. For the full list about these masks combination, see wiki page. + * @note Query data synchronously is not recommend, unless you want to ensure the image is loaded in the same runloop to avoid flashing during cell reusing. + */ + SDWebImageQueryDiskDataSync = 1 << 14, + + /** + * By default, when the cache missed, the image is load from the loader. This flag can prevent this to load from cache only. + */ + SDWebImageFromCacheOnly = 1 << 15, + + /** + * By default, we query the cache before the image is load from the loader. This flag can prevent this to load from loader only. + */ + SDWebImageFromLoaderOnly = 1 << 16, + + /** + * By default, when you use `SDWebImageTransition` to do some view transition after the image load finished, this transition is only applied for image when the callback from manager is asynchronous (from network, or disk cache query) + * This mask can force to apply view transition for any cases, like memory cache query, or sync disk cache query. + */ + SDWebImageForceTransition = 1 << 17, + + /** + * By default, we will decode the image in the background during cache query and download from the network. This can help to improve performance because when rendering image on the screen, it need to be firstly decoded. But this happen on the main queue by Core Animation. + * However, this process may increase the memory usage as well. If you are experiencing a issue due to excessive memory consumption, This flag can prevent decode the image. + */ + SDWebImageAvoidDecodeImage = 1 << 18, + + /** + * By default, we decode the animated image. This flag can force decode the first frame only and produce the static image. + */ + SDWebImageDecodeFirstFrameOnly = 1 << 19, + + /** + * By default, for `SDAnimatedImage`, we decode the animated image frame during rendering to reduce memory usage. However, you can specify to preload all frames into memory to reduce CPU usage when the animated image is shared by lots of imageViews. + * This will actually trigger `preloadAllAnimatedImageFrames` in the background queue(Disk Cache & Download only). + */ + SDWebImagePreloadAllFrames = 1 << 20, + + /** + * By default, when you use `SDWebImageContextAnimatedImageClass` context option (like using `SDAnimatedImageView` which designed to use `SDAnimatedImage`), we may still use `UIImage` when the memory cache hit, or image decoder is not available to produce one exactlly matching your custom class as a fallback solution. + * Using this option, can ensure we always callback image with your provided class. If failed to produce one, a error with code `SDWebImageErrorBadImageData` will been used. + * Note this options is not compatible with `SDWebImageDecodeFirstFrameOnly`, which always produce a UIImage/NSImage. + */ + SDWebImageMatchAnimatedImageClass = 1 << 21, + + /** + * By default, when we load the image from network, the image will be written to the cache (memory and disk, controlled by your `storeCacheType` context option) + * This maybe an asynchronously operation and the final `SDInternalCompletionBlock` callback does not guarantee the disk cache written is finished and may cause logic error. (For example, you modify the disk data just in completion block, however, the disk cache is not ready) + * If you need to process with the disk cache in the completion block, you should use this option to ensure the disk cache already been written when callback. + * Note if you use this when using the custom cache serializer, or using the transformer, we will also wait until the output image data written is finished. + */ + SDWebImageWaitStoreCache = 1 << 22, + + /** + * We usually don't apply transform on vector images, because vector images supports dynamically changing to any size, rasterize to a fixed size will loss details. To modify vector images, you can process the vector data at runtime (such as modifying PDF tag / SVG element). + * Use this flag to transform them anyway. + */ + SDWebImageTransformVectorImage = 1 << 23 +}; + + +#pragma mark - Context Options + +/** + A String to be used as the operation key for view category to store the image load operation. This is used for view instance which supports different image loading process. If nil, will use the class name as operation key. (NSString *) + */ +FOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextSetImageOperationKey; + +/** + A SDWebImageManager instance to control the image download and cache process using in UIImageView+WebCache category and likes. If not provided, use the shared manager (SDWebImageManager *) + @deprecated Deprecated in the future. This context options can be replaced by other context option control like `.imageCache`, `.imageLoader`, `.imageTransformer` (See below), which already matches all the properties in SDWebImageManager. + */ +FOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextCustomManager API_DEPRECATED("Use individual context option like .imageCache, .imageLoader and .imageTransformer instead", macos(10.10, API_TO_BE_DEPRECATED), ios(8.0, API_TO_BE_DEPRECATED), tvos(9.0, API_TO_BE_DEPRECATED), watchos(2.0, API_TO_BE_DEPRECATED)); + +/** + A id instance which conforms to `SDImageCache` protocol. It's used to override the image manager's cache during the image loading pipeline. + In other word, if you just want to specify a custom cache during image loading, you don't need to re-create a dummy SDWebImageManager instance with the cache. If not provided, use the image manager's cache (id) + */ +FOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextImageCache; + +/** + A id instance which conforms to `SDImageLoader` protocol. It's used to override the image manager's loader during the image loading pipeline. + In other word, if you just want to specify a custom loader during image loading, you don't need to re-create a dummy SDWebImageManager instance with the loader. If not provided, use the image manager's cache (id) +*/ +FOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextImageLoader; + +/** + A id instance which conforms to `SDImageCoder` protocol. It's used to override the default image coder for image decoding(including progressive) and encoding during the image loading process. + If you use this context option, we will not always use `SDImageCodersManager.shared` to loop through all registered coders and find the suitable one. Instead, we will arbitrarily use the exact provided coder without extra checking (We may not call `canDecodeFromData:`). + @note This is only useful for cases which you can ensure the loading url matches your coder, or you find it's too hard to write a common coder which can used for generic usage. This will bind the loading url with the coder logic, which is not always a good design, but possible. (id) +*/ +FOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextImageCoder; + +/** + A id instance which conforms `SDImageTransformer` protocol. It's used for image transform after the image load finished and store the transformed image to cache. If you provide one, it will ignore the `transformer` in manager and use provided one instead. If you pass NSNull, the transformer feature will be disabled. (id) + */ +FOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextImageTransformer; + +/** + A CGFloat raw value which specify the image scale factor. The number should be greater than or equal to 1.0. If not provide or the number is invalid, we will use the cache key to specify the scale factor. (NSNumber) + */ +FOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextImageScaleFactor; + +/** + A Boolean value indicating whether to keep the original aspect ratio when generating thumbnail images (or bitmap images from vector format). + Defaults to YES. (NSNumber) + */ +FOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextImagePreserveAspectRatio; + +/** + A CGSize raw value indicating whether or not to generate the thumbnail images (or bitmap images from vector format). When this value is provided, the decoder will generate a thumbnail image which pixel size is smaller than or equal to (depends the `.imagePreserveAspectRatio`) the value size. + @note When you pass `.preserveAspectRatio == NO`, the thumbnail image is stretched to match each dimension. When `.preserveAspectRatio == YES`, the thumbnail image's width is limited to pixel size's width, the thumbnail image's height is limited to pixel size's height. For common cases, you can just pass a square size to limit both. + Defaults to CGSizeZero, which means no thumbnail generation at all. (NSValue) + */ +FOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextImageThumbnailPixelSize; + +/** + A SDImageCacheType raw value which specify the source of cache to query. Specify `SDImageCacheTypeDisk` to query from disk cache only; `SDImageCacheTypeMemory` to query from memory only. And `SDImageCacheTypeAll` to query from both memory cache and disk cache. Specify `SDImageCacheTypeNone` is invalid and totally ignore the cache query. + If not provide or the value is invalid, we will use `SDImageCacheTypeAll`. (NSNumber) + */ +FOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextQueryCacheType; + +/** + A SDImageCacheType raw value which specify the store cache type when the image has just been downloaded and will be stored to the cache. Specify `SDImageCacheTypeNone` to disable cache storage; `SDImageCacheTypeDisk` to store in disk cache only; `SDImageCacheTypeMemory` to store in memory only. And `SDImageCacheTypeAll` to store in both memory cache and disk cache. + If you use image transformer feature, this actually apply for the transformed image, but not the original image itself. Use `SDWebImageContextOriginalStoreCacheType` if you want to control the original image's store cache type at the same time. + If not provide or the value is invalid, we will use `SDImageCacheTypeAll`. (NSNumber) + */ +FOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextStoreCacheType; + +/** + The same behavior like `SDWebImageContextQueryCacheType`, but control the query cache type for the original image when you use image transformer feature. This allows the detail control of cache query for these two images. For example, if you want to query the transformed image from both memory/disk cache, query the original image from disk cache only, use `[.queryCacheType : .all, .originalQueryCacheType : .disk]` + If not provide or the value is invalid, we will use `SDImageCacheTypeDisk`, which query the original full image data from disk cache after transformed image cache miss. This is suitable for most common cases to avoid re-downloading the full data for different transform variants. (NSNumber) + @note Which means, if you set this value to not be `.none`, we will query the original image from cache, then do transform with transformer, instead of actual downloading, which can save bandwidth usage. + */ +FOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextOriginalQueryCacheType; + +/** + The same behavior like `SDWebImageContextStoreCacheType`, but control the store cache type for the original image when you use image transformer feature. This allows the detail control of cache storage for these two images. For example, if you want to store the transformed image into both memory/disk cache, store the original image into disk cache only, use `[.storeCacheType : .all, .originalStoreCacheType : .disk]` + If not provide or the value is invalid, we will use `SDImageCacheTypeDisk`, which store the original full image data into disk cache after storing the transformed image. This is suitable for most common cases to avoid re-downloading the full data for different transform variants. (NSNumber) + @note This only store the original image, if you want to use the original image without downloading in next query, specify `SDWebImageContextOriginalQueryCacheType` as well. + */ +FOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextOriginalStoreCacheType; + +/** + A id instance which conforms to `SDImageCache` protocol. It's used to control the cache for original image when using the transformer. If you provide one, the original image (full size image) will query and write from that cache instance instead, the transformed image will query and write from the default `SDWebImageContextImageCache` instead. (id) + */ +FOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextOriginalImageCache; + +/** + A Class object which the instance is a `UIImage/NSImage` subclass and adopt `SDAnimatedImage` protocol. We will call `initWithData:scale:options:` to create the instance (or `initWithAnimatedCoder:scale:` when using progressive download) . If the instance create failed, fallback to normal `UIImage/NSImage`. + This can be used to improve animated images rendering performance (especially memory usage on big animated images) with `SDAnimatedImageView` (Class). + */ +FOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextAnimatedImageClass; + +/** + A id instance to modify the image download request. It's used for downloader to modify the original request from URL and options. If you provide one, it will ignore the `requestModifier` in downloader and use provided one instead. (id) + */ +FOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextDownloadRequestModifier; + +/** + A id instance to modify the image download response. It's used for downloader to modify the original response from URL and options. If you provide one, it will ignore the `responseModifier` in downloader and use provided one instead. (id) + */ +FOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextDownloadResponseModifier; + +/** + A id instance to decrypt the image download data. This can be used for image data decryption, such as Base64 encoded image. If you provide one, it will ignore the `decryptor` in downloader and use provided one instead. (id) + */ +FOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextDownloadDecryptor; + +/** + A id instance to convert an URL into a cache key. It's used when manager need cache key to use image cache. If you provide one, it will ignore the `cacheKeyFilter` in manager and use provided one instead. (id) + */ +FOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextCacheKeyFilter; + +/** + A id instance to convert the decoded image, the source downloaded data, to the actual data. It's used for manager to store image to the disk cache. If you provide one, it will ignore the `cacheSerializer` in manager and use provided one instead. (id) + */ +FOUNDATION_EXPORT SDWebImageContextOption _Nonnull const SDWebImageContextCacheSerializer; diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageDefine.m b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageDefine.m new file mode 100644 index 0000000..aee8ca4 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageDefine.m @@ -0,0 +1,146 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageDefine.h" +#import "UIImage+Metadata.h" +#import "NSImage+Compatibility.h" +#import "SDAssociatedObject.h" + +#pragma mark - Image scale + +static inline NSArray * _Nonnull SDImageScaleFactors() { + return @[@2, @3]; +} + +inline CGFloat SDImageScaleFactorForKey(NSString * _Nullable key) { + CGFloat scale = 1; + if (!key) { + return scale; + } + // Check if target OS support scale +#if SD_WATCH + if ([[WKInterfaceDevice currentDevice] respondsToSelector:@selector(screenScale)]) +#elif SD_UIKIT + if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)]) +#elif SD_MAC + NSScreen *mainScreen = nil; + if (@available(macOS 10.12, *)) { + mainScreen = [NSScreen mainScreen]; + } else { + mainScreen = [NSScreen screens].firstObject; + } + if ([mainScreen respondsToSelector:@selector(backingScaleFactor)]) +#endif + { + // a@2x.png -> 8 + if (key.length >= 8) { + // Fast check + BOOL isURL = [key hasPrefix:@"http://"] || [key hasPrefix:@"https://"]; + for (NSNumber *scaleFactor in SDImageScaleFactors()) { + // @2x. for file name and normal url + NSString *fileScale = [NSString stringWithFormat:@"@%@x.", scaleFactor]; + if ([key containsString:fileScale]) { + scale = scaleFactor.doubleValue; + return scale; + } + if (isURL) { + // %402x. for url encode + NSString *urlScale = [NSString stringWithFormat:@"%%40%@x.", scaleFactor]; + if ([key containsString:urlScale]) { + scale = scaleFactor.doubleValue; + return scale; + } + } + } + } + } + return scale; +} + +inline UIImage * _Nullable SDScaledImageForKey(NSString * _Nullable key, UIImage * _Nullable image) { + if (!image) { + return nil; + } + CGFloat scale = SDImageScaleFactorForKey(key); + return SDScaledImageForScaleFactor(scale, image); +} + +inline UIImage * _Nullable SDScaledImageForScaleFactor(CGFloat scale, UIImage * _Nullable image) { + if (!image) { + return nil; + } + if (scale <= 1) { + return image; + } + if (scale == image.scale) { + return image; + } + UIImage *scaledImage; + if (image.sd_isAnimated) { + UIImage *animatedImage; +#if SD_UIKIT || SD_WATCH + // `UIAnimatedImage` images share the same size and scale. + NSMutableArray *scaledImages = [NSMutableArray array]; + + for (UIImage *tempImage in image.images) { + UIImage *tempScaledImage = [[UIImage alloc] initWithCGImage:tempImage.CGImage scale:scale orientation:tempImage.imageOrientation]; + [scaledImages addObject:tempScaledImage]; + } + + animatedImage = [UIImage animatedImageWithImages:scaledImages duration:image.duration]; + animatedImage.sd_imageLoopCount = image.sd_imageLoopCount; +#else + // Animated GIF for `NSImage` need to grab `NSBitmapImageRep`; + NSRect imageRect = NSMakeRect(0, 0, image.size.width, image.size.height); + NSImageRep *imageRep = [image bestRepresentationForRect:imageRect context:nil hints:nil]; + NSBitmapImageRep *bitmapImageRep; + if ([imageRep isKindOfClass:[NSBitmapImageRep class]]) { + bitmapImageRep = (NSBitmapImageRep *)imageRep; + } + if (bitmapImageRep) { + NSSize size = NSMakeSize(image.size.width / scale, image.size.height / scale); + animatedImage = [[NSImage alloc] initWithSize:size]; + bitmapImageRep.size = size; + [animatedImage addRepresentation:bitmapImageRep]; + } +#endif + scaledImage = animatedImage; + } else { +#if SD_UIKIT || SD_WATCH + scaledImage = [[UIImage alloc] initWithCGImage:image.CGImage scale:scale orientation:image.imageOrientation]; +#else + scaledImage = [[UIImage alloc] initWithCGImage:image.CGImage scale:scale orientation:kCGImagePropertyOrientationUp]; +#endif + } + SDImageCopyAssociatedObject(image, scaledImage); + + return scaledImage; +} + +#pragma mark - Context option + +SDWebImageContextOption const SDWebImageContextSetImageOperationKey = @"setImageOperationKey"; +SDWebImageContextOption const SDWebImageContextCustomManager = @"customManager"; +SDWebImageContextOption const SDWebImageContextImageCache = @"imageCache"; +SDWebImageContextOption const SDWebImageContextImageLoader = @"imageLoader"; +SDWebImageContextOption const SDWebImageContextImageCoder = @"imageCoder"; +SDWebImageContextOption const SDWebImageContextImageTransformer = @"imageTransformer"; +SDWebImageContextOption const SDWebImageContextImageScaleFactor = @"imageScaleFactor"; +SDWebImageContextOption const SDWebImageContextImagePreserveAspectRatio = @"imagePreserveAspectRatio"; +SDWebImageContextOption const SDWebImageContextImageThumbnailPixelSize = @"imageThumbnailPixelSize"; +SDWebImageContextOption const SDWebImageContextQueryCacheType = @"queryCacheType"; +SDWebImageContextOption const SDWebImageContextStoreCacheType = @"storeCacheType"; +SDWebImageContextOption const SDWebImageContextOriginalQueryCacheType = @"originalQueryCacheType"; +SDWebImageContextOption const SDWebImageContextOriginalStoreCacheType = @"originalStoreCacheType"; +SDWebImageContextOption const SDWebImageContextOriginalImageCache = @"originalImageCache"; +SDWebImageContextOption const SDWebImageContextAnimatedImageClass = @"animatedImageClass"; +SDWebImageContextOption const SDWebImageContextDownloadRequestModifier = @"downloadRequestModifier"; +SDWebImageContextOption const SDWebImageContextDownloadResponseModifier = @"downloadResponseModifier"; +SDWebImageContextOption const SDWebImageContextDownloadDecryptor = @"downloadDecryptor"; +SDWebImageContextOption const SDWebImageContextCacheKeyFilter = @"cacheKeyFilter"; +SDWebImageContextOption const SDWebImageContextCacheSerializer = @"cacheSerializer"; diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloader.h b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloader.h new file mode 100644 index 0000000..a2f50f4 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloader.h @@ -0,0 +1,314 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import +#import "SDWebImageCompat.h" +#import "SDWebImageDefine.h" +#import "SDWebImageOperation.h" +#import "SDWebImageDownloaderConfig.h" +#import "SDWebImageDownloaderRequestModifier.h" +#import "SDWebImageDownloaderResponseModifier.h" +#import "SDWebImageDownloaderDecryptor.h" +#import "SDImageLoader.h" + +/// Downloader options +typedef NS_OPTIONS(NSUInteger, SDWebImageDownloaderOptions) { + /** + * Put the download in the low queue priority and task priority. + */ + SDWebImageDownloaderLowPriority = 1 << 0, + + /** + * This flag enables progressive download, the image is displayed progressively during download as a browser would do. + */ + SDWebImageDownloaderProgressiveLoad = 1 << 1, + + /** + * By default, request prevent the use of NSURLCache. With this flag, NSURLCache + * is used with default policies. + */ + SDWebImageDownloaderUseNSURLCache = 1 << 2, + + /** + * Call completion block with nil image/imageData if the image was read from NSURLCache + * And the error code is `SDWebImageErrorCacheNotModified` + * This flag should be combined with `SDWebImageDownloaderUseNSURLCache`. + */ + SDWebImageDownloaderIgnoreCachedResponse = 1 << 3, + + /** + * In iOS 4+, continue the download of the image if the app goes to background. This is achieved by asking the system for + * extra time in background to let the request finish. If the background task expires the operation will be cancelled. + */ + SDWebImageDownloaderContinueInBackground = 1 << 4, + + /** + * Handles cookies stored in NSHTTPCookieStore by setting + * NSMutableURLRequest.HTTPShouldHandleCookies = YES; + */ + SDWebImageDownloaderHandleCookies = 1 << 5, + + /** + * Enable to allow untrusted SSL certificates. + * Useful for testing purposes. Use with caution in production. + */ + SDWebImageDownloaderAllowInvalidSSLCertificates = 1 << 6, + + /** + * Put the download in the high queue priority and task priority. + */ + SDWebImageDownloaderHighPriority = 1 << 7, + + /** + * By default, images are decoded respecting their original size. On iOS, this flag will scale down the + * images to a size compatible with the constrained memory of devices. + * This flag take no effect if `SDWebImageDownloaderAvoidDecodeImage` is set. And it will be ignored if `SDWebImageDownloaderProgressiveLoad` is set. + */ + SDWebImageDownloaderScaleDownLargeImages = 1 << 8, + + /** + * By default, we will decode the image in the background during cache query and download from the network. This can help to improve performance because when rendering image on the screen, it need to be firstly decoded. But this happen on the main queue by Core Animation. + * However, this process may increase the memory usage as well. If you are experiencing a issue due to excessive memory consumption, This flag can prevent decode the image. + */ + SDWebImageDownloaderAvoidDecodeImage = 1 << 9, + + /** + * By default, we decode the animated image. This flag can force decode the first frame only and produce the static image. + */ + SDWebImageDownloaderDecodeFirstFrameOnly = 1 << 10, + + /** + * By default, for `SDAnimatedImage`, we decode the animated image frame during rendering to reduce memory usage. This flag actually trigger `preloadAllAnimatedImageFrames = YES` after image load from network + */ + SDWebImageDownloaderPreloadAllFrames = 1 << 11, + + /** + * By default, when you use `SDWebImageContextAnimatedImageClass` context option (like using `SDAnimatedImageView` which designed to use `SDAnimatedImage`), we may still use `UIImage` when the memory cache hit, or image decoder is not available, to behave as a fallback solution. + * Using this option, can ensure we always produce image with your provided class. If failed, a error with code `SDWebImageErrorBadImageData` will been used. + * Note this options is not compatible with `SDWebImageDownloaderDecodeFirstFrameOnly`, which always produce a UIImage/NSImage. + */ + SDWebImageDownloaderMatchAnimatedImageClass = 1 << 12, +}; + +FOUNDATION_EXPORT NSNotificationName _Nonnull const SDWebImageDownloadStartNotification; +FOUNDATION_EXPORT NSNotificationName _Nonnull const SDWebImageDownloadReceiveResponseNotification; +FOUNDATION_EXPORT NSNotificationName _Nonnull const SDWebImageDownloadStopNotification; +FOUNDATION_EXPORT NSNotificationName _Nonnull const SDWebImageDownloadFinishNotification; + +typedef SDImageLoaderProgressBlock SDWebImageDownloaderProgressBlock; +typedef SDImageLoaderCompletedBlock SDWebImageDownloaderCompletedBlock; + +/** + * A token associated with each download. Can be used to cancel a download + */ +@interface SDWebImageDownloadToken : NSObject + +/** + Cancel the current download. + */ +- (void)cancel; + +/** + The download's URL. + */ +@property (nonatomic, strong, nullable, readonly) NSURL *url; + +/** + The download's request. + */ +@property (nonatomic, strong, nullable, readonly) NSURLRequest *request; + +/** + The download's response. + */ +@property (nonatomic, strong, nullable, readonly) NSURLResponse *response; + +/** + The download's metrics. This will be nil if download operation does not support metrics. + */ +@property (nonatomic, strong, nullable, readonly) NSURLSessionTaskMetrics *metrics API_AVAILABLE(macosx(10.12), ios(10.0), watchos(3.0), tvos(10.0)); + +@end + + +/** + * Asynchronous downloader dedicated and optimized for image loading. + */ +@interface SDWebImageDownloader : NSObject + +/** + * Downloader Config object - storing all kind of settings. + * Most config properties support dynamic changes during download, except something like `sessionConfiguration`, see `SDWebImageDownloaderConfig` for more detail. + */ +@property (nonatomic, copy, readonly, nonnull) SDWebImageDownloaderConfig *config; + +/** + * Set the request modifier to modify the original download request before image load. + * This request modifier method will be called for each downloading image request. Return the original request means no modification. Return nil will cancel the download request. + * Defaults to nil, means does not modify the original download request. + * @note If you want to modify single request, consider using `SDWebImageContextDownloadRequestModifier` context option. + */ +@property (nonatomic, strong, nullable) id requestModifier; + +/** + * Set the response modifier to modify the original download response during image load. + * This response modifier method will be called for each downloading image response. Return the original response means no modification. Return nil will mark current download as cancelled. + * Defaults to nil, means does not modify the original download response. + * @note If you want to modify single response, consider using `SDWebImageContextDownloadResponseModifier` context option. + */ +@property (nonatomic, strong, nullable) id responseModifier; + +/** + * Set the decryptor to decrypt the original download data before image decoding. This can be used for encrypted image data, like Base64. + * This decryptor method will be called for each downloading image data. Return the original data means no modification. Return nil will mark this download failed. + * Defaults to nil, means does not modify the original download data. + * @note When using decryptor, progressive decoding will be disabled, to avoid data corrupt issue. + * @note If you want to decrypt single download data, consider using `SDWebImageContextDownloadDecryptor` context option. + */ +@property (nonatomic, strong, nullable) id decryptor; + +/** + * The configuration in use by the internal NSURLSession. If you want to provide a custom sessionConfiguration, use `SDWebImageDownloaderConfig.sessionConfiguration` and create a new downloader instance. + @note This is immutable according to NSURLSession's documentation. Mutating this object directly has no effect. + */ +@property (nonatomic, readonly, nonnull) NSURLSessionConfiguration *sessionConfiguration; + +/** + * Gets/Sets the download queue suspension state. + */ +@property (nonatomic, assign, getter=isSuspended) BOOL suspended; + +/** + * Shows the current amount of downloads that still need to be downloaded + */ +@property (nonatomic, assign, readonly) NSUInteger currentDownloadCount; + +/** + * Returns the global shared downloader instance. Which use the `SDWebImageDownloaderConfig.defaultDownloaderConfig` config. + */ +@property (nonatomic, class, readonly, nonnull) SDWebImageDownloader *sharedDownloader; + +/** + Creates an instance of a downloader with specified downloader config. + You can specify session configuration, timeout or operation class through downloader config. + + @param config The downloader config. If you specify nil, the `defaultDownloaderConfig` will be used. + @return new instance of downloader class + */ +- (nonnull instancetype)initWithConfig:(nullable SDWebImageDownloaderConfig *)config NS_DESIGNATED_INITIALIZER; + +/** + * Set a value for a HTTP header to be appended to each download HTTP request. + * + * @param value The value for the header field. Use `nil` value to remove the header field. + * @param field The name of the header field to set. + */ +- (void)setValue:(nullable NSString *)value forHTTPHeaderField:(nullable NSString *)field; + +/** + * Returns the value of the specified HTTP header field. + * + * @return The value associated with the header field field, or `nil` if there is no corresponding header field. + */ +- (nullable NSString *)valueForHTTPHeaderField:(nullable NSString *)field; + +/** + * Creates a SDWebImageDownloader async downloader instance with a given URL + * + * The delegate will be informed when the image is finish downloaded or an error has happen. + * + * @see SDWebImageDownloaderDelegate + * + * @param url The URL to the image to download + * @param completedBlock A block called once the download is completed. + * If the download succeeded, the image parameter is set, in case of error, + * error parameter is set with the error. The last parameter is always YES + * if SDWebImageDownloaderProgressiveDownload isn't use. With the + * SDWebImageDownloaderProgressiveDownload option, this block is called + * repeatedly with the partial image object and the finished argument set to NO + * before to be called a last time with the full image and finished argument + * set to YES. In case of error, the finished argument is always YES. + * + * @return A token (SDWebImageDownloadToken) that can be used to cancel this operation + */ +- (nullable SDWebImageDownloadToken *)downloadImageWithURL:(nullable NSURL *)url + completed:(nullable SDWebImageDownloaderCompletedBlock)completedBlock; + +/** + * Creates a SDWebImageDownloader async downloader instance with a given URL + * + * The delegate will be informed when the image is finish downloaded or an error has happen. + * + * @see SDWebImageDownloaderDelegate + * + * @param url The URL to the image to download + * @param options The options to be used for this download + * @param progressBlock A block called repeatedly while the image is downloading + * @note the progress block is executed on a background queue + * @param completedBlock A block called once the download is completed. + * If the download succeeded, the image parameter is set, in case of error, + * error parameter is set with the error. The last parameter is always YES + * if SDWebImageDownloaderProgressiveLoad isn't use. With the + * SDWebImageDownloaderProgressiveLoad option, this block is called + * repeatedly with the partial image object and the finished argument set to NO + * before to be called a last time with the full image and finished argument + * set to YES. In case of error, the finished argument is always YES. + * + * @return A token (SDWebImageDownloadToken) that can be used to cancel this operation + */ +- (nullable SDWebImageDownloadToken *)downloadImageWithURL:(nullable NSURL *)url + options:(SDWebImageDownloaderOptions)options + progress:(nullable SDWebImageDownloaderProgressBlock)progressBlock + completed:(nullable SDWebImageDownloaderCompletedBlock)completedBlock; + +/** + * Creates a SDWebImageDownloader async downloader instance with a given URL + * + * The delegate will be informed when the image is finish downloaded or an error has happen. + * + * @see SDWebImageDownloaderDelegate + * + * @param url The URL to the image to download + * @param options The options to be used for this download + * @param context A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold. + * @param progressBlock A block called repeatedly while the image is downloading + * @note the progress block is executed on a background queue + * @param completedBlock A block called once the download is completed. + * + * @return A token (SDWebImageDownloadToken) that can be used to cancel this operation + */ +- (nullable SDWebImageDownloadToken *)downloadImageWithURL:(nullable NSURL *)url + options:(SDWebImageDownloaderOptions)options + context:(nullable SDWebImageContext *)context + progress:(nullable SDWebImageDownloaderProgressBlock)progressBlock + completed:(nullable SDWebImageDownloaderCompletedBlock)completedBlock; + +/** + * Cancels all download operations in the queue + */ +- (void)cancelAllDownloads; + +/** + * Invalidates the managed session, optionally canceling pending operations. + * @note If you use custom downloader instead of the shared downloader, you need call this method when you do not use it to avoid memory leak + * @param cancelPendingOperations Whether or not to cancel pending operations. + * @note Calling this method on the shared downloader has no effect. + */ +- (void)invalidateSessionAndCancel:(BOOL)cancelPendingOperations; + +@end + + +/** + SDWebImageDownloader is the built-in image loader conform to `SDImageLoader`. Which provide the HTTP/HTTPS/FTP download, or local file URL using NSURLSession. + However, this downloader class itself also support customization for advanced users. You can specify `operationClass` in download config to custom download operation, See `SDWebImageDownloaderOperation`. + If you want to provide some image loader which beyond network or local file, consider to create your own custom class conform to `SDImageLoader`. + */ +@interface SDWebImageDownloader (SDImageLoader) + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloader.m b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloader.m new file mode 100644 index 0000000..cd6b796 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloader.m @@ -0,0 +1,637 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageDownloader.h" +#import "SDWebImageDownloaderConfig.h" +#import "SDWebImageDownloaderOperation.h" +#import "SDWebImageError.h" +#import "SDInternalMacros.h" + +NSNotificationName const SDWebImageDownloadStartNotification = @"SDWebImageDownloadStartNotification"; +NSNotificationName const SDWebImageDownloadReceiveResponseNotification = @"SDWebImageDownloadReceiveResponseNotification"; +NSNotificationName const SDWebImageDownloadStopNotification = @"SDWebImageDownloadStopNotification"; +NSNotificationName const SDWebImageDownloadFinishNotification = @"SDWebImageDownloadFinishNotification"; + +static void * SDWebImageDownloaderContext = &SDWebImageDownloaderContext; + +@interface SDWebImageDownloadToken () + +@property (nonatomic, strong, nullable, readwrite) NSURL *url; +@property (nonatomic, strong, nullable, readwrite) NSURLRequest *request; +@property (nonatomic, strong, nullable, readwrite) NSURLResponse *response; +@property (nonatomic, strong, nullable, readwrite) NSURLSessionTaskMetrics *metrics API_AVAILABLE(macosx(10.12), ios(10.0), watchos(3.0), tvos(10.0)); +@property (nonatomic, weak, nullable, readwrite) id downloadOperationCancelToken; +@property (nonatomic, weak, nullable) NSOperation *downloadOperation; +@property (nonatomic, assign, getter=isCancelled) BOOL cancelled; + +- (nonnull instancetype)init NS_UNAVAILABLE; ++ (nonnull instancetype)new NS_UNAVAILABLE; +- (nonnull instancetype)initWithDownloadOperation:(nullable NSOperation *)downloadOperation; + +@end + +@interface SDWebImageDownloader () + +@property (strong, nonatomic, nonnull) NSOperationQueue *downloadQueue; +@property (strong, nonatomic, nonnull) NSMutableDictionary *> *URLOperations; +@property (strong, nonatomic, nullable) NSMutableDictionary *HTTPHeaders; + +// The session in which data tasks will run +@property (strong, nonatomic) NSURLSession *session; + +@end + +@implementation SDWebImageDownloader { + SD_LOCK_DECLARE(_HTTPHeadersLock); // A lock to keep the access to `HTTPHeaders` thread-safe + SD_LOCK_DECLARE(_operationsLock); // A lock to keep the access to `URLOperations` thread-safe +} + ++ (void)initialize { + // Bind SDNetworkActivityIndicator if available (download it here: http://github.com/rs/SDNetworkActivityIndicator ) + // To use it, just add #import "SDNetworkActivityIndicator.h" in addition to the SDWebImage import + if (NSClassFromString(@"SDNetworkActivityIndicator")) { + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Warc-performSelector-leaks" + id activityIndicator = [NSClassFromString(@"SDNetworkActivityIndicator") performSelector:NSSelectorFromString(@"sharedActivityIndicator")]; +#pragma clang diagnostic pop + + // Remove observer in case it was previously added. + [[NSNotificationCenter defaultCenter] removeObserver:activityIndicator name:SDWebImageDownloadStartNotification object:nil]; + [[NSNotificationCenter defaultCenter] removeObserver:activityIndicator name:SDWebImageDownloadStopNotification object:nil]; + + [[NSNotificationCenter defaultCenter] addObserver:activityIndicator + selector:NSSelectorFromString(@"startActivity") + name:SDWebImageDownloadStartNotification object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:activityIndicator + selector:NSSelectorFromString(@"stopActivity") + name:SDWebImageDownloadStopNotification object:nil]; + } +} + ++ (nonnull instancetype)sharedDownloader { + static dispatch_once_t once; + static id instance; + dispatch_once(&once, ^{ + instance = [self new]; + }); + return instance; +} + +- (nonnull instancetype)init { + return [self initWithConfig:SDWebImageDownloaderConfig.defaultDownloaderConfig]; +} + +- (instancetype)initWithConfig:(SDWebImageDownloaderConfig *)config { + self = [super init]; + if (self) { + if (!config) { + config = SDWebImageDownloaderConfig.defaultDownloaderConfig; + } + _config = [config copy]; + [_config addObserver:self forKeyPath:NSStringFromSelector(@selector(maxConcurrentDownloads)) options:0 context:SDWebImageDownloaderContext]; + _downloadQueue = [NSOperationQueue new]; + _downloadQueue.maxConcurrentOperationCount = _config.maxConcurrentDownloads; + _downloadQueue.name = @"com.hackemist.SDWebImageDownloader"; + _URLOperations = [NSMutableDictionary new]; + NSMutableDictionary *headerDictionary = [NSMutableDictionary dictionary]; + NSString *userAgent = nil; +#if SD_UIKIT + // User-Agent Header; see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.43 + userAgent = [NSString stringWithFormat:@"%@/%@ (%@; iOS %@; Scale/%0.2f)", [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleExecutableKey] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleIdentifierKey], [[NSBundle mainBundle] infoDictionary][@"CFBundleShortVersionString"] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleVersionKey], [[UIDevice currentDevice] model], [[UIDevice currentDevice] systemVersion], [[UIScreen mainScreen] scale]]; +#elif SD_WATCH + // User-Agent Header; see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.43 + userAgent = [NSString stringWithFormat:@"%@/%@ (%@; watchOS %@; Scale/%0.2f)", [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleExecutableKey] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleIdentifierKey], [[NSBundle mainBundle] infoDictionary][@"CFBundleShortVersionString"] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleVersionKey], [[WKInterfaceDevice currentDevice] model], [[WKInterfaceDevice currentDevice] systemVersion], [[WKInterfaceDevice currentDevice] screenScale]]; +#elif SD_MAC + userAgent = [NSString stringWithFormat:@"%@/%@ (Mac OS X %@)", [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleExecutableKey] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleIdentifierKey], [[NSBundle mainBundle] infoDictionary][@"CFBundleShortVersionString"] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleVersionKey], [[NSProcessInfo processInfo] operatingSystemVersionString]]; +#endif + if (userAgent) { + if (![userAgent canBeConvertedToEncoding:NSASCIIStringEncoding]) { + NSMutableString *mutableUserAgent = [userAgent mutableCopy]; + if (CFStringTransform((__bridge CFMutableStringRef)(mutableUserAgent), NULL, (__bridge CFStringRef)@"Any-Latin; Latin-ASCII; [:^ASCII:] Remove", false)) { + userAgent = mutableUserAgent; + } + } + headerDictionary[@"User-Agent"] = userAgent; + } + headerDictionary[@"Accept"] = @"image/*,*/*;q=0.8"; + _HTTPHeaders = headerDictionary; + SD_LOCK_INIT(_HTTPHeadersLock); + SD_LOCK_INIT(_operationsLock); + NSURLSessionConfiguration *sessionConfiguration = _config.sessionConfiguration; + if (!sessionConfiguration) { + sessionConfiguration = [NSURLSessionConfiguration defaultSessionConfiguration]; + } + /** + * Create the session for this task + * We send nil as delegate queue so that the session creates a serial operation queue for performing all delegate + * method calls and completion handler calls. + */ + _session = [NSURLSession sessionWithConfiguration:sessionConfiguration + delegate:self + delegateQueue:nil]; + } + return self; +} + +- (void)dealloc { + [self.downloadQueue cancelAllOperations]; + [self.config removeObserver:self forKeyPath:NSStringFromSelector(@selector(maxConcurrentDownloads)) context:SDWebImageDownloaderContext]; + + // Invalide the URLSession after all operations been cancelled + [self.session invalidateAndCancel]; + self.session = nil; +} + +- (void)invalidateSessionAndCancel:(BOOL)cancelPendingOperations { + if (self == [SDWebImageDownloader sharedDownloader]) { + return; + } + if (cancelPendingOperations) { + [self.session invalidateAndCancel]; + } else { + [self.session finishTasksAndInvalidate]; + } +} + +- (void)setValue:(nullable NSString *)value forHTTPHeaderField:(nullable NSString *)field { + if (!field) { + return; + } + SD_LOCK(_HTTPHeadersLock); + [self.HTTPHeaders setValue:value forKey:field]; + SD_UNLOCK(_HTTPHeadersLock); +} + +- (nullable NSString *)valueForHTTPHeaderField:(nullable NSString *)field { + if (!field) { + return nil; + } + SD_LOCK(_HTTPHeadersLock); + NSString *value = [self.HTTPHeaders objectForKey:field]; + SD_UNLOCK(_HTTPHeadersLock); + return value; +} + +- (nullable SDWebImageDownloadToken *)downloadImageWithURL:(NSURL *)url + completed:(SDWebImageDownloaderCompletedBlock)completedBlock { + return [self downloadImageWithURL:url options:0 progress:nil completed:completedBlock]; +} + +- (nullable SDWebImageDownloadToken *)downloadImageWithURL:(NSURL *)url + options:(SDWebImageDownloaderOptions)options + progress:(SDWebImageDownloaderProgressBlock)progressBlock + completed:(SDWebImageDownloaderCompletedBlock)completedBlock { + return [self downloadImageWithURL:url options:options context:nil progress:progressBlock completed:completedBlock]; +} + +- (nullable SDWebImageDownloadToken *)downloadImageWithURL:(nullable NSURL *)url + options:(SDWebImageDownloaderOptions)options + context:(nullable SDWebImageContext *)context + progress:(nullable SDWebImageDownloaderProgressBlock)progressBlock + completed:(nullable SDWebImageDownloaderCompletedBlock)completedBlock { + // The URL will be used as the key to the callbacks dictionary so it cannot be nil. If it is nil immediately call the completed block with no image or data. + if (url == nil) { + if (completedBlock) { + NSError *error = [NSError errorWithDomain:SDWebImageErrorDomain code:SDWebImageErrorInvalidURL userInfo:@{NSLocalizedDescriptionKey : @"Image url is nil"}]; + completedBlock(nil, nil, error, YES); + } + return nil; + } + + SD_LOCK(_operationsLock); + id downloadOperationCancelToken; + NSOperation *operation = [self.URLOperations objectForKey:url]; + // There is a case that the operation may be marked as finished or cancelled, but not been removed from `self.URLOperations`. + if (!operation || operation.isFinished || operation.isCancelled) { + operation = [self createDownloaderOperationWithUrl:url options:options context:context]; + if (!operation) { + SD_UNLOCK(_operationsLock); + if (completedBlock) { + NSError *error = [NSError errorWithDomain:SDWebImageErrorDomain code:SDWebImageErrorInvalidDownloadOperation userInfo:@{NSLocalizedDescriptionKey : @"Downloader operation is nil"}]; + completedBlock(nil, nil, error, YES); + } + return nil; + } + @weakify(self); + operation.completionBlock = ^{ + @strongify(self); + if (!self) { + return; + } + SD_LOCK(self->_operationsLock); + [self.URLOperations removeObjectForKey:url]; + SD_UNLOCK(self->_operationsLock); + }; + self.URLOperations[url] = operation; + // Add the handlers before submitting to operation queue, avoid the race condition that operation finished before setting handlers. + downloadOperationCancelToken = [operation addHandlersForProgress:progressBlock completed:completedBlock]; + // Add operation to operation queue only after all configuration done according to Apple's doc. + // `addOperation:` does not synchronously execute the `operation.completionBlock` so this will not cause deadlock. + [self.downloadQueue addOperation:operation]; + } else { + // When we reuse the download operation to attach more callbacks, there may be thread safe issue because the getter of callbacks may in another queue (decoding queue or delegate queue) + // So we lock the operation here, and in `SDWebImageDownloaderOperation`, we use `@synchonzied (self)`, to ensure the thread safe between these two classes. + @synchronized (operation) { + downloadOperationCancelToken = [operation addHandlersForProgress:progressBlock completed:completedBlock]; + } + if (!operation.isExecuting) { + if (options & SDWebImageDownloaderHighPriority) { + operation.queuePriority = NSOperationQueuePriorityHigh; + } else if (options & SDWebImageDownloaderLowPriority) { + operation.queuePriority = NSOperationQueuePriorityLow; + } else { + operation.queuePriority = NSOperationQueuePriorityNormal; + } + } + } + SD_UNLOCK(_operationsLock); + + SDWebImageDownloadToken *token = [[SDWebImageDownloadToken alloc] initWithDownloadOperation:operation]; + token.url = url; + token.request = operation.request; + token.downloadOperationCancelToken = downloadOperationCancelToken; + + return token; +} + +- (nullable NSOperation *)createDownloaderOperationWithUrl:(nonnull NSURL *)url + options:(SDWebImageDownloaderOptions)options + context:(nullable SDWebImageContext *)context { + NSTimeInterval timeoutInterval = self.config.downloadTimeout; + if (timeoutInterval == 0.0) { + timeoutInterval = 15.0; + } + + // In order to prevent from potential duplicate caching (NSURLCache + SDImageCache) we disable the cache for image requests if told otherwise + NSURLRequestCachePolicy cachePolicy = options & SDWebImageDownloaderUseNSURLCache ? NSURLRequestUseProtocolCachePolicy : NSURLRequestReloadIgnoringLocalCacheData; + NSMutableURLRequest *mutableRequest = [[NSMutableURLRequest alloc] initWithURL:url cachePolicy:cachePolicy timeoutInterval:timeoutInterval]; + mutableRequest.HTTPShouldHandleCookies = SD_OPTIONS_CONTAINS(options, SDWebImageDownloaderHandleCookies); + mutableRequest.HTTPShouldUsePipelining = YES; + SD_LOCK(_HTTPHeadersLock); + mutableRequest.allHTTPHeaderFields = self.HTTPHeaders; + SD_UNLOCK(_HTTPHeadersLock); + + // Context Option + SDWebImageMutableContext *mutableContext; + if (context) { + mutableContext = [context mutableCopy]; + } else { + mutableContext = [NSMutableDictionary dictionary]; + } + + // Request Modifier + id requestModifier; + if ([context valueForKey:SDWebImageContextDownloadRequestModifier]) { + requestModifier = [context valueForKey:SDWebImageContextDownloadRequestModifier]; + } else { + requestModifier = self.requestModifier; + } + + NSURLRequest *request; + if (requestModifier) { + NSURLRequest *modifiedRequest = [requestModifier modifiedRequestWithRequest:[mutableRequest copy]]; + // If modified request is nil, early return + if (!modifiedRequest) { + return nil; + } else { + request = [modifiedRequest copy]; + } + } else { + request = [mutableRequest copy]; + } + // Response Modifier + id responseModifier; + if ([context valueForKey:SDWebImageContextDownloadResponseModifier]) { + responseModifier = [context valueForKey:SDWebImageContextDownloadResponseModifier]; + } else { + responseModifier = self.responseModifier; + } + if (responseModifier) { + mutableContext[SDWebImageContextDownloadResponseModifier] = responseModifier; + } + // Decryptor + id decryptor; + if ([context valueForKey:SDWebImageContextDownloadDecryptor]) { + decryptor = [context valueForKey:SDWebImageContextDownloadDecryptor]; + } else { + decryptor = self.decryptor; + } + if (decryptor) { + mutableContext[SDWebImageContextDownloadDecryptor] = decryptor; + } + + context = [mutableContext copy]; + + // Operation Class + Class operationClass = self.config.operationClass; + if (operationClass && [operationClass isSubclassOfClass:[NSOperation class]] && [operationClass conformsToProtocol:@protocol(SDWebImageDownloaderOperation)]) { + // Custom operation class + } else { + operationClass = [SDWebImageDownloaderOperation class]; + } + NSOperation *operation = [[operationClass alloc] initWithRequest:request inSession:self.session options:options context:context]; + + if ([operation respondsToSelector:@selector(setCredential:)]) { + if (self.config.urlCredential) { + operation.credential = self.config.urlCredential; + } else if (self.config.username && self.config.password) { + operation.credential = [NSURLCredential credentialWithUser:self.config.username password:self.config.password persistence:NSURLCredentialPersistenceForSession]; + } + } + + if ([operation respondsToSelector:@selector(setMinimumProgressInterval:)]) { + operation.minimumProgressInterval = MIN(MAX(self.config.minimumProgressInterval, 0), 1); + } + + if ([operation respondsToSelector:@selector(setAcceptableStatusCodes:)]) { + operation.acceptableStatusCodes = self.config.acceptableStatusCodes; + } + + if ([operation respondsToSelector:@selector(setAcceptableContentTypes:)]) { + operation.acceptableContentTypes = self.config.acceptableContentTypes; + } + + if (options & SDWebImageDownloaderHighPriority) { + operation.queuePriority = NSOperationQueuePriorityHigh; + } else if (options & SDWebImageDownloaderLowPriority) { + operation.queuePriority = NSOperationQueuePriorityLow; + } + + if (self.config.executionOrder == SDWebImageDownloaderLIFOExecutionOrder) { + // Emulate LIFO execution order by systematically, each previous adding operation can dependency the new operation + // This can gurantee the new operation to be execulated firstly, even if when some operations finished, meanwhile you appending new operations + // Just make last added operation dependents new operation can not solve this problem. See test case #test15DownloaderLIFOExecutionOrder + for (NSOperation *pendingOperation in self.downloadQueue.operations) { + [pendingOperation addDependency:operation]; + } + } + + return operation; +} + +- (void)cancelAllDownloads { + [self.downloadQueue cancelAllOperations]; +} + +#pragma mark - Properties + +- (BOOL)isSuspended { + return self.downloadQueue.isSuspended; +} + +- (void)setSuspended:(BOOL)suspended { + self.downloadQueue.suspended = suspended; +} + +- (NSUInteger)currentDownloadCount { + return self.downloadQueue.operationCount; +} + +- (NSURLSessionConfiguration *)sessionConfiguration { + return self.session.configuration; +} + +#pragma mark - KVO + +- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { + if (context == SDWebImageDownloaderContext) { + if ([keyPath isEqualToString:NSStringFromSelector(@selector(maxConcurrentDownloads))]) { + self.downloadQueue.maxConcurrentOperationCount = self.config.maxConcurrentDownloads; + } + } else { + [super observeValueForKeyPath:keyPath ofObject:object change:change context:context]; + } +} + +#pragma mark Helper methods + +- (NSOperation *)operationWithTask:(NSURLSessionTask *)task { + NSOperation *returnOperation = nil; + for (NSOperation *operation in self.downloadQueue.operations) { + if ([operation respondsToSelector:@selector(dataTask)]) { + // So we lock the operation here, and in `SDWebImageDownloaderOperation`, we use `@synchonzied (self)`, to ensure the thread safe between these two classes. + NSURLSessionTask *operationTask; + @synchronized (operation) { + operationTask = operation.dataTask; + } + if (operationTask.taskIdentifier == task.taskIdentifier) { + returnOperation = operation; + break; + } + } + } + return returnOperation; +} + +#pragma mark NSURLSessionDataDelegate + +- (void)URLSession:(NSURLSession *)session + dataTask:(NSURLSessionDataTask *)dataTask +didReceiveResponse:(NSURLResponse *)response + completionHandler:(void (^)(NSURLSessionResponseDisposition disposition))completionHandler { + + // Identify the operation that runs this task and pass it the delegate method + NSOperation *dataOperation = [self operationWithTask:dataTask]; + if ([dataOperation respondsToSelector:@selector(URLSession:dataTask:didReceiveResponse:completionHandler:)]) { + [dataOperation URLSession:session dataTask:dataTask didReceiveResponse:response completionHandler:completionHandler]; + } else { + if (completionHandler) { + completionHandler(NSURLSessionResponseAllow); + } + } +} + +- (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)dataTask didReceiveData:(NSData *)data { + + // Identify the operation that runs this task and pass it the delegate method + NSOperation *dataOperation = [self operationWithTask:dataTask]; + if ([dataOperation respondsToSelector:@selector(URLSession:dataTask:didReceiveData:)]) { + [dataOperation URLSession:session dataTask:dataTask didReceiveData:data]; + } +} + +- (void)URLSession:(NSURLSession *)session + dataTask:(NSURLSessionDataTask *)dataTask + willCacheResponse:(NSCachedURLResponse *)proposedResponse + completionHandler:(void (^)(NSCachedURLResponse *cachedResponse))completionHandler { + + // Identify the operation that runs this task and pass it the delegate method + NSOperation *dataOperation = [self operationWithTask:dataTask]; + if ([dataOperation respondsToSelector:@selector(URLSession:dataTask:willCacheResponse:completionHandler:)]) { + [dataOperation URLSession:session dataTask:dataTask willCacheResponse:proposedResponse completionHandler:completionHandler]; + } else { + if (completionHandler) { + completionHandler(proposedResponse); + } + } +} + +#pragma mark NSURLSessionTaskDelegate + +- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didCompleteWithError:(NSError *)error { + + // Identify the operation that runs this task and pass it the delegate method + NSOperation *dataOperation = [self operationWithTask:task]; + if ([dataOperation respondsToSelector:@selector(URLSession:task:didCompleteWithError:)]) { + [dataOperation URLSession:session task:task didCompleteWithError:error]; + } +} + +- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task willPerformHTTPRedirection:(NSHTTPURLResponse *)response newRequest:(NSURLRequest *)request completionHandler:(void (^)(NSURLRequest * _Nullable))completionHandler { + + // Identify the operation that runs this task and pass it the delegate method + NSOperation *dataOperation = [self operationWithTask:task]; + if ([dataOperation respondsToSelector:@selector(URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:)]) { + [dataOperation URLSession:session task:task willPerformHTTPRedirection:response newRequest:request completionHandler:completionHandler]; + } else { + if (completionHandler) { + completionHandler(request); + } + } +} + +- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential))completionHandler { + + // Identify the operation that runs this task and pass it the delegate method + NSOperation *dataOperation = [self operationWithTask:task]; + if ([dataOperation respondsToSelector:@selector(URLSession:task:didReceiveChallenge:completionHandler:)]) { + [dataOperation URLSession:session task:task didReceiveChallenge:challenge completionHandler:completionHandler]; + } else { + if (completionHandler) { + completionHandler(NSURLSessionAuthChallengePerformDefaultHandling, nil); + } + } +} + +- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didFinishCollectingMetrics:(NSURLSessionTaskMetrics *)metrics API_AVAILABLE(macosx(10.12), ios(10.0), watchos(3.0), tvos(10.0)) { + + // Identify the operation that runs this task and pass it the delegate method + NSOperation *dataOperation = [self operationWithTask:task]; + if ([dataOperation respondsToSelector:@selector(URLSession:task:didFinishCollectingMetrics:)]) { + [dataOperation URLSession:session task:task didFinishCollectingMetrics:metrics]; + } +} + +@end + +@implementation SDWebImageDownloadToken + +- (void)dealloc { + [[NSNotificationCenter defaultCenter] removeObserver:self name:SDWebImageDownloadReceiveResponseNotification object:nil]; + [[NSNotificationCenter defaultCenter] removeObserver:self name:SDWebImageDownloadStopNotification object:nil]; +} + +- (instancetype)initWithDownloadOperation:(NSOperation *)downloadOperation { + self = [super init]; + if (self) { + _downloadOperation = downloadOperation; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(downloadDidReceiveResponse:) name:SDWebImageDownloadReceiveResponseNotification object:downloadOperation]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(downloadDidStop:) name:SDWebImageDownloadStopNotification object:downloadOperation]; + } + return self; +} + +- (void)downloadDidReceiveResponse:(NSNotification *)notification { + NSOperation *downloadOperation = notification.object; + if (downloadOperation && downloadOperation == self.downloadOperation) { + self.response = downloadOperation.response; + } +} + +- (void)downloadDidStop:(NSNotification *)notification { + NSOperation *downloadOperation = notification.object; + if (downloadOperation && downloadOperation == self.downloadOperation) { + if ([downloadOperation respondsToSelector:@selector(metrics)]) { + if (@available(iOS 10.0, tvOS 10.0, macOS 10.12, watchOS 3.0, *)) { + self.metrics = downloadOperation.metrics; + } + } + } +} + +- (void)cancel { + @synchronized (self) { + if (self.isCancelled) { + return; + } + self.cancelled = YES; + [self.downloadOperation cancel:self.downloadOperationCancelToken]; + self.downloadOperationCancelToken = nil; + } +} + +@end + +@implementation SDWebImageDownloader (SDImageLoader) + +- (BOOL)canRequestImageForURL:(NSURL *)url { + return [self canRequestImageForURL:url options:0 context:nil]; +} + +- (BOOL)canRequestImageForURL:(NSURL *)url options:(SDWebImageOptions)options context:(SDWebImageContext *)context { + if (!url) { + return NO; + } + // Always pass YES to let URLSession or custom download operation to determine + return YES; +} + +- (id)requestImageWithURL:(NSURL *)url options:(SDWebImageOptions)options context:(SDWebImageContext *)context progress:(SDImageLoaderProgressBlock)progressBlock completed:(SDImageLoaderCompletedBlock)completedBlock { + UIImage *cachedImage = context[SDWebImageContextLoaderCachedImage]; + + SDWebImageDownloaderOptions downloaderOptions = 0; + if (options & SDWebImageLowPriority) downloaderOptions |= SDWebImageDownloaderLowPriority; + if (options & SDWebImageProgressiveLoad) downloaderOptions |= SDWebImageDownloaderProgressiveLoad; + if (options & SDWebImageRefreshCached) downloaderOptions |= SDWebImageDownloaderUseNSURLCache; + if (options & SDWebImageContinueInBackground) downloaderOptions |= SDWebImageDownloaderContinueInBackground; + if (options & SDWebImageHandleCookies) downloaderOptions |= SDWebImageDownloaderHandleCookies; + if (options & SDWebImageAllowInvalidSSLCertificates) downloaderOptions |= SDWebImageDownloaderAllowInvalidSSLCertificates; + if (options & SDWebImageHighPriority) downloaderOptions |= SDWebImageDownloaderHighPriority; + if (options & SDWebImageScaleDownLargeImages) downloaderOptions |= SDWebImageDownloaderScaleDownLargeImages; + if (options & SDWebImageAvoidDecodeImage) downloaderOptions |= SDWebImageDownloaderAvoidDecodeImage; + if (options & SDWebImageDecodeFirstFrameOnly) downloaderOptions |= SDWebImageDownloaderDecodeFirstFrameOnly; + if (options & SDWebImagePreloadAllFrames) downloaderOptions |= SDWebImageDownloaderPreloadAllFrames; + if (options & SDWebImageMatchAnimatedImageClass) downloaderOptions |= SDWebImageDownloaderMatchAnimatedImageClass; + + if (cachedImage && options & SDWebImageRefreshCached) { + // force progressive off if image already cached but forced refreshing + downloaderOptions &= ~SDWebImageDownloaderProgressiveLoad; + // ignore image read from NSURLCache if image if cached but force refreshing + downloaderOptions |= SDWebImageDownloaderIgnoreCachedResponse; + } + + return [self downloadImageWithURL:url options:downloaderOptions context:context progress:progressBlock completed:completedBlock]; +} + +- (BOOL)shouldBlockFailedURLWithURL:(NSURL *)url error:(NSError *)error { + return [self shouldBlockFailedURLWithURL:url error:error options:0 context:nil]; +} + +- (BOOL)shouldBlockFailedURLWithURL:(NSURL *)url error:(NSError *)error options:(SDWebImageOptions)options context:(SDWebImageContext *)context { + BOOL shouldBlockFailedURL; + // Filter the error domain and check error codes + if ([error.domain isEqualToString:SDWebImageErrorDomain]) { + shouldBlockFailedURL = ( error.code == SDWebImageErrorInvalidURL + || error.code == SDWebImageErrorBadImageData); + } else if ([error.domain isEqualToString:NSURLErrorDomain]) { + shouldBlockFailedURL = ( error.code != NSURLErrorNotConnectedToInternet + && error.code != NSURLErrorCancelled + && error.code != NSURLErrorTimedOut + && error.code != NSURLErrorInternationalRoamingOff + && error.code != NSURLErrorDataNotAllowed + && error.code != NSURLErrorCannotFindHost + && error.code != NSURLErrorCannotConnectToHost + && error.code != NSURLErrorNetworkConnectionLost); + } else { + shouldBlockFailedURL = NO; + } + return shouldBlockFailedURL; +} + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderConfig.h b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderConfig.h new file mode 100644 index 0000000..9d5e67b --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderConfig.h @@ -0,0 +1,113 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import +#import "SDWebImageCompat.h" + +/// Operation execution order +typedef NS_ENUM(NSInteger, SDWebImageDownloaderExecutionOrder) { + /** + * Default value. All download operations will execute in queue style (first-in-first-out). + */ + SDWebImageDownloaderFIFOExecutionOrder, + + /** + * All download operations will execute in stack style (last-in-first-out). + */ + SDWebImageDownloaderLIFOExecutionOrder +}; + +/** + The class contains all the config for image downloader + @note This class conform to NSCopying, make sure to add the property in `copyWithZone:` as well. + */ +@interface SDWebImageDownloaderConfig : NSObject + +/** + Gets the default downloader config used for shared instance or initialization when it does not provide any downloader config. Such as `SDWebImageDownloader.sharedDownloader`. + @note You can modify the property on default downloader config, which can be used for later created downloader instance. The already created downloader instance does not get affected. + */ +@property (nonatomic, class, readonly, nonnull) SDWebImageDownloaderConfig *defaultDownloaderConfig; + +/** + * The maximum number of concurrent downloads. + * Defaults to 6. + */ +@property (nonatomic, assign) NSInteger maxConcurrentDownloads; + +/** + * The timeout value (in seconds) for each download operation. + * Defaults to 15.0. + */ +@property (nonatomic, assign) NSTimeInterval downloadTimeout; + +/** + * The minimum interval about progress percent during network downloading. Which means the next progress callback and current progress callback's progress percent difference should be larger or equal to this value. However, the final finish download progress callback does not get effected. + * The value should be 0.0-1.0. + * @note If you're using progressive decoding feature, this will also effect the image refresh rate. + * @note This value may enhance the performance if you don't want progress callback too frequently. + * Defaults to 0, which means each time we receive the new data from URLSession, we callback the progressBlock immediately. + */ +@property (nonatomic, assign) double minimumProgressInterval; + +/** + * The custom session configuration in use by NSURLSession. If you don't provide one, we will use `defaultSessionConfiguration` instead. + * Defatuls to nil. + * @note This property does not support dynamic changes, means it's immutable after the downloader instance initialized. + */ +@property (nonatomic, strong, nullable) NSURLSessionConfiguration *sessionConfiguration; + +/** + * Gets/Sets a subclass of `SDWebImageDownloaderOperation` as the default + * `NSOperation` to be used each time SDWebImage constructs a request + * operation to download an image. + * Defaults to nil. + * @note Passing `NSOperation` to set as default. Passing `nil` will revert to `SDWebImageDownloaderOperation`. + */ +@property (nonatomic, assign, nullable) Class operationClass; + +/** + * Changes download operations execution order. + * Defaults to `SDWebImageDownloaderFIFOExecutionOrder`. + */ +@property (nonatomic, assign) SDWebImageDownloaderExecutionOrder executionOrder; + +/** + * Set the default URL credential to be set for request operations. + * Defaults to nil. + */ +@property (nonatomic, copy, nullable) NSURLCredential *urlCredential; + +/** + * Set username using for HTTP Basic authentication. + * Defaults to nil. + */ +@property (nonatomic, copy, nullable) NSString *username; + +/** + * Set password using for HTTP Basic authentication. + * Defaults to nil. + */ +@property (nonatomic, copy, nullable) NSString *password; + +/** + * Set the acceptable HTTP Response status code. The status code which beyond the range will mark the download operation failed. + * For example, if we config [200, 400) but server response is 503, the download will fail with error code `SDWebImageErrorInvalidDownloadStatusCode`. + * Defaults to [200,400). Nil means no validation at all. + */ +@property (nonatomic, copy, nullable) NSIndexSet *acceptableStatusCodes; + +/** + * Set the acceptable HTTP Response content type. The content type beyond the set will mark the download operation failed. + * For example, if we config ["image/png"] but server response is "application/json", the download will fail with error code `SDWebImageErrorInvalidDownloadContentType`. + * Normally you don't need this for image format detection because we use image's data file signature magic bytes: https://en.wikipedia.org/wiki/List_of_file_signatures + * Defaults to nil. Nil means no validation at all. + */ +@property (nonatomic, copy, nullable) NSSet *acceptableContentTypes; + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderConfig.m b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderConfig.m new file mode 100644 index 0000000..6120bd8 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderConfig.m @@ -0,0 +1,52 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageDownloaderConfig.h" + +static SDWebImageDownloaderConfig * _defaultDownloaderConfig; + +@implementation SDWebImageDownloaderConfig + ++ (SDWebImageDownloaderConfig *)defaultDownloaderConfig { + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + _defaultDownloaderConfig = [SDWebImageDownloaderConfig new]; + }); + return _defaultDownloaderConfig; +} + +- (instancetype)init { + self = [super init]; + if (self) { + _maxConcurrentDownloads = 6; + _downloadTimeout = 15.0; + _executionOrder = SDWebImageDownloaderFIFOExecutionOrder; + _acceptableStatusCodes = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(200, 100)]; + } + return self; +} + +- (id)copyWithZone:(NSZone *)zone { + SDWebImageDownloaderConfig *config = [[[self class] allocWithZone:zone] init]; + config.maxConcurrentDownloads = self.maxConcurrentDownloads; + config.downloadTimeout = self.downloadTimeout; + config.minimumProgressInterval = self.minimumProgressInterval; + config.sessionConfiguration = [self.sessionConfiguration copyWithZone:zone]; + config.operationClass = self.operationClass; + config.executionOrder = self.executionOrder; + config.urlCredential = self.urlCredential; + config.username = self.username; + config.password = self.password; + config.acceptableStatusCodes = self.acceptableStatusCodes; + config.acceptableContentTypes = self.acceptableContentTypes; + + return config; +} + + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderDecryptor.h b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderDecryptor.h new file mode 100644 index 0000000..0923f29 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderDecryptor.h @@ -0,0 +1,49 @@ +/* +* This file is part of the SDWebImage package. +* (c) Olivier Poitrey +* +* For the full copyright and license information, please view the LICENSE +* file that was distributed with this source code. +*/ + +#import +#import "SDWebImageCompat.h" + +typedef NSData * _Nullable (^SDWebImageDownloaderDecryptorBlock)(NSData * _Nonnull data, NSURLResponse * _Nullable response); + +/** +This is the protocol for downloader decryptor. Which decrypt the original encrypted data before decoding. Note progressive decoding is not compatible for decryptor. +We can use a block to specify the downloader decryptor. But Using protocol can make this extensible, and allow Swift user to use it easily instead of using `@convention(block)` to store a block into context options. +*/ +@protocol SDWebImageDownloaderDecryptor + +/// Decrypt the original download data and return a new data. You can use this to decrypt the data using your preferred algorithm. +/// @param data The original download data +/// @param response The URL response for data. If you modify the original URL response via response modifier, the modified version will be here. This arg is nullable. +/// @note If nil is returned, the image download will be marked as failed with error `SDWebImageErrorBadImageData` +- (nullable NSData *)decryptedDataWithData:(nonnull NSData *)data response:(nullable NSURLResponse *)response; + +@end + +/** +A downloader response modifier class with block. +*/ +@interface SDWebImageDownloaderDecryptor : NSObject + +/// Create the data decryptor with block +/// @param block A block to control decrypt logic +- (nonnull instancetype)initWithBlock:(nonnull SDWebImageDownloaderDecryptorBlock)block; + +/// Create the data decryptor with block +/// @param block A block to control decrypt logic ++ (nonnull instancetype)decryptorWithBlock:(nonnull SDWebImageDownloaderDecryptorBlock)block; + +@end + +/// Convenience way to create decryptor for common data encryption. +@interface SDWebImageDownloaderDecryptor (Conveniences) + +/// Base64 Encoded image data decryptor +@property (class, readonly, nonnull) SDWebImageDownloaderDecryptor *base64Decryptor; + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderDecryptor.m b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderDecryptor.m new file mode 100644 index 0000000..a3b75b2 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderDecryptor.m @@ -0,0 +1,55 @@ +/* +* This file is part of the SDWebImage package. +* (c) Olivier Poitrey +* +* For the full copyright and license information, please view the LICENSE +* file that was distributed with this source code. +*/ + +#import "SDWebImageDownloaderDecryptor.h" + +@interface SDWebImageDownloaderDecryptor () + +@property (nonatomic, copy, nonnull) SDWebImageDownloaderDecryptorBlock block; + +@end + +@implementation SDWebImageDownloaderDecryptor + +- (instancetype)initWithBlock:(SDWebImageDownloaderDecryptorBlock)block { + self = [super init]; + if (self) { + self.block = block; + } + return self; +} + ++ (instancetype)decryptorWithBlock:(SDWebImageDownloaderDecryptorBlock)block { + SDWebImageDownloaderDecryptor *decryptor = [[SDWebImageDownloaderDecryptor alloc] initWithBlock:block]; + return decryptor; +} + +- (nullable NSData *)decryptedDataWithData:(nonnull NSData *)data response:(nullable NSURLResponse *)response { + if (!self.block) { + return nil; + } + return self.block(data, response); +} + +@end + +@implementation SDWebImageDownloaderDecryptor (Conveniences) + ++ (SDWebImageDownloaderDecryptor *)base64Decryptor { + static SDWebImageDownloaderDecryptor *decryptor; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + decryptor = [SDWebImageDownloaderDecryptor decryptorWithBlock:^NSData * _Nullable(NSData * _Nonnull data, NSURLResponse * _Nullable response) { + NSData *modifiedData = [[NSData alloc] initWithBase64EncodedData:data options:NSDataBase64DecodingIgnoreUnknownCharacters]; + return modifiedData; + }]; + }); + return decryptor; +} + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderOperation.h b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderOperation.h new file mode 100644 index 0000000..1cd2a50 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderOperation.h @@ -0,0 +1,172 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import +#import "SDWebImageDownloader.h" +#import "SDWebImageOperation.h" + +/** + Describes a downloader operation. If one wants to use a custom downloader op, it needs to inherit from `NSOperation` and conform to this protocol + For the description about these methods, see `SDWebImageDownloaderOperation` + @note If your custom operation class does not use `NSURLSession` at all, do not implement the optional methods and session delegate methods. + */ +@protocol SDWebImageDownloaderOperation +@required +- (nonnull instancetype)initWithRequest:(nullable NSURLRequest *)request + inSession:(nullable NSURLSession *)session + options:(SDWebImageDownloaderOptions)options; + +- (nonnull instancetype)initWithRequest:(nullable NSURLRequest *)request + inSession:(nullable NSURLSession *)session + options:(SDWebImageDownloaderOptions)options + context:(nullable SDWebImageContext *)context; + +- (nullable id)addHandlersForProgress:(nullable SDWebImageDownloaderProgressBlock)progressBlock + completed:(nullable SDWebImageDownloaderCompletedBlock)completedBlock; + +- (BOOL)cancel:(nullable id)token; + +@property (strong, nonatomic, readonly, nullable) NSURLRequest *request; +@property (strong, nonatomic, readonly, nullable) NSURLResponse *response; + +@optional +@property (strong, nonatomic, readonly, nullable) NSURLSessionTask *dataTask; +@property (strong, nonatomic, readonly, nullable) NSURLSessionTaskMetrics *metrics API_AVAILABLE(macosx(10.12), ios(10.0), watchos(3.0), tvos(10.0)); + +// These operation-level config was inherited from downloader. See `SDWebImageDownloaderConfig` for documentation. +@property (strong, nonatomic, nullable) NSURLCredential *credential; +@property (assign, nonatomic) double minimumProgressInterval; +@property (copy, nonatomic, nullable) NSIndexSet *acceptableStatusCodes; +@property (copy, nonatomic, nullable) NSSet *acceptableContentTypes; + +@end + + +/** + The download operation class for SDWebImageDownloader. + */ +@interface SDWebImageDownloaderOperation : NSOperation + +/** + * The request used by the operation's task. + */ +@property (strong, nonatomic, readonly, nullable) NSURLRequest *request; + +/** + * The response returned by the operation's task. + */ +@property (strong, nonatomic, readonly, nullable) NSURLResponse *response; + +/** + * The operation's task + */ +@property (strong, nonatomic, readonly, nullable) NSURLSessionTask *dataTask; + +/** + * The collected metrics from `-URLSession:task:didFinishCollectingMetrics:`. + * This can be used to collect the network metrics like download duration, DNS lookup duration, SSL handshake duration, etc. See Apple's documentation: https://developer.apple.com/documentation/foundation/urlsessiontaskmetrics + */ +@property (strong, nonatomic, readonly, nullable) NSURLSessionTaskMetrics *metrics API_AVAILABLE(macosx(10.12), ios(10.0), watchos(3.0), tvos(10.0)); + +/** + * The credential used for authentication challenges in `-URLSession:task:didReceiveChallenge:completionHandler:`. + * + * This will be overridden by any shared credentials that exist for the username or password of the request URL, if present. + */ +@property (strong, nonatomic, nullable) NSURLCredential *credential; + +/** + * The minimum interval about progress percent during network downloading. Which means the next progress callback and current progress callback's progress percent difference should be larger or equal to this value. However, the final finish download progress callback does not get effected. + * The value should be 0.0-1.0. + * @note If you're using progressive decoding feature, this will also effect the image refresh rate. + * @note This value may enhance the performance if you don't want progress callback too frequently. + * Defaults to 0, which means each time we receive the new data from URLSession, we callback the progressBlock immediately. + */ +@property (assign, nonatomic) double minimumProgressInterval; + +/** + * Set the acceptable HTTP Response status code. The status code which beyond the range will mark the download operation failed. + * For example, if we config [200, 400) but server response is 503, the download will fail with error code `SDWebImageErrorInvalidDownloadStatusCode`. + * Defaults to [200,400). Nil means no validation at all. + */ +@property (copy, nonatomic, nullable) NSIndexSet *acceptableStatusCodes; + +/** + * Set the acceptable HTTP Response content type. The content type beyond the set will mark the download operation failed. + * For example, if we config ["image/png"] but server response is "application/json", the download will fail with error code `SDWebImageErrorInvalidDownloadContentType`. + * Normally you don't need this for image format detection because we use image's data file signature magic bytes: https://en.wikipedia.org/wiki/List_of_file_signatures + * Defaults to nil. Nil means no validation at all. + */ +@property (copy, nonatomic, nullable) NSSet *acceptableContentTypes; + +/** + * The options for the receiver. + */ +@property (assign, nonatomic, readonly) SDWebImageDownloaderOptions options; + +/** + * The context for the receiver. + */ +@property (copy, nonatomic, readonly, nullable) SDWebImageContext *context; + +/** + * Initializes a `SDWebImageDownloaderOperation` object + * + * @see SDWebImageDownloaderOperation + * + * @param request the URL request + * @param session the URL session in which this operation will run + * @param options downloader options + * + * @return the initialized instance + */ +- (nonnull instancetype)initWithRequest:(nullable NSURLRequest *)request + inSession:(nullable NSURLSession *)session + options:(SDWebImageDownloaderOptions)options; + +/** + * Initializes a `SDWebImageDownloaderOperation` object + * + * @see SDWebImageDownloaderOperation + * + * @param request the URL request + * @param session the URL session in which this operation will run + * @param options downloader options + * @param context A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold. + * + * @return the initialized instance + */ +- (nonnull instancetype)initWithRequest:(nullable NSURLRequest *)request + inSession:(nullable NSURLSession *)session + options:(SDWebImageDownloaderOptions)options + context:(nullable SDWebImageContext *)context NS_DESIGNATED_INITIALIZER; + +/** + * Adds handlers for progress and completion. Returns a token that can be passed to -cancel: to cancel this set of + * callbacks. + * + * @param progressBlock the block executed when a new chunk of data arrives. + * @note the progress block is executed on a background queue + * @param completedBlock the block executed when the download is done. + * @note the completed block is executed on the main queue for success. If errors are found, there is a chance the block will be executed on a background queue + * + * @return the token to use to cancel this set of handlers + */ +- (nullable id)addHandlersForProgress:(nullable SDWebImageDownloaderProgressBlock)progressBlock + completed:(nullable SDWebImageDownloaderCompletedBlock)completedBlock; + +/** + * Cancels a set of callbacks. Once all callbacks are canceled, the operation is cancelled. + * + * @param token the token representing a set of callbacks to cancel + * + * @return YES if the operation was stopped because this was the last token to be canceled. NO otherwise. + */ +- (BOOL)cancel:(nullable id)token; + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderOperation.m b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderOperation.m new file mode 100644 index 0000000..6df0319 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderOperation.m @@ -0,0 +1,618 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageDownloaderOperation.h" +#import "SDWebImageError.h" +#import "SDInternalMacros.h" +#import "SDWebImageDownloaderResponseModifier.h" +#import "SDWebImageDownloaderDecryptor.h" + +static NSString *const kProgressCallbackKey = @"progress"; +static NSString *const kCompletedCallbackKey = @"completed"; + +typedef NSMutableDictionary SDCallbacksDictionary; + +@interface SDWebImageDownloaderOperation () + +@property (strong, nonatomic, nonnull) NSMutableArray *callbackBlocks; + +@property (assign, nonatomic, readwrite) SDWebImageDownloaderOptions options; +@property (copy, nonatomic, readwrite, nullable) SDWebImageContext *context; + +@property (assign, nonatomic, getter = isExecuting) BOOL executing; +@property (assign, nonatomic, getter = isFinished) BOOL finished; +@property (strong, nonatomic, nullable) NSMutableData *imageData; +@property (copy, nonatomic, nullable) NSData *cachedData; // for `SDWebImageDownloaderIgnoreCachedResponse` +@property (assign, nonatomic) NSUInteger expectedSize; // may be 0 +@property (assign, nonatomic) NSUInteger receivedSize; +@property (strong, nonatomic, nullable, readwrite) NSURLResponse *response; +@property (strong, nonatomic, nullable) NSError *responseError; +@property (assign, nonatomic) double previousProgress; // previous progress percent + +@property (strong, nonatomic, nullable) id responseModifier; // modify original URLResponse +@property (strong, nonatomic, nullable) id decryptor; // decrypt image data + +// This is weak because it is injected by whoever manages this session. If this gets nil-ed out, we won't be able to run +// the task associated with this operation +@property (weak, nonatomic, nullable) NSURLSession *unownedSession; +// This is set if we're using not using an injected NSURLSession. We're responsible of invalidating this one +@property (strong, nonatomic, nullable) NSURLSession *ownedSession; + +@property (strong, nonatomic, readwrite, nullable) NSURLSessionTask *dataTask; + +@property (strong, nonatomic, readwrite, nullable) NSURLSessionTaskMetrics *metrics API_AVAILABLE(macosx(10.12), ios(10.0), watchos(3.0), tvos(10.0)); + +@property (strong, nonatomic, nonnull) NSOperationQueue *coderQueue; // the serial operation queue to do image decoding +#if SD_UIKIT +@property (assign, nonatomic) UIBackgroundTaskIdentifier backgroundTaskId; +#endif + +@end + +@implementation SDWebImageDownloaderOperation + +@synthesize executing = _executing; +@synthesize finished = _finished; + +- (nonnull instancetype)init { + return [self initWithRequest:nil inSession:nil options:0]; +} + +- (instancetype)initWithRequest:(NSURLRequest *)request inSession:(NSURLSession *)session options:(SDWebImageDownloaderOptions)options { + return [self initWithRequest:request inSession:session options:options context:nil]; +} + +- (nonnull instancetype)initWithRequest:(nullable NSURLRequest *)request + inSession:(nullable NSURLSession *)session + options:(SDWebImageDownloaderOptions)options + context:(nullable SDWebImageContext *)context { + if ((self = [super init])) { + _request = [request copy]; + _options = options; + _context = [context copy]; + _callbackBlocks = [NSMutableArray new]; + _responseModifier = context[SDWebImageContextDownloadResponseModifier]; + _decryptor = context[SDWebImageContextDownloadDecryptor]; + _executing = NO; + _finished = NO; + _expectedSize = 0; + _unownedSession = session; + _coderQueue = [NSOperationQueue new]; + _coderQueue.maxConcurrentOperationCount = 1; +#if SD_UIKIT + _backgroundTaskId = UIBackgroundTaskInvalid; +#endif + } + return self; +} + +- (nullable id)addHandlersForProgress:(nullable SDWebImageDownloaderProgressBlock)progressBlock + completed:(nullable SDWebImageDownloaderCompletedBlock)completedBlock { + SDCallbacksDictionary *callbacks = [NSMutableDictionary new]; + if (progressBlock) callbacks[kProgressCallbackKey] = [progressBlock copy]; + if (completedBlock) callbacks[kCompletedCallbackKey] = [completedBlock copy]; + @synchronized (self) { + [self.callbackBlocks addObject:callbacks]; + } + return callbacks; +} + +- (nullable NSArray *)callbacksForKey:(NSString *)key { + NSMutableArray *callbacks; + @synchronized (self) { + callbacks = [[self.callbackBlocks valueForKey:key] mutableCopy]; + } + // We need to remove [NSNull null] because there might not always be a progress block for each callback + [callbacks removeObjectIdenticalTo:[NSNull null]]; + return [callbacks copy]; // strip mutability here +} + +- (BOOL)cancel:(nullable id)token { + if (!token) return NO; + + BOOL shouldCancel = NO; + @synchronized (self) { + NSMutableArray *tempCallbackBlocks = [self.callbackBlocks mutableCopy]; + [tempCallbackBlocks removeObjectIdenticalTo:token]; + if (tempCallbackBlocks.count == 0) { + shouldCancel = YES; + } + } + if (shouldCancel) { + // Cancel operation running and callback last token's completion block + [self cancel]; + } else { + // Only callback this token's completion block + @synchronized (self) { + [self.callbackBlocks removeObjectIdenticalTo:token]; + } + SDWebImageDownloaderCompletedBlock completedBlock = [token valueForKey:kCompletedCallbackKey]; + dispatch_main_async_safe(^{ + if (completedBlock) { + completedBlock(nil, nil, [NSError errorWithDomain:SDWebImageErrorDomain code:SDWebImageErrorCancelled userInfo:@{NSLocalizedDescriptionKey : @"Operation cancelled by user during sending the request"}], YES); + } + }); + } + return shouldCancel; +} + +- (void)start { + @synchronized (self) { + if (self.isCancelled) { + if (!self.isFinished) self.finished = YES; + // Operation cancelled by user before sending the request + [self callCompletionBlocksWithError:[NSError errorWithDomain:SDWebImageErrorDomain code:SDWebImageErrorCancelled userInfo:@{NSLocalizedDescriptionKey : @"Operation cancelled by user before sending the request"}]]; + [self reset]; + return; + } + +#if SD_UIKIT + Class UIApplicationClass = NSClassFromString(@"UIApplication"); + BOOL hasApplication = UIApplicationClass && [UIApplicationClass respondsToSelector:@selector(sharedApplication)]; + if (hasApplication && [self shouldContinueWhenAppEntersBackground]) { + __weak typeof(self) wself = self; + UIApplication * app = [UIApplicationClass performSelector:@selector(sharedApplication)]; + self.backgroundTaskId = [app beginBackgroundTaskWithExpirationHandler:^{ + [wself cancel]; + }]; + } +#endif + NSURLSession *session = self.unownedSession; + if (!session) { + NSURLSessionConfiguration *sessionConfig = [NSURLSessionConfiguration defaultSessionConfiguration]; + sessionConfig.timeoutIntervalForRequest = 15; + + /** + * Create the session for this task + * We send nil as delegate queue so that the session creates a serial operation queue for performing all delegate + * method calls and completion handler calls. + */ + session = [NSURLSession sessionWithConfiguration:sessionConfig + delegate:self + delegateQueue:nil]; + self.ownedSession = session; + } + + if (self.options & SDWebImageDownloaderIgnoreCachedResponse) { + // Grab the cached data for later check + NSURLCache *URLCache = session.configuration.URLCache; + if (!URLCache) { + URLCache = [NSURLCache sharedURLCache]; + } + NSCachedURLResponse *cachedResponse; + // NSURLCache's `cachedResponseForRequest:` is not thread-safe, see https://developer.apple.com/documentation/foundation/nsurlcache#2317483 + @synchronized (URLCache) { + cachedResponse = [URLCache cachedResponseForRequest:self.request]; + } + if (cachedResponse) { + self.cachedData = cachedResponse.data; + self.response = cachedResponse.response; + } + } + + if (!session.delegate) { + // Session been invalid and has no delegate at all + [self callCompletionBlocksWithError:[NSError errorWithDomain:SDWebImageErrorDomain code:SDWebImageErrorInvalidDownloadOperation userInfo:@{NSLocalizedDescriptionKey : @"Session delegate is nil and invalid"}]]; + [self reset]; + return; + } + + self.dataTask = [session dataTaskWithRequest:self.request]; + self.executing = YES; + } + + if (self.dataTask) { + if (self.options & SDWebImageDownloaderHighPriority) { + self.dataTask.priority = NSURLSessionTaskPriorityHigh; + self.coderQueue.qualityOfService = NSQualityOfServiceUserInteractive; + } else if (self.options & SDWebImageDownloaderLowPriority) { + self.dataTask.priority = NSURLSessionTaskPriorityLow; + self.coderQueue.qualityOfService = NSQualityOfServiceBackground; + } else { + self.dataTask.priority = NSURLSessionTaskPriorityDefault; + self.coderQueue.qualityOfService = NSQualityOfServiceDefault; + } + [self.dataTask resume]; + for (SDWebImageDownloaderProgressBlock progressBlock in [self callbacksForKey:kProgressCallbackKey]) { + progressBlock(0, NSURLResponseUnknownLength, self.request.URL); + } + __block typeof(self) strongSelf = self; + dispatch_async(dispatch_get_main_queue(), ^{ + [[NSNotificationCenter defaultCenter] postNotificationName:SDWebImageDownloadStartNotification object:strongSelf]; + }); + } else { + if (!self.isFinished) self.finished = YES; + [self callCompletionBlocksWithError:[NSError errorWithDomain:SDWebImageErrorDomain code:SDWebImageErrorInvalidDownloadOperation userInfo:@{NSLocalizedDescriptionKey : @"Task can't be initialized"}]]; + [self reset]; + } +} + +- (void)cancel { + @synchronized (self) { + [self cancelInternal]; + } +} + +- (void)cancelInternal { + if (self.isFinished) return; + [super cancel]; + + __block typeof(self) strongSelf = self; + dispatch_async(dispatch_get_main_queue(), ^{ + [[NSNotificationCenter defaultCenter] postNotificationName:SDWebImageDownloadStopNotification object:strongSelf]; + }); + + if (self.dataTask) { + // Cancel the URLSession, `URLSession:task:didCompleteWithError:` delegate callback will be ignored + [self.dataTask cancel]; + self.dataTask = nil; + } + + // NSOperation disallow setFinished=YES **before** operation's start method been called + // We check for the initialized status, which is isExecuting == NO && isFinished = NO + // Ony update for non-intialized status, which is !(isExecuting == NO && isFinished = NO), or if (self.isExecuting || self.isFinished) {...} + if (self.isExecuting || self.isFinished) { + if (self.isExecuting) self.executing = NO; + if (!self.isFinished) self.finished = YES; + } + + // Operation cancelled by user during sending the request + [self callCompletionBlocksWithError:[NSError errorWithDomain:SDWebImageErrorDomain code:SDWebImageErrorCancelled userInfo:@{NSLocalizedDescriptionKey : @"Operation cancelled by user during sending the request"}]]; + + [self reset]; +} + +- (void)done { + self.finished = YES; + self.executing = NO; + [self reset]; +} + +- (void)reset { + @synchronized (self) { + [self.callbackBlocks removeAllObjects]; + self.dataTask = nil; + + if (self.ownedSession) { + [self.ownedSession invalidateAndCancel]; + self.ownedSession = nil; + } + +#if SD_UIKIT + if (self.backgroundTaskId != UIBackgroundTaskInvalid) { + // If backgroundTaskId != UIBackgroundTaskInvalid, sharedApplication is always exist + UIApplication * app = [UIApplication performSelector:@selector(sharedApplication)]; + [app endBackgroundTask:self.backgroundTaskId]; + self.backgroundTaskId = UIBackgroundTaskInvalid; + } +#endif + } +} + +- (void)setFinished:(BOOL)finished { + [self willChangeValueForKey:@"isFinished"]; + _finished = finished; + [self didChangeValueForKey:@"isFinished"]; +} + +- (void)setExecuting:(BOOL)executing { + [self willChangeValueForKey:@"isExecuting"]; + _executing = executing; + [self didChangeValueForKey:@"isExecuting"]; +} + +- (BOOL)isConcurrent { + return YES; +} + +#pragma mark NSURLSessionDataDelegate + +- (void)URLSession:(NSURLSession *)session + dataTask:(NSURLSessionDataTask *)dataTask +didReceiveResponse:(NSURLResponse *)response + completionHandler:(void (^)(NSURLSessionResponseDisposition disposition))completionHandler { + NSURLSessionResponseDisposition disposition = NSURLSessionResponseAllow; + + // Check response modifier, if return nil, will marked as cancelled. + BOOL valid = YES; + if (self.responseModifier && response) { + response = [self.responseModifier modifiedResponseWithResponse:response]; + if (!response) { + valid = NO; + self.responseError = [NSError errorWithDomain:SDWebImageErrorDomain + code:SDWebImageErrorInvalidDownloadResponse + userInfo:@{NSLocalizedDescriptionKey : @"Download marked as failed because response is nil"}]; + } + } + + NSInteger expected = (NSInteger)response.expectedContentLength; + expected = expected > 0 ? expected : 0; + self.expectedSize = expected; + self.response = response; + + // Check status code valid (defaults [200,400)) + NSInteger statusCode = [response isKindOfClass:NSHTTPURLResponse.class] ? ((NSHTTPURLResponse *)response).statusCode : 0; + BOOL statusCodeValid = YES; + if (valid && statusCode > 0 && self.acceptableStatusCodes) { + statusCodeValid = [self.acceptableStatusCodes containsIndex:statusCode]; + } + if (!statusCodeValid) { + valid = NO; + self.responseError = [NSError errorWithDomain:SDWebImageErrorDomain + code:SDWebImageErrorInvalidDownloadStatusCode + userInfo:@{NSLocalizedDescriptionKey : [NSString stringWithFormat:@"Download marked as failed because of invalid response status code %ld", (long)statusCode], + SDWebImageErrorDownloadStatusCodeKey : @(statusCode), + SDWebImageErrorDownloadResponseKey : response}]; + } + // Check content type valid (defaults nil) + NSString *contentType = [response isKindOfClass:NSHTTPURLResponse.class] ? ((NSHTTPURLResponse *)response).MIMEType : nil; + BOOL contentTypeValid = YES; + if (valid && contentType.length > 0 && self.acceptableContentTypes) { + contentTypeValid = [self.acceptableContentTypes containsObject:contentType]; + } + if (!contentTypeValid) { + valid = NO; + self.responseError = [NSError errorWithDomain:SDWebImageErrorDomain + code:SDWebImageErrorInvalidDownloadContentType + userInfo:@{NSLocalizedDescriptionKey : [NSString stringWithFormat:@"Download marked as failed because of invalid response content type %@", contentType], + SDWebImageErrorDownloadContentTypeKey : contentType, + SDWebImageErrorDownloadResponseKey : response}]; + } + //'304 Not Modified' is an exceptional one + //URLSession current behavior will return 200 status code when the server respond 304 and URLCache hit. But this is not a standard behavior and we just add a check + if (valid && statusCode == 304 && !self.cachedData) { + valid = NO; + self.responseError = [NSError errorWithDomain:SDWebImageErrorDomain + code:SDWebImageErrorCacheNotModified + userInfo:@{NSLocalizedDescriptionKey: @"Download response status code is 304 not modified and ignored", + SDWebImageErrorDownloadResponseKey : response}]; + } + + if (valid) { + for (SDWebImageDownloaderProgressBlock progressBlock in [self callbacksForKey:kProgressCallbackKey]) { + progressBlock(0, expected, self.request.URL); + } + } else { + // Status code invalid and marked as cancelled. Do not call `[self.dataTask cancel]` which may mass up URLSession life cycle + disposition = NSURLSessionResponseCancel; + } + __block typeof(self) strongSelf = self; + dispatch_async(dispatch_get_main_queue(), ^{ + [[NSNotificationCenter defaultCenter] postNotificationName:SDWebImageDownloadReceiveResponseNotification object:strongSelf]; + }); + + if (completionHandler) { + completionHandler(disposition); + } +} + +- (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)dataTask didReceiveData:(NSData *)data { + if (!self.imageData) { + self.imageData = [[NSMutableData alloc] initWithCapacity:self.expectedSize]; + } + [self.imageData appendData:data]; + + self.receivedSize = self.imageData.length; + if (self.expectedSize == 0) { + // Unknown expectedSize, immediately call progressBlock and return + for (SDWebImageDownloaderProgressBlock progressBlock in [self callbacksForKey:kProgressCallbackKey]) { + progressBlock(self.receivedSize, self.expectedSize, self.request.URL); + } + return; + } + + // Get the finish status + BOOL finished = (self.receivedSize >= self.expectedSize); + // Get the current progress + double currentProgress = (double)self.receivedSize / (double)self.expectedSize; + double previousProgress = self.previousProgress; + double progressInterval = currentProgress - previousProgress; + // Check if we need callback progress + if (!finished && (progressInterval < self.minimumProgressInterval)) { + return; + } + self.previousProgress = currentProgress; + + // Using data decryptor will disable the progressive decoding, since there are no support for progressive decrypt + BOOL supportProgressive = (self.options & SDWebImageDownloaderProgressiveLoad) && !self.decryptor; + // Progressive decoding Only decode partial image, full image in `URLSession:task:didCompleteWithError:` + if (supportProgressive && !finished) { + // Get the image data + NSData *imageData = self.imageData; + + // keep maximum one progressive decode process during download + if (self.coderQueue.operationCount == 0) { + // NSOperation have autoreleasepool, don't need to create extra one + @weakify(self); + [self.coderQueue addOperationWithBlock:^{ + @strongify(self); + if (!self) { + return; + } + UIImage *image = SDImageLoaderDecodeProgressiveImageData(imageData, self.request.URL, NO, self, [[self class] imageOptionsFromDownloaderOptions:self.options], self.context); + if (image) { + // We do not keep the progressive decoding image even when `finished`=YES. Because they are for view rendering but not take full function from downloader options. And some coders implementation may not keep consistent between progressive decoding and normal decoding. + + [self callCompletionBlocksWithImage:image imageData:nil error:nil finished:NO]; + } + }]; + } + } + + for (SDWebImageDownloaderProgressBlock progressBlock in [self callbacksForKey:kProgressCallbackKey]) { + progressBlock(self.receivedSize, self.expectedSize, self.request.URL); + } +} + +- (void)URLSession:(NSURLSession *)session + dataTask:(NSURLSessionDataTask *)dataTask + willCacheResponse:(NSCachedURLResponse *)proposedResponse + completionHandler:(void (^)(NSCachedURLResponse *cachedResponse))completionHandler { + + NSCachedURLResponse *cachedResponse = proposedResponse; + + if (!(self.options & SDWebImageDownloaderUseNSURLCache)) { + // Prevents caching of responses + cachedResponse = nil; + } + if (completionHandler) { + completionHandler(cachedResponse); + } +} + +#pragma mark NSURLSessionTaskDelegate + +- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didCompleteWithError:(NSError *)error { + // If we already cancel the operation or anything mark the operation finished, don't callback twice + if (self.isFinished) return; + + @synchronized(self) { + self.dataTask = nil; + __block typeof(self) strongSelf = self; + dispatch_async(dispatch_get_main_queue(), ^{ + [[NSNotificationCenter defaultCenter] postNotificationName:SDWebImageDownloadStopNotification object:strongSelf]; + if (!error) { + [[NSNotificationCenter defaultCenter] postNotificationName:SDWebImageDownloadFinishNotification object:strongSelf]; + } + }); + } + + // make sure to call `[self done]` to mark operation as finished + if (error) { + // custom error instead of URLSession error + if (self.responseError) { + error = self.responseError; + } + [self callCompletionBlocksWithError:error]; + [self done]; + } else { + if ([self callbacksForKey:kCompletedCallbackKey].count > 0) { + NSData *imageData = self.imageData; + self.imageData = nil; + // data decryptor + if (imageData && self.decryptor) { + imageData = [self.decryptor decryptedDataWithData:imageData response:self.response]; + } + if (imageData) { + /** if you specified to only use cached data via `SDWebImageDownloaderIgnoreCachedResponse`, + * then we should check if the cached data is equal to image data + */ + if (self.options & SDWebImageDownloaderIgnoreCachedResponse && [self.cachedData isEqualToData:imageData]) { + self.responseError = [NSError errorWithDomain:SDWebImageErrorDomain + code:SDWebImageErrorCacheNotModified + userInfo:@{NSLocalizedDescriptionKey : @"Downloaded image is not modified and ignored", + SDWebImageErrorDownloadResponseKey : self.response}]; + // call completion block with not modified error + [self callCompletionBlocksWithError:self.responseError]; + [self done]; + } else { + // decode the image in coder queue, cancel all previous decoding process + [self.coderQueue cancelAllOperations]; + @weakify(self); + [self.coderQueue addOperationWithBlock:^{ + @strongify(self); + if (!self) { + return; + } + // check if we already use progressive decoding, use that to produce faster decoding + id progressiveCoder = SDImageLoaderGetProgressiveCoder(self); + UIImage *image; + if (progressiveCoder) { + image = SDImageLoaderDecodeProgressiveImageData(imageData, self.request.URL, YES, self, [[self class] imageOptionsFromDownloaderOptions:self.options], self.context); + } else { + image = SDImageLoaderDecodeImageData(imageData, self.request.URL, [[self class] imageOptionsFromDownloaderOptions:self.options], self.context); + } + CGSize imageSize = image.size; + if (imageSize.width == 0 || imageSize.height == 0) { + NSString *description = image == nil ? @"Downloaded image decode failed" : @"Downloaded image has 0 pixels"; + [self callCompletionBlocksWithError:[NSError errorWithDomain:SDWebImageErrorDomain code:SDWebImageErrorBadImageData userInfo:@{NSLocalizedDescriptionKey : description}]]; + } else { + [self callCompletionBlocksWithImage:image imageData:imageData error:nil finished:YES]; + } + [self done]; + }]; + } + } else { + [self callCompletionBlocksWithError:[NSError errorWithDomain:SDWebImageErrorDomain code:SDWebImageErrorBadImageData userInfo:@{NSLocalizedDescriptionKey : @"Image data is nil"}]]; + [self done]; + } + } else { + [self done]; + } + } +} + +- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential))completionHandler { + + NSURLSessionAuthChallengeDisposition disposition = NSURLSessionAuthChallengePerformDefaultHandling; + __block NSURLCredential *credential = nil; + + if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) { + if (!(self.options & SDWebImageDownloaderAllowInvalidSSLCertificates)) { + disposition = NSURLSessionAuthChallengePerformDefaultHandling; + } else { + credential = [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]; + disposition = NSURLSessionAuthChallengeUseCredential; + } + } else { + if (challenge.previousFailureCount == 0) { + if (self.credential) { + credential = self.credential; + disposition = NSURLSessionAuthChallengeUseCredential; + } else { + // Web Server like Nginx can set `ssl_verify_client` to optional but not always on + // We'd better use default handling here + disposition = NSURLSessionAuthChallengePerformDefaultHandling; + } + } else { + disposition = NSURLSessionAuthChallengeCancelAuthenticationChallenge; + } + } + + if (completionHandler) { + completionHandler(disposition, credential); + } +} + +- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didFinishCollectingMetrics:(NSURLSessionTaskMetrics *)metrics API_AVAILABLE(macosx(10.12), ios(10.0), watchos(3.0), tvos(10.0)) { + self.metrics = metrics; +} + +#pragma mark Helper methods ++ (SDWebImageOptions)imageOptionsFromDownloaderOptions:(SDWebImageDownloaderOptions)downloadOptions { + SDWebImageOptions options = 0; + if (downloadOptions & SDWebImageDownloaderScaleDownLargeImages) options |= SDWebImageScaleDownLargeImages; + if (downloadOptions & SDWebImageDownloaderDecodeFirstFrameOnly) options |= SDWebImageDecodeFirstFrameOnly; + if (downloadOptions & SDWebImageDownloaderPreloadAllFrames) options |= SDWebImagePreloadAllFrames; + if (downloadOptions & SDWebImageDownloaderAvoidDecodeImage) options |= SDWebImageAvoidDecodeImage; + if (downloadOptions & SDWebImageDownloaderMatchAnimatedImageClass) options |= SDWebImageMatchAnimatedImageClass; + + return options; +} + +- (BOOL)shouldContinueWhenAppEntersBackground { + return SD_OPTIONS_CONTAINS(self.options, SDWebImageDownloaderContinueInBackground); +} + +- (void)callCompletionBlocksWithError:(nullable NSError *)error { + [self callCompletionBlocksWithImage:nil imageData:nil error:error finished:YES]; +} + +- (void)callCompletionBlocksWithImage:(nullable UIImage *)image + imageData:(nullable NSData *)imageData + error:(nullable NSError *)error + finished:(BOOL)finished { + NSArray *completionBlocks = [self callbacksForKey:kCompletedCallbackKey]; + dispatch_main_async_safe(^{ + for (SDWebImageDownloaderCompletedBlock completedBlock in completionBlocks) { + completedBlock(image, imageData, error, finished); + } + }); +} + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderRequestModifier.h b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderRequestModifier.h new file mode 100644 index 0000000..42c8a40 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderRequestModifier.h @@ -0,0 +1,69 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import +#import "SDWebImageCompat.h" + +typedef NSURLRequest * _Nullable (^SDWebImageDownloaderRequestModifierBlock)(NSURLRequest * _Nonnull request); + +/** + This is the protocol for downloader request modifier. + We can use a block to specify the downloader request modifier. But Using protocol can make this extensible, and allow Swift user to use it easily instead of using `@convention(block)` to store a block into context options. + */ +@protocol SDWebImageDownloaderRequestModifier + +/// Modify the original URL request and return a new one instead. You can modify the HTTP header, cachePolicy, etc for this URL. +/// @param request The original URL request for image loading +/// @note If return nil, the URL request will be cancelled. +- (nullable NSURLRequest *)modifiedRequestWithRequest:(nonnull NSURLRequest *)request; + +@end + +/** + A downloader request modifier class with block. + */ +@interface SDWebImageDownloaderRequestModifier : NSObject + +/// Create the request modifier with block +/// @param block A block to control modifier logic +- (nonnull instancetype)initWithBlock:(nonnull SDWebImageDownloaderRequestModifierBlock)block; + +/// Create the request modifier with block +/// @param block A block to control modifier logic ++ (nonnull instancetype)requestModifierWithBlock:(nonnull SDWebImageDownloaderRequestModifierBlock)block; + +@end + +/** +A convenient request modifier to provide the HTTP request including HTTP Method, Headers and Body. +*/ +@interface SDWebImageDownloaderRequestModifier (Conveniences) + +/// Create the request modifier with HTTP Method. +/// @param method HTTP Method, nil means to GET. +/// @note This is for convenience, if you need code to control the logic, use block API instead. +- (nonnull instancetype)initWithMethod:(nullable NSString *)method; + +/// Create the request modifier with HTTP Headers. +/// @param headers HTTP Headers. Case insensitive according to HTTP/1.1(HTTP/2) standard. The headers will override the same fields from original request. +/// @note This is for convenience, if you need code to control the logic, use block API instead. +- (nonnull instancetype)initWithHeaders:(nullable NSDictionary *)headers; + +/// Create the request modifier with HTTP Body. +/// @param body HTTP Body. +/// @note This is for convenience, if you need code to control the logic, use block API instead. +- (nonnull instancetype)initWithBody:(nullable NSData *)body; + +/// Create the request modifier with HTTP Method, Headers and Body. +/// @param method HTTP Method, nil means to GET. +/// @param headers HTTP Headers. Case insensitive according to HTTP/1.1(HTTP/2) standard. The headers will override the same fields from original request. +/// @param body HTTP Body. +/// @note This is for convenience, if you need code to control the logic, use block API instead. +- (nonnull instancetype)initWithMethod:(nullable NSString *)method headers:(nullable NSDictionary *)headers body:(nullable NSData *)body; + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderRequestModifier.m b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderRequestModifier.m new file mode 100644 index 0000000..c12c84f --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderRequestModifier.m @@ -0,0 +1,71 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageDownloaderRequestModifier.h" + +@interface SDWebImageDownloaderRequestModifier () + +@property (nonatomic, copy, nonnull) SDWebImageDownloaderRequestModifierBlock block; + +@end + +@implementation SDWebImageDownloaderRequestModifier + +- (instancetype)initWithBlock:(SDWebImageDownloaderRequestModifierBlock)block { + self = [super init]; + if (self) { + self.block = block; + } + return self; +} + ++ (instancetype)requestModifierWithBlock:(SDWebImageDownloaderRequestModifierBlock)block { + SDWebImageDownloaderRequestModifier *requestModifier = [[SDWebImageDownloaderRequestModifier alloc] initWithBlock:block]; + return requestModifier; +} + +- (NSURLRequest *)modifiedRequestWithRequest:(NSURLRequest *)request { + if (!self.block) { + return nil; + } + return self.block(request); +} + +@end + +@implementation SDWebImageDownloaderRequestModifier (Conveniences) + +- (instancetype)initWithMethod:(NSString *)method { + return [self initWithMethod:method headers:nil body:nil]; +} + +- (instancetype)initWithHeaders:(NSDictionary *)headers { + return [self initWithMethod:nil headers:headers body:nil]; +} + +- (instancetype)initWithBody:(NSData *)body { + return [self initWithMethod:nil headers:nil body:body]; +} + +- (instancetype)initWithMethod:(NSString *)method headers:(NSDictionary *)headers body:(NSData *)body { + method = method ? [method copy] : @"GET"; + headers = [headers copy]; + body = [body copy]; + return [self initWithBlock:^NSURLRequest * _Nullable(NSURLRequest * _Nonnull request) { + NSMutableURLRequest *mutableRequest = [request mutableCopy]; + mutableRequest.HTTPMethod = method; + mutableRequest.HTTPBody = body; + for (NSString *header in headers) { + NSString *value = headers[header]; + [mutableRequest setValue:value forHTTPHeaderField:header]; + } + return [mutableRequest copy]; + }]; +} + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderResponseModifier.h b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderResponseModifier.h new file mode 100644 index 0000000..63c1456 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderResponseModifier.h @@ -0,0 +1,69 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import +#import "SDWebImageCompat.h" + +typedef NSURLResponse * _Nullable (^SDWebImageDownloaderResponseModifierBlock)(NSURLResponse * _Nonnull response); + +/** + This is the protocol for downloader response modifier. + We can use a block to specify the downloader response modifier. But Using protocol can make this extensible, and allow Swift user to use it easily instead of using `@convention(block)` to store a block into context options. + */ +@protocol SDWebImageDownloaderResponseModifier + +/// Modify the original URL response and return a new response. You can use this to check MIME-Type, mock server response, etc. +/// @param response The original URL response, note for HTTP request it's actually a `NSHTTPURLResponse` instance +/// @note If nil is returned, the image download will marked as cancelled with error `SDWebImageErrorInvalidDownloadResponse` +- (nullable NSURLResponse *)modifiedResponseWithResponse:(nonnull NSURLResponse *)response; + +@end + +/** + A downloader response modifier class with block. + */ +@interface SDWebImageDownloaderResponseModifier : NSObject + +/// Create the response modifier with block +/// @param block A block to control modifier logic +- (nonnull instancetype)initWithBlock:(nonnull SDWebImageDownloaderResponseModifierBlock)block; + +/// Create the response modifier with block +/// @param block A block to control modifier logic ++ (nonnull instancetype)responseModifierWithBlock:(nonnull SDWebImageDownloaderResponseModifierBlock)block; + +@end + +/** +A convenient response modifier to provide the HTTP response including HTTP Status Code, Version and Headers. +*/ +@interface SDWebImageDownloaderResponseModifier (Conveniences) + +/// Create the response modifier with HTTP Status code. +/// @param statusCode HTTP Status Code. +/// @note This is for convenience, if you need code to control the logic, use block API instead. +- (nonnull instancetype)initWithStatusCode:(NSInteger)statusCode; + +/// Create the response modifier with HTTP Version. Status code defaults to 200. +/// @param version HTTP Version, nil means "HTTP/1.1". +/// @note This is for convenience, if you need code to control the logic, use block API instead. +- (nonnull instancetype)initWithVersion:(nullable NSString *)version; + +/// Create the response modifier with HTTP Headers. Status code defaults to 200. +/// @param headers HTTP Headers. Case insensitive according to HTTP/1.1(HTTP/2) standard. The headers will override the same fields from original response. +/// @note This is for convenience, if you need code to control the logic, use block API instead. +- (nonnull instancetype)initWithHeaders:(nullable NSDictionary *)headers; + +/// Create the response modifier with HTTP Status Code, Version and Headers. +/// @param statusCode HTTP Status Code. +/// @param version HTTP Version, nil means "HTTP/1.1". +/// @param headers HTTP Headers. Case insensitive according to HTTP/1.1(HTTP/2) standard. The headers will override the same fields from original response. +/// @note This is for convenience, if you need code to control the logic, use block API instead. +- (nonnull instancetype)initWithStatusCode:(NSInteger)statusCode version:(nullable NSString *)version headers:(nullable NSDictionary *)headers; + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderResponseModifier.m b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderResponseModifier.m new file mode 100644 index 0000000..6acf02a --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageDownloaderResponseModifier.m @@ -0,0 +1,73 @@ +/* +* This file is part of the SDWebImage package. +* (c) Olivier Poitrey +* +* For the full copyright and license information, please view the LICENSE +* file that was distributed with this source code. +*/ + + +#import "SDWebImageDownloaderResponseModifier.h" + +@interface SDWebImageDownloaderResponseModifier () + +@property (nonatomic, copy, nonnull) SDWebImageDownloaderResponseModifierBlock block; + +@end + +@implementation SDWebImageDownloaderResponseModifier + +- (instancetype)initWithBlock:(SDWebImageDownloaderResponseModifierBlock)block { + self = [super init]; + if (self) { + self.block = block; + } + return self; +} + ++ (instancetype)responseModifierWithBlock:(SDWebImageDownloaderResponseModifierBlock)block { + SDWebImageDownloaderResponseModifier *responseModifier = [[SDWebImageDownloaderResponseModifier alloc] initWithBlock:block]; + return responseModifier; +} + +- (nullable NSURLResponse *)modifiedResponseWithResponse:(nonnull NSURLResponse *)response { + if (!self.block) { + return nil; + } + return self.block(response); +} + +@end + +@implementation SDWebImageDownloaderResponseModifier (Conveniences) + +- (instancetype)initWithStatusCode:(NSInteger)statusCode { + return [self initWithStatusCode:statusCode version:nil headers:nil]; +} + +- (instancetype)initWithVersion:(NSString *)version { + return [self initWithStatusCode:200 version:version headers:nil]; +} + +- (instancetype)initWithHeaders:(NSDictionary *)headers { + return [self initWithStatusCode:200 version:nil headers:headers]; +} + +- (instancetype)initWithStatusCode:(NSInteger)statusCode version:(NSString *)version headers:(NSDictionary *)headers { + version = version ? [version copy] : @"HTTP/1.1"; + headers = [headers copy]; + return [self initWithBlock:^NSURLResponse * _Nullable(NSURLResponse * _Nonnull response) { + if (![response isKindOfClass:NSHTTPURLResponse.class]) { + return response; + } + NSMutableDictionary *mutableHeaders = [((NSHTTPURLResponse *)response).allHeaderFields mutableCopy]; + for (NSString *header in headers) { + NSString *value = headers[header]; + mutableHeaders[header] = value; + } + NSHTTPURLResponse *httpResponse = [[NSHTTPURLResponse alloc] initWithURL:response.URL statusCode:statusCode HTTPVersion:version headerFields:[mutableHeaders copy]]; + return httpResponse; + }]; +} + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageError.h b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageError.h new file mode 100644 index 0000000..bb91d0b --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageError.h @@ -0,0 +1,32 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * (c) Jamie Pinkham + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageCompat.h" + +FOUNDATION_EXPORT NSErrorDomain const _Nonnull SDWebImageErrorDomain; + +/// The response instance for invalid download response (NSURLResponse *) +FOUNDATION_EXPORT NSErrorUserInfoKey const _Nonnull SDWebImageErrorDownloadResponseKey; +/// The HTTP status code for invalid download response (NSNumber *) +FOUNDATION_EXPORT NSErrorUserInfoKey const _Nonnull SDWebImageErrorDownloadStatusCodeKey; +/// The HTTP MIME content type for invalid download response (NSString *) +FOUNDATION_EXPORT NSErrorUserInfoKey const _Nonnull SDWebImageErrorDownloadContentTypeKey; + +/// SDWebImage error domain and codes +typedef NS_ERROR_ENUM(SDWebImageErrorDomain, SDWebImageError) { + SDWebImageErrorInvalidURL = 1000, // The URL is invalid, such as nil URL or corrupted URL + SDWebImageErrorBadImageData = 1001, // The image data can not be decoded to image, or the image data is empty + SDWebImageErrorCacheNotModified = 1002, // The remote location specify that the cached image is not modified, such as the HTTP response 304 code. It's useful for `SDWebImageRefreshCached` + SDWebImageErrorBlackListed = 1003, // The URL is blacklisted because of unrecoverable failure marked by downloader (such as 404), you can use `.retryFailed` option to avoid this + SDWebImageErrorInvalidDownloadOperation = 2000, // The image download operation is invalid, such as nil operation or unexpected error occur when operation initialized + SDWebImageErrorInvalidDownloadStatusCode = 2001, // The image download response a invalid status code. You can check the status code in error's userInfo under `SDWebImageErrorDownloadStatusCodeKey` + SDWebImageErrorCancelled = 2002, // The image loading operation is cancelled before finished, during either async disk cache query, or waiting before actual network request. For actual network request error, check `NSURLErrorDomain` error domain and code. + SDWebImageErrorInvalidDownloadResponse = 2003, // When using response modifier, the modified download response is nil and marked as failed. + SDWebImageErrorInvalidDownloadContentType = 2004, // The image download response a invalid content type. You can check the MIME content type in error's userInfo under `SDWebImageErrorDownloadContentTypeKey` +}; diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageError.m b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageError.m new file mode 100644 index 0000000..bd0d17a --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageError.m @@ -0,0 +1,16 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * (c) Jamie Pinkham + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageError.h" + +NSErrorDomain const _Nonnull SDWebImageErrorDomain = @"SDWebImageErrorDomain"; + +NSErrorUserInfoKey const _Nonnull SDWebImageErrorDownloadResponseKey = @"SDWebImageErrorDownloadResponseKey"; +NSErrorUserInfoKey const _Nonnull SDWebImageErrorDownloadStatusCodeKey = @"SDWebImageErrorDownloadStatusCodeKey"; +NSErrorUserInfoKey const _Nonnull SDWebImageErrorDownloadContentTypeKey = @"SDWebImageErrorDownloadContentTypeKey"; diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageIndicator.h b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageIndicator.h new file mode 100644 index 0000000..e1165c1 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageIndicator.h @@ -0,0 +1,115 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageCompat.h" + +#if SD_UIKIT || SD_MAC + +/** + A protocol to custom the indicator during the image loading. + All of these methods are called from main queue. + */ +@protocol SDWebImageIndicator + +@required +/** + The view associate to the indicator. + + @return The indicator view + */ +@property (nonatomic, strong, readonly, nonnull) UIView *indicatorView; + +/** + Start the animating for indicator. + */ +- (void)startAnimatingIndicator; + +/** + Stop the animating for indicator. + */ +- (void)stopAnimatingIndicator; + +@optional +/** + Update the loading progress (0-1.0) for indicator. Optional + + @param progress The progress, value between 0 and 1.0 + */ +- (void)updateIndicatorProgress:(double)progress; + +@end + +#pragma mark - Activity Indicator + +/** + Activity indicator class. + for UIKit(macOS), it use a `UIActivityIndicatorView`. + for AppKit(macOS), it use a `NSProgressIndicator` with the spinning style. + */ +@interface SDWebImageActivityIndicator : NSObject + +#if SD_UIKIT +@property (nonatomic, strong, readonly, nonnull) UIActivityIndicatorView *indicatorView; +#else +@property (nonatomic, strong, readonly, nonnull) NSProgressIndicator *indicatorView; +#endif + +@end + +/** + Convenience way to use activity indicator. + */ +@interface SDWebImageActivityIndicator (Conveniences) + +/// These indicator use the fixed color without dark mode support +/// gray-style activity indicator +@property (nonatomic, class, nonnull, readonly) SDWebImageActivityIndicator *grayIndicator; +/// large gray-style activity indicator +@property (nonatomic, class, nonnull, readonly) SDWebImageActivityIndicator *grayLargeIndicator; +/// white-style activity indicator +@property (nonatomic, class, nonnull, readonly) SDWebImageActivityIndicator *whiteIndicator; +/// large white-style activity indicator +@property (nonatomic, class, nonnull, readonly) SDWebImageActivityIndicator *whiteLargeIndicator; +/// These indicator use the system style, supports dark mode if available (iOS 13+/macOS 10.14+) +/// large activity indicator +@property (nonatomic, class, nonnull, readonly) SDWebImageActivityIndicator *largeIndicator; +/// medium activity indicator +@property (nonatomic, class, nonnull, readonly) SDWebImageActivityIndicator *mediumIndicator; + +@end + +#pragma mark - Progress Indicator + +/** + Progress indicator class. + for UIKit(macOS), it use a `UIProgressView`. + for AppKit(macOS), it use a `NSProgressIndicator` with the bar style. + */ +@interface SDWebImageProgressIndicator : NSObject + +#if SD_UIKIT +@property (nonatomic, strong, readonly, nonnull) UIProgressView *indicatorView; +#else +@property (nonatomic, strong, readonly, nonnull) NSProgressIndicator *indicatorView; +#endif + +@end + +/** + Convenience way to create progress indicator. Remember to specify the indicator width or use layout constraint if need. + */ +@interface SDWebImageProgressIndicator (Conveniences) + +/// default-style progress indicator +@property (nonatomic, class, nonnull, readonly) SDWebImageProgressIndicator *defaultIndicator; +/// bar-style progress indicator +@property (nonatomic, class, nonnull, readonly) SDWebImageProgressIndicator *barIndicator API_UNAVAILABLE(macos, tvos); + +@end + +#endif diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageIndicator.m b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageIndicator.m new file mode 100644 index 0000000..b45a08a --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageIndicator.m @@ -0,0 +1,275 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageIndicator.h" + +#if SD_UIKIT || SD_MAC + +#if SD_MAC +#import +#import +#endif + +#pragma mark - Activity Indicator + +@interface SDWebImageActivityIndicator () + +#if SD_UIKIT +@property (nonatomic, strong, readwrite, nonnull) UIActivityIndicatorView *indicatorView; +#else +@property (nonatomic, strong, readwrite, nonnull) NSProgressIndicator *indicatorView; +#endif + +@end + +@implementation SDWebImageActivityIndicator + +- (instancetype)init { + self = [super init]; + if (self) { + [self commonInit]; + } + return self; +} + +#if SD_UIKIT +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" +- (void)commonInit { + self.indicatorView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite]; + self.indicatorView.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin; +} +#pragma clang diagnostic pop +#endif + +#if SD_MAC +- (void)commonInit { + self.indicatorView = [[NSProgressIndicator alloc] initWithFrame:NSZeroRect]; + self.indicatorView.style = NSProgressIndicatorStyleSpinning; + self.indicatorView.controlSize = NSControlSizeSmall; + [self.indicatorView sizeToFit]; + self.indicatorView.autoresizingMask = NSViewMaxXMargin | NSViewMinXMargin | NSViewMaxYMargin | NSViewMinYMargin; +} +#endif + +- (void)startAnimatingIndicator { +#if SD_UIKIT + [self.indicatorView startAnimating]; +#else + [self.indicatorView startAnimation:nil]; +#endif + self.indicatorView.hidden = NO; +} + +- (void)stopAnimatingIndicator { +#if SD_UIKIT + [self.indicatorView stopAnimating]; +#else + [self.indicatorView stopAnimation:nil]; +#endif + self.indicatorView.hidden = YES; +} + +@end + +@implementation SDWebImageActivityIndicator (Conveniences) + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" ++ (SDWebImageActivityIndicator *)grayIndicator { + SDWebImageActivityIndicator *indicator = [SDWebImageActivityIndicator new]; +#if SD_UIKIT +#if SD_IOS + indicator.indicatorView.activityIndicatorViewStyle = UIActivityIndicatorViewStyleGray; +#else + indicator.indicatorView.color = [UIColor colorWithWhite:0 alpha:0.45]; // Color from `UIActivityIndicatorViewStyleGray` +#endif +#else + indicator.indicatorView.appearance = [NSAppearance appearanceNamed:NSAppearanceNameAqua]; // Disable dark mode support +#endif + return indicator; +} + ++ (SDWebImageActivityIndicator *)grayLargeIndicator { + SDWebImageActivityIndicator *indicator = SDWebImageActivityIndicator.grayIndicator; +#if SD_UIKIT + UIColor *grayColor = indicator.indicatorView.color; + indicator.indicatorView.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhiteLarge; + indicator.indicatorView.color = grayColor; +#else + indicator.indicatorView.appearance = [NSAppearance appearanceNamed:NSAppearanceNameAqua]; // Disable dark mode support + indicator.indicatorView.controlSize = NSControlSizeRegular; +#endif + [indicator.indicatorView sizeToFit]; + return indicator; +} + ++ (SDWebImageActivityIndicator *)whiteIndicator { + SDWebImageActivityIndicator *indicator = [SDWebImageActivityIndicator new]; +#if SD_UIKIT + indicator.indicatorView.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhite; +#else + indicator.indicatorView.appearance = [NSAppearance appearanceNamed:NSAppearanceNameAqua]; // Disable dark mode support + CIFilter *lighten = [CIFilter filterWithName:@"CIColorControls"]; + [lighten setDefaults]; + [lighten setValue:@(1) forKey:kCIInputBrightnessKey]; + indicator.indicatorView.contentFilters = @[lighten]; +#endif + return indicator; +} + ++ (SDWebImageActivityIndicator *)whiteLargeIndicator { + SDWebImageActivityIndicator *indicator = SDWebImageActivityIndicator.whiteIndicator; +#if SD_UIKIT + indicator.indicatorView.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhiteLarge; +#else + indicator.indicatorView.appearance = [NSAppearance appearanceNamed:NSAppearanceNameAqua]; // Disable dark mode support + indicator.indicatorView.controlSize = NSControlSizeRegular; + [indicator.indicatorView sizeToFit]; +#endif + return indicator; +} + ++ (SDWebImageActivityIndicator *)largeIndicator { + SDWebImageActivityIndicator *indicator = [SDWebImageActivityIndicator new]; +#if SD_UIKIT + if (@available(iOS 13.0, tvOS 13.0, *)) { + indicator.indicatorView.activityIndicatorViewStyle = UIActivityIndicatorViewStyleLarge; + } else { + indicator.indicatorView.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhiteLarge; + } +#else + indicator.indicatorView.controlSize = NSControlSizeRegular; + [indicator.indicatorView sizeToFit]; +#endif + return indicator; +} + ++ (SDWebImageActivityIndicator *)mediumIndicator { + SDWebImageActivityIndicator *indicator = [SDWebImageActivityIndicator new]; +#if SD_UIKIT + if (@available(iOS 13.0, tvOS 13.0, *)) { + indicator.indicatorView.activityIndicatorViewStyle = UIActivityIndicatorViewStyleMedium; + } else { + indicator.indicatorView.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhite; + } +#else + indicator.indicatorView.controlSize = NSControlSizeSmall; + [indicator.indicatorView sizeToFit]; +#endif + return indicator; +} +#pragma clang diagnostic pop + +@end + +#pragma mark - Progress Indicator + +@interface SDWebImageProgressIndicator () + +#if SD_UIKIT +@property (nonatomic, strong, readwrite, nonnull) UIProgressView *indicatorView; +#else +@property (nonatomic, strong, readwrite, nonnull) NSProgressIndicator *indicatorView; +#endif + +@end + +@implementation SDWebImageProgressIndicator + +- (instancetype)init { + self = [super init]; + if (self) { + [self commonInit]; + } + return self; +} + +#if SD_UIKIT +- (void)commonInit { + self.indicatorView = [[UIProgressView alloc] initWithProgressViewStyle:UIProgressViewStyleDefault]; + self.indicatorView.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin; +} +#endif + +#if SD_MAC +- (void)commonInit { + self.indicatorView = [[NSProgressIndicator alloc] initWithFrame:NSMakeRect(0, 0, 160, 0)]; // Width from `UIProgressView` default width + self.indicatorView.style = NSProgressIndicatorStyleBar; + self.indicatorView.controlSize = NSControlSizeSmall; + [self.indicatorView sizeToFit]; + self.indicatorView.autoresizingMask = NSViewMaxXMargin | NSViewMinXMargin | NSViewMaxYMargin | NSViewMinYMargin; +} +#endif + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunguarded-availability" +- (void)startAnimatingIndicator { + self.indicatorView.hidden = NO; +#if SD_UIKIT + if ([self.indicatorView respondsToSelector:@selector(observedProgress)] && self.indicatorView.observedProgress) { + // Ignore NSProgress + } else { + self.indicatorView.progress = 0; + } +#else + self.indicatorView.indeterminate = YES; + self.indicatorView.doubleValue = 0; + [self.indicatorView startAnimation:nil]; +#endif +} + +- (void)stopAnimatingIndicator { + self.indicatorView.hidden = YES; +#if SD_UIKIT + if ([self.indicatorView respondsToSelector:@selector(observedProgress)] && self.indicatorView.observedProgress) { + // Ignore NSProgress + } else { + self.indicatorView.progress = 1; + } +#else + self.indicatorView.indeterminate = NO; + self.indicatorView.doubleValue = 100; + [self.indicatorView stopAnimation:nil]; +#endif +} + +- (void)updateIndicatorProgress:(double)progress { +#if SD_UIKIT + if ([self.indicatorView respondsToSelector:@selector(observedProgress)] && self.indicatorView.observedProgress) { + // Ignore NSProgress + } else { + [self.indicatorView setProgress:progress animated:YES]; + } +#else + self.indicatorView.indeterminate = progress > 0 ? NO : YES; + self.indicatorView.doubleValue = progress * 100; +#endif +} +#pragma clang diagnostic pop + +@end + +@implementation SDWebImageProgressIndicator (Conveniences) + ++ (SDWebImageProgressIndicator *)defaultIndicator { + SDWebImageProgressIndicator *indicator = [SDWebImageProgressIndicator new]; + return indicator; +} + +#if SD_IOS ++ (SDWebImageProgressIndicator *)barIndicator { + SDWebImageProgressIndicator *indicator = [SDWebImageProgressIndicator new]; + indicator.indicatorView.progressViewStyle = UIProgressViewStyleBar; + return indicator; +} +#endif + +@end + +#endif diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageManager.h b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageManager.h new file mode 100644 index 0000000..ee90724 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageManager.h @@ -0,0 +1,287 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageCompat.h" +#import "SDWebImageOperation.h" +#import "SDImageCacheDefine.h" +#import "SDImageLoader.h" +#import "SDImageTransformer.h" +#import "SDWebImageCacheKeyFilter.h" +#import "SDWebImageCacheSerializer.h" +#import "SDWebImageOptionsProcessor.h" + +typedef void(^SDExternalCompletionBlock)(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL); + +typedef void(^SDInternalCompletionBlock)(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL); + +/** + A combined operation representing the cache and loader operation. You can use it to cancel the load process. + */ +@interface SDWebImageCombinedOperation : NSObject + +/** + Cancel the current operation, including cache and loader process + */ +- (void)cancel; + +/** + The cache operation from the image cache query + */ +@property (strong, nonatomic, nullable, readonly) id cacheOperation; + +/** + The loader operation from the image loader (such as download operation) + */ +@property (strong, nonatomic, nullable, readonly) id loaderOperation; + +@end + + +@class SDWebImageManager; + +/** + The manager delegate protocol. + */ +@protocol SDWebImageManagerDelegate + +@optional + +/** + * Controls which image should be downloaded when the image is not found in the cache. + * + * @param imageManager The current `SDWebImageManager` + * @param imageURL The url of the image to be downloaded + * + * @return Return NO to prevent the downloading of the image on cache misses. If not implemented, YES is implied. + */ +- (BOOL)imageManager:(nonnull SDWebImageManager *)imageManager shouldDownloadImageForURL:(nonnull NSURL *)imageURL; + +/** + * Controls the complicated logic to mark as failed URLs when download error occur. + * If the delegate implement this method, we will not use the built-in way to mark URL as failed based on error code; + @param imageManager The current `SDWebImageManager` + @param imageURL The url of the image + @param error The download error for the url + @return Whether to block this url or not. Return YES to mark this URL as failed. + */ +- (BOOL)imageManager:(nonnull SDWebImageManager *)imageManager shouldBlockFailedURL:(nonnull NSURL *)imageURL withError:(nonnull NSError *)error; + +@end + +/** + * The SDWebImageManager is the class behind the UIImageView+WebCache category and likes. + * It ties the asynchronous downloader (SDWebImageDownloader) with the image cache store (SDImageCache). + * You can use this class directly to benefit from web image downloading with caching in another context than + * a UIView. + * + * Here is a simple example of how to use SDWebImageManager: + * + * @code + +SDWebImageManager *manager = [SDWebImageManager sharedManager]; +[manager loadImageWithURL:imageURL + options:0 + progress:nil + completed:^(UIImage *image, NSData *data, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) { + if (image) { + // do something with image + } + }]; + + * @endcode + */ +@interface SDWebImageManager : NSObject + +/** + * The delegate for manager. Defaults to nil. + */ +@property (weak, nonatomic, nullable) id delegate; + +/** + * The image cache used by manager to query image cache. + */ +@property (strong, nonatomic, readonly, nonnull) id imageCache; + +/** + * The image loader used by manager to load image. + */ +@property (strong, nonatomic, readonly, nonnull) id imageLoader; + +/** + The image transformer for manager. It's used for image transform after the image load finished and store the transformed image to cache, see `SDImageTransformer`. + Defaults to nil, which means no transform is applied. + @note This will affect all the load requests for this manager if you provide. However, you can pass `SDWebImageContextImageTransformer` in context arg to explicitly use that transformer instead. + */ +@property (strong, nonatomic, nullable) id transformer; + +/** + * The cache filter is used to convert an URL into a cache key each time SDWebImageManager need cache key to use image cache. + * + * The following example sets a filter in the application delegate that will remove any query-string from the + * URL before to use it as a cache key: + * + * @code + SDWebImageManager.sharedManager.cacheKeyFilter =[SDWebImageCacheKeyFilter cacheKeyFilterWithBlock:^NSString * _Nullable(NSURL * _Nonnull url) { + url = [[NSURL alloc] initWithScheme:url.scheme host:url.host path:url.path]; + return [url absoluteString]; + }]; + * @endcode + */ +@property (nonatomic, strong, nullable) id cacheKeyFilter; + +/** + * The cache serializer is used to convert the decoded image, the source downloaded data, to the actual data used for storing to the disk cache. If you return nil, means to generate the data from the image instance, see `SDImageCache`. + * For example, if you are using WebP images and facing the slow decoding time issue when later retrieving from disk cache again. You can try to encode the decoded image to JPEG/PNG format to disk cache instead of source downloaded data. + * @note The `image` arg is nonnull, but when you also provide an image transformer and the image is transformed, the `data` arg may be nil, take attention to this case. + * @note This method is called from a global queue in order to not to block the main thread. + * @code + SDWebImageManager.sharedManager.cacheSerializer = [SDWebImageCacheSerializer cacheSerializerWithBlock:^NSData * _Nullable(UIImage * _Nonnull image, NSData * _Nullable data, NSURL * _Nullable imageURL) { + SDImageFormat format = [NSData sd_imageFormatForImageData:data]; + switch (format) { + case SDImageFormatWebP: + return image.images ? data : nil; + default: + return data; + } +}]; + * @endcode + * The default value is nil. Means we just store the source downloaded data to disk cache. + */ +@property (nonatomic, strong, nullable) id cacheSerializer; + +/** + The options processor is used, to have a global control for all the image request options and context option for current manager. + @note If you use `transformer`, `cacheKeyFilter` or `cacheSerializer` property of manager, the input context option already apply those properties before passed. This options processor is a better replacement for those property in common usage. + For example, you can control the global options, based on the URL or original context option like the below code. + + @code + SDWebImageManager.sharedManager.optionsProcessor = [SDWebImageOptionsProcessor optionsProcessorWithBlock:^SDWebImageOptionsResult * _Nullable(NSURL * _Nullable url, SDWebImageOptions options, SDWebImageContext * _Nullable context) { + // Only do animation on `SDAnimatedImageView` + if (!context[SDWebImageContextAnimatedImageClass]) { + options |= SDWebImageDecodeFirstFrameOnly; + } + // Do not force decode for png url + if ([url.lastPathComponent isEqualToString:@"png"]) { + options |= SDWebImageAvoidDecodeImage; + } + // Always use screen scale factor + SDWebImageMutableContext *mutableContext = [NSDictionary dictionaryWithDictionary:context]; + mutableContext[SDWebImageContextImageScaleFactor] = @(UIScreen.mainScreen.scale); + context = [mutableContext copy]; + + return [[SDWebImageOptionsResult alloc] initWithOptions:options context:context]; + }]; + @endcode + */ +@property (nonatomic, strong, nullable) id optionsProcessor; + +/** + * Check one or more operations running + */ +@property (nonatomic, assign, readonly, getter=isRunning) BOOL running; + +/** + The default image cache when the manager which is created with no arguments. Such as shared manager or init. + Defaults to nil. Means using `SDImageCache.sharedImageCache` + */ +@property (nonatomic, class, nullable) id defaultImageCache; + +/** + The default image loader for manager which is created with no arguments. Such as shared manager or init. + Defaults to nil. Means using `SDWebImageDownloader.sharedDownloader` + */ +@property (nonatomic, class, nullable) id defaultImageLoader; + +/** + * Returns global shared manager instance. + */ +@property (nonatomic, class, readonly, nonnull) SDWebImageManager *sharedManager; + +/** + * Allows to specify instance of cache and image loader used with image manager. + * @return new instance of `SDWebImageManager` with specified cache and loader. + */ +- (nonnull instancetype)initWithCache:(nonnull id)cache loader:(nonnull id)loader NS_DESIGNATED_INITIALIZER; + +/** + * Downloads the image at the given URL if not present in cache or return the cached version otherwise. + * + * @param url The URL to the image + * @param options A mask to specify options to use for this request + * @param progressBlock A block called while image is downloading + * @note the progress block is executed on a background queue + * @param completedBlock A block called when operation has been completed. + * + * This parameter is required. + * + * This block has no return value and takes the requested UIImage as first parameter and the NSData representation as second parameter. + * In case of error the image parameter is nil and the third parameter may contain an NSError. + * + * The forth parameter is an `SDImageCacheType` enum indicating if the image was retrieved from the local cache + * or from the memory cache or from the network. + * + * The fifth parameter is set to NO when the SDWebImageProgressiveLoad option is used and the image is + * downloading. This block is thus called repeatedly with a partial image. When image is fully downloaded, the + * block is called a last time with the full image and the last parameter set to YES. + * + * The last parameter is the original image URL + * + * @return Returns an instance of SDWebImageCombinedOperation, which you can cancel the loading process. + */ +- (nullable SDWebImageCombinedOperation *)loadImageWithURL:(nullable NSURL *)url + options:(SDWebImageOptions)options + progress:(nullable SDImageLoaderProgressBlock)progressBlock + completed:(nonnull SDInternalCompletionBlock)completedBlock; + +/** + * Downloads the image at the given URL if not present in cache or return the cached version otherwise. + * + * @param url The URL to the image + * @param options A mask to specify options to use for this request + * @param context A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold. + * @param progressBlock A block called while image is downloading + * @note the progress block is executed on a background queue + * @param completedBlock A block called when operation has been completed. + * + * @return Returns an instance of SDWebImageCombinedOperation, which you can cancel the loading process. + */ +- (nullable SDWebImageCombinedOperation *)loadImageWithURL:(nullable NSURL *)url + options:(SDWebImageOptions)options + context:(nullable SDWebImageContext *)context + progress:(nullable SDImageLoaderProgressBlock)progressBlock + completed:(nonnull SDInternalCompletionBlock)completedBlock; + +/** + * Cancel all current operations + */ +- (void)cancelAll; + +/** + * Remove the specify URL from failed black list. + * @param url The failed URL. + */ +- (void)removeFailedURL:(nonnull NSURL *)url; + +/** + * Remove all the URL from failed black list. + */ +- (void)removeAllFailedURLs; + +/** + * Return the cache key for a given URL, does not considerate transformer or thumbnail. + * @note This method does not have context option, only use the url and manager level cacheKeyFilter to generate the cache key. + */ +- (nullable NSString *)cacheKeyForURL:(nullable NSURL *)url; + +/** + * Return the cache key for a given URL and context option. + * @note The context option like `.thumbnailPixelSize` and `.imageTransformer` will effect the generated cache key, using this if you have those context associated. +*/ +- (nullable NSString *)cacheKeyForURL:(nullable NSURL *)url context:(nullable SDWebImageContext *)context; + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageManager.m b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageManager.m new file mode 100644 index 0000000..3b29632 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageManager.m @@ -0,0 +1,824 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageManager.h" +#import "SDImageCache.h" +#import "SDWebImageDownloader.h" +#import "UIImage+Metadata.h" +#import "SDAssociatedObject.h" +#import "SDWebImageError.h" +#import "SDInternalMacros.h" + +static id _defaultImageCache; +static id _defaultImageLoader; + +@interface SDWebImageCombinedOperation () + +@property (assign, nonatomic, getter = isCancelled) BOOL cancelled; +@property (strong, nonatomic, readwrite, nullable) id loaderOperation; +@property (strong, nonatomic, readwrite, nullable) id cacheOperation; +@property (weak, nonatomic, nullable) SDWebImageManager *manager; + +@end + +@interface SDWebImageManager () { + SD_LOCK_DECLARE(_failedURLsLock); // a lock to keep the access to `failedURLs` thread-safe + SD_LOCK_DECLARE(_runningOperationsLock); // a lock to keep the access to `runningOperations` thread-safe +} + +@property (strong, nonatomic, readwrite, nonnull) SDImageCache *imageCache; +@property (strong, nonatomic, readwrite, nonnull) id imageLoader; +@property (strong, nonatomic, nonnull) NSMutableSet *failedURLs; +@property (strong, nonatomic, nonnull) NSMutableSet *runningOperations; + +@end + +@implementation SDWebImageManager + ++ (id)defaultImageCache { + return _defaultImageCache; +} + ++ (void)setDefaultImageCache:(id)defaultImageCache { + if (defaultImageCache && ![defaultImageCache conformsToProtocol:@protocol(SDImageCache)]) { + return; + } + _defaultImageCache = defaultImageCache; +} + ++ (id)defaultImageLoader { + return _defaultImageLoader; +} + ++ (void)setDefaultImageLoader:(id)defaultImageLoader { + if (defaultImageLoader && ![defaultImageLoader conformsToProtocol:@protocol(SDImageLoader)]) { + return; + } + _defaultImageLoader = defaultImageLoader; +} + ++ (nonnull instancetype)sharedManager { + static dispatch_once_t once; + static id instance; + dispatch_once(&once, ^{ + instance = [self new]; + }); + return instance; +} + +- (nonnull instancetype)init { + id cache = [[self class] defaultImageCache]; + if (!cache) { + cache = [SDImageCache sharedImageCache]; + } + id loader = [[self class] defaultImageLoader]; + if (!loader) { + loader = [SDWebImageDownloader sharedDownloader]; + } + return [self initWithCache:cache loader:loader]; +} + +- (nonnull instancetype)initWithCache:(nonnull id)cache loader:(nonnull id)loader { + if ((self = [super init])) { + _imageCache = cache; + _imageLoader = loader; + _failedURLs = [NSMutableSet new]; + SD_LOCK_INIT(_failedURLsLock); + _runningOperations = [NSMutableSet new]; + SD_LOCK_INIT(_runningOperationsLock); + } + return self; +} + +- (nullable NSString *)cacheKeyForURL:(nullable NSURL *)url { + if (!url) { + return @""; + } + + NSString *key; + // Cache Key Filter + id cacheKeyFilter = self.cacheKeyFilter; + if (cacheKeyFilter) { + key = [cacheKeyFilter cacheKeyForURL:url]; + } else { + key = url.absoluteString; + } + + return key; +} + +- (nullable NSString *)originalCacheKeyForURL:(nullable NSURL *)url context:(nullable SDWebImageContext *)context { + if (!url) { + return @""; + } + + NSString *key; + // Cache Key Filter + id cacheKeyFilter = self.cacheKeyFilter; + if (context[SDWebImageContextCacheKeyFilter]) { + cacheKeyFilter = context[SDWebImageContextCacheKeyFilter]; + } + if (cacheKeyFilter) { + key = [cacheKeyFilter cacheKeyForURL:url]; + } else { + key = url.absoluteString; + } + + return key; +} + +- (nullable NSString *)cacheKeyForURL:(nullable NSURL *)url context:(nullable SDWebImageContext *)context { + if (!url) { + return @""; + } + + NSString *key; + // Cache Key Filter + id cacheKeyFilter = self.cacheKeyFilter; + if (context[SDWebImageContextCacheKeyFilter]) { + cacheKeyFilter = context[SDWebImageContextCacheKeyFilter]; + } + if (cacheKeyFilter) { + key = [cacheKeyFilter cacheKeyForURL:url]; + } else { + key = url.absoluteString; + } + + // Thumbnail Key Appending + NSValue *thumbnailSizeValue = context[SDWebImageContextImageThumbnailPixelSize]; + if (thumbnailSizeValue != nil) { + CGSize thumbnailSize = CGSizeZero; +#if SD_MAC + thumbnailSize = thumbnailSizeValue.sizeValue; +#else + thumbnailSize = thumbnailSizeValue.CGSizeValue; +#endif + BOOL preserveAspectRatio = YES; + NSNumber *preserveAspectRatioValue = context[SDWebImageContextImagePreserveAspectRatio]; + if (preserveAspectRatioValue != nil) { + preserveAspectRatio = preserveAspectRatioValue.boolValue; + } + key = SDThumbnailedKeyForKey(key, thumbnailSize, preserveAspectRatio); + } + + // Transformer Key Appending + id transformer = self.transformer; + if (context[SDWebImageContextImageTransformer]) { + transformer = context[SDWebImageContextImageTransformer]; + if (![transformer conformsToProtocol:@protocol(SDImageTransformer)]) { + transformer = nil; + } + } + if (transformer) { + key = SDTransformedKeyForKey(key, transformer.transformerKey); + } + + return key; +} + +- (SDWebImageCombinedOperation *)loadImageWithURL:(NSURL *)url options:(SDWebImageOptions)options progress:(SDImageLoaderProgressBlock)progressBlock completed:(SDInternalCompletionBlock)completedBlock { + return [self loadImageWithURL:url options:options context:nil progress:progressBlock completed:completedBlock]; +} + +- (SDWebImageCombinedOperation *)loadImageWithURL:(nullable NSURL *)url + options:(SDWebImageOptions)options + context:(nullable SDWebImageContext *)context + progress:(nullable SDImageLoaderProgressBlock)progressBlock + completed:(nonnull SDInternalCompletionBlock)completedBlock { + // Invoking this method without a completedBlock is pointless + NSAssert(completedBlock != nil, @"If you mean to prefetch the image, use -[SDWebImagePrefetcher prefetchURLs] instead"); + + // Very common mistake is to send the URL using NSString object instead of NSURL. For some strange reason, Xcode won't + // throw any warning for this type mismatch. Here we failsafe this error by allowing URLs to be passed as NSString. + if ([url isKindOfClass:NSString.class]) { + url = [NSURL URLWithString:(NSString *)url]; + } + + // Prevents app crashing on argument type error like sending NSNull instead of NSURL + if (![url isKindOfClass:NSURL.class]) { + url = nil; + } + + SDWebImageCombinedOperation *operation = [SDWebImageCombinedOperation new]; + operation.manager = self; + + BOOL isFailedUrl = NO; + if (url) { + SD_LOCK(_failedURLsLock); + isFailedUrl = [self.failedURLs containsObject:url]; + SD_UNLOCK(_failedURLsLock); + } + + if (url.absoluteString.length == 0 || (!(options & SDWebImageRetryFailed) && isFailedUrl)) { + NSString *description = isFailedUrl ? @"Image url is blacklisted" : @"Image url is nil"; + NSInteger code = isFailedUrl ? SDWebImageErrorBlackListed : SDWebImageErrorInvalidURL; + [self callCompletionBlockForOperation:operation completion:completedBlock error:[NSError errorWithDomain:SDWebImageErrorDomain code:code userInfo:@{NSLocalizedDescriptionKey : description}] url:url]; + return operation; + } + + SD_LOCK(_runningOperationsLock); + [self.runningOperations addObject:operation]; + SD_UNLOCK(_runningOperationsLock); + + // Preprocess the options and context arg to decide the final the result for manager + SDWebImageOptionsResult *result = [self processedResultForURL:url options:options context:context]; + + // Start the entry to load image from cache + [self callCacheProcessForOperation:operation url:url options:result.options context:result.context progress:progressBlock completed:completedBlock]; + + return operation; +} + +- (void)cancelAll { + SD_LOCK(_runningOperationsLock); + NSSet *copiedOperations = [self.runningOperations copy]; + SD_UNLOCK(_runningOperationsLock); + [copiedOperations makeObjectsPerformSelector:@selector(cancel)]; // This will call `safelyRemoveOperationFromRunning:` and remove from the array +} + +- (BOOL)isRunning { + BOOL isRunning = NO; + SD_LOCK(_runningOperationsLock); + isRunning = (self.runningOperations.count > 0); + SD_UNLOCK(_runningOperationsLock); + return isRunning; +} + +- (void)removeFailedURL:(NSURL *)url { + if (!url) { + return; + } + SD_LOCK(_failedURLsLock); + [self.failedURLs removeObject:url]; + SD_UNLOCK(_failedURLsLock); +} + +- (void)removeAllFailedURLs { + SD_LOCK(_failedURLsLock); + [self.failedURLs removeAllObjects]; + SD_UNLOCK(_failedURLsLock); +} + +#pragma mark - Private + +// Query normal cache process +- (void)callCacheProcessForOperation:(nonnull SDWebImageCombinedOperation *)operation + url:(nonnull NSURL *)url + options:(SDWebImageOptions)options + context:(nullable SDWebImageContext *)context + progress:(nullable SDImageLoaderProgressBlock)progressBlock + completed:(nullable SDInternalCompletionBlock)completedBlock { + // Grab the image cache to use + id imageCache; + if ([context[SDWebImageContextImageCache] conformsToProtocol:@protocol(SDImageCache)]) { + imageCache = context[SDWebImageContextImageCache]; + } else { + imageCache = self.imageCache; + } + // Get the query cache type + SDImageCacheType queryCacheType = SDImageCacheTypeAll; + if (context[SDWebImageContextQueryCacheType]) { + queryCacheType = [context[SDWebImageContextQueryCacheType] integerValue]; + } + + // Check whether we should query cache + BOOL shouldQueryCache = !SD_OPTIONS_CONTAINS(options, SDWebImageFromLoaderOnly); + if (shouldQueryCache) { + NSString *key = [self cacheKeyForURL:url context:context]; + @weakify(operation); + operation.cacheOperation = [imageCache queryImageForKey:key options:options context:context cacheType:queryCacheType completion:^(UIImage * _Nullable cachedImage, NSData * _Nullable cachedData, SDImageCacheType cacheType) { + @strongify(operation); + if (!operation || operation.isCancelled) { + // Image combined operation cancelled by user + [self callCompletionBlockForOperation:operation completion:completedBlock error:[NSError errorWithDomain:SDWebImageErrorDomain code:SDWebImageErrorCancelled userInfo:@{NSLocalizedDescriptionKey : @"Operation cancelled by user during querying the cache"}] url:url]; + [self safelyRemoveOperationFromRunning:operation]; + return; + } else if (!cachedImage) { + BOOL mayInOriginalCache = context[SDWebImageContextImageTransformer] || context[SDWebImageContextImageThumbnailPixelSize]; + // Have a chance to query original cache instead of downloading, then applying transform + // Thumbnail decoding is done inside SDImageCache's decoding part, which does not need post processing for transform + if (mayInOriginalCache) { + [self callOriginalCacheProcessForOperation:operation url:url options:options context:context progress:progressBlock completed:completedBlock]; + return; + } + } + + // Continue download process + [self callDownloadProcessForOperation:operation url:url options:options context:context cachedImage:cachedImage cachedData:cachedData cacheType:cacheType progress:progressBlock completed:completedBlock]; + }]; + } else { + // Continue download process + [self callDownloadProcessForOperation:operation url:url options:options context:context cachedImage:nil cachedData:nil cacheType:SDImageCacheTypeNone progress:progressBlock completed:completedBlock]; + } +} + +// Query original cache process +- (void)callOriginalCacheProcessForOperation:(nonnull SDWebImageCombinedOperation *)operation + url:(nonnull NSURL *)url + options:(SDWebImageOptions)options + context:(nullable SDWebImageContext *)context + progress:(nullable SDImageLoaderProgressBlock)progressBlock + completed:(nullable SDInternalCompletionBlock)completedBlock { + // Grab the image cache to use, choose standalone original cache firstly + id imageCache; + if ([context[SDWebImageContextOriginalImageCache] conformsToProtocol:@protocol(SDImageCache)]) { + imageCache = context[SDWebImageContextOriginalImageCache]; + } else { + // if no standalone cache available, use default cache + if ([context[SDWebImageContextImageCache] conformsToProtocol:@protocol(SDImageCache)]) { + imageCache = context[SDWebImageContextImageCache]; + } else { + imageCache = self.imageCache; + } + } + // Get the original query cache type + SDImageCacheType originalQueryCacheType = SDImageCacheTypeDisk; + if (context[SDWebImageContextOriginalQueryCacheType]) { + originalQueryCacheType = [context[SDWebImageContextOriginalQueryCacheType] integerValue]; + } + + // Check whether we should query original cache + BOOL shouldQueryOriginalCache = (originalQueryCacheType != SDImageCacheTypeNone); + if (shouldQueryOriginalCache) { + // Get original cache key generation without transformer/thumbnail + NSString *key = [self originalCacheKeyForURL:url context:context]; + @weakify(operation); + operation.cacheOperation = [imageCache queryImageForKey:key options:options context:context cacheType:originalQueryCacheType completion:^(UIImage * _Nullable cachedImage, NSData * _Nullable cachedData, SDImageCacheType cacheType) { + @strongify(operation); + if (!operation || operation.isCancelled) { + // Image combined operation cancelled by user + [self callCompletionBlockForOperation:operation completion:completedBlock error:[NSError errorWithDomain:SDWebImageErrorDomain code:SDWebImageErrorCancelled userInfo:@{NSLocalizedDescriptionKey : @"Operation cancelled by user during querying the cache"}] url:url]; + [self safelyRemoveOperationFromRunning:operation]; + return; + } else if (!cachedImage) { + // Original image cache miss. Continue download process + [self callDownloadProcessForOperation:operation url:url options:options context:context cachedImage:nil cachedData:nil cacheType:SDImageCacheTypeNone progress:progressBlock completed:completedBlock]; + return; + } + + // Use the store cache process instead of downloading, and ignore .refreshCached option for now + [self callStoreCacheProcessForOperation:operation url:url options:options context:context downloadedImage:cachedImage downloadedData:cachedData cacheType:cacheType finished:YES completed:completedBlock]; + + [self safelyRemoveOperationFromRunning:operation]; + }]; + } else { + // Continue download process + [self callDownloadProcessForOperation:operation url:url options:options context:context cachedImage:nil cachedData:nil cacheType:SDImageCacheTypeNone progress:progressBlock completed:completedBlock]; + } +} + +// Download process +- (void)callDownloadProcessForOperation:(nonnull SDWebImageCombinedOperation *)operation + url:(nonnull NSURL *)url + options:(SDWebImageOptions)options + context:(SDWebImageContext *)context + cachedImage:(nullable UIImage *)cachedImage + cachedData:(nullable NSData *)cachedData + cacheType:(SDImageCacheType)cacheType + progress:(nullable SDImageLoaderProgressBlock)progressBlock + completed:(nullable SDInternalCompletionBlock)completedBlock { + // Mark the cache operation end + @synchronized (operation) { + operation.cacheOperation = nil; + } + + // Grab the image loader to use + id imageLoader; + if ([context[SDWebImageContextImageLoader] conformsToProtocol:@protocol(SDImageLoader)]) { + imageLoader = context[SDWebImageContextImageLoader]; + } else { + imageLoader = self.imageLoader; + } + + // Check whether we should download image from network + BOOL shouldDownload = !SD_OPTIONS_CONTAINS(options, SDWebImageFromCacheOnly); + shouldDownload &= (!cachedImage || options & SDWebImageRefreshCached); + shouldDownload &= (![self.delegate respondsToSelector:@selector(imageManager:shouldDownloadImageForURL:)] || [self.delegate imageManager:self shouldDownloadImageForURL:url]); + if ([imageLoader respondsToSelector:@selector(canRequestImageForURL:options:context:)]) { + shouldDownload &= [imageLoader canRequestImageForURL:url options:options context:context]; + } else { + shouldDownload &= [imageLoader canRequestImageForURL:url]; + } + if (shouldDownload) { + if (cachedImage && options & SDWebImageRefreshCached) { + // If image was found in the cache but SDWebImageRefreshCached is provided, notify about the cached image + // AND try to re-download it in order to let a chance to NSURLCache to refresh it from server. + [self callCompletionBlockForOperation:operation completion:completedBlock image:cachedImage data:cachedData error:nil cacheType:cacheType finished:YES url:url]; + // Pass the cached image to the image loader. The image loader should check whether the remote image is equal to the cached image. + SDWebImageMutableContext *mutableContext; + if (context) { + mutableContext = [context mutableCopy]; + } else { + mutableContext = [NSMutableDictionary dictionary]; + } + mutableContext[SDWebImageContextLoaderCachedImage] = cachedImage; + context = [mutableContext copy]; + } + + @weakify(operation); + operation.loaderOperation = [imageLoader requestImageWithURL:url options:options context:context progress:progressBlock completed:^(UIImage *downloadedImage, NSData *downloadedData, NSError *error, BOOL finished) { + @strongify(operation); + if (!operation || operation.isCancelled) { + // Image combined operation cancelled by user + [self callCompletionBlockForOperation:operation completion:completedBlock error:[NSError errorWithDomain:SDWebImageErrorDomain code:SDWebImageErrorCancelled userInfo:@{NSLocalizedDescriptionKey : @"Operation cancelled by user during sending the request"}] url:url]; + } else if (cachedImage && options & SDWebImageRefreshCached && [error.domain isEqualToString:SDWebImageErrorDomain] && error.code == SDWebImageErrorCacheNotModified) { + // Image refresh hit the NSURLCache cache, do not call the completion block + } else if ([error.domain isEqualToString:SDWebImageErrorDomain] && error.code == SDWebImageErrorCancelled) { + // Download operation cancelled by user before sending the request, don't block failed URL + [self callCompletionBlockForOperation:operation completion:completedBlock error:error url:url]; + } else if (error) { + [self callCompletionBlockForOperation:operation completion:completedBlock error:error url:url]; + BOOL shouldBlockFailedURL = [self shouldBlockFailedURLWithURL:url error:error options:options context:context]; + + if (shouldBlockFailedURL) { + SD_LOCK(self->_failedURLsLock); + [self.failedURLs addObject:url]; + SD_UNLOCK(self->_failedURLsLock); + } + } else { + if ((options & SDWebImageRetryFailed)) { + SD_LOCK(self->_failedURLsLock); + [self.failedURLs removeObject:url]; + SD_UNLOCK(self->_failedURLsLock); + } + // Continue store cache process + [self callStoreCacheProcessForOperation:operation url:url options:options context:context downloadedImage:downloadedImage downloadedData:downloadedData cacheType:SDImageCacheTypeNone finished:finished completed:completedBlock]; + } + + if (finished) { + [self safelyRemoveOperationFromRunning:operation]; + } + }]; + } else if (cachedImage) { + [self callCompletionBlockForOperation:operation completion:completedBlock image:cachedImage data:cachedData error:nil cacheType:cacheType finished:YES url:url]; + [self safelyRemoveOperationFromRunning:operation]; + } else { + // Image not in cache and download disallowed by delegate + [self callCompletionBlockForOperation:operation completion:completedBlock image:nil data:nil error:nil cacheType:SDImageCacheTypeNone finished:YES url:url]; + [self safelyRemoveOperationFromRunning:operation]; + } +} + +// Store cache process +- (void)callStoreCacheProcessForOperation:(nonnull SDWebImageCombinedOperation *)operation + url:(nonnull NSURL *)url + options:(SDWebImageOptions)options + context:(SDWebImageContext *)context + downloadedImage:(nullable UIImage *)downloadedImage + downloadedData:(nullable NSData *)downloadedData + cacheType:(SDImageCacheType)cacheType + finished:(BOOL)finished + completed:(nullable SDInternalCompletionBlock)completedBlock { + // Grab the image cache to use, choose standalone original cache firstly + id imageCache; + if ([context[SDWebImageContextOriginalImageCache] conformsToProtocol:@protocol(SDImageCache)]) { + imageCache = context[SDWebImageContextOriginalImageCache]; + } else { + // if no standalone cache available, use default cache + if ([context[SDWebImageContextImageCache] conformsToProtocol:@protocol(SDImageCache)]) { + imageCache = context[SDWebImageContextImageCache]; + } else { + imageCache = self.imageCache; + } + } + BOOL waitStoreCache = SD_OPTIONS_CONTAINS(options, SDWebImageWaitStoreCache); + // the target image store cache type + SDImageCacheType storeCacheType = SDImageCacheTypeAll; + if (context[SDWebImageContextStoreCacheType]) { + storeCacheType = [context[SDWebImageContextStoreCacheType] integerValue]; + } + // the original store image cache type + SDImageCacheType originalStoreCacheType = SDImageCacheTypeDisk; + if (context[SDWebImageContextOriginalStoreCacheType]) { + originalStoreCacheType = [context[SDWebImageContextOriginalStoreCacheType] integerValue]; + } + id transformer = context[SDWebImageContextImageTransformer]; + if (![transformer conformsToProtocol:@protocol(SDImageTransformer)]) { + transformer = nil; + } + id cacheSerializer = context[SDWebImageContextCacheSerializer]; + + // transformer check + BOOL shouldTransformImage = downloadedImage && transformer; + shouldTransformImage = shouldTransformImage && (!downloadedImage.sd_isAnimated || (options & SDWebImageTransformAnimatedImage)); + shouldTransformImage = shouldTransformImage && (!downloadedImage.sd_isVector || (options & SDWebImageTransformVectorImage)); + // thumbnail check + BOOL shouldThumbnailImage = context[SDWebImageContextImageThumbnailPixelSize] != nil || downloadedImage.sd_decodeOptions[SDImageCoderDecodeThumbnailPixelSize] != nil; + + BOOL shouldCacheOriginal = downloadedImage && finished && cacheType == SDImageCacheTypeNone; + + // if available, store original image to cache + if (shouldCacheOriginal) { + // Get original cache key generation without transformer/thumbnail + NSString *key = [self originalCacheKeyForURL:url context:context]; + // normally use the store cache type, but if target image is transformed, use original store cache type instead + SDImageCacheType targetStoreCacheType = (shouldTransformImage || shouldThumbnailImage) ? originalStoreCacheType : storeCacheType; + UIImage *fullSizeImage = downloadedImage; + if (shouldThumbnailImage) { + // Thumbnail decoding does not keep original image + // Here we only store the original data to disk for original cache key + // Store thumbnail image to memory for thumbnail cache key later in `storeTransformCacheProcess` + fullSizeImage = nil; + } + if (fullSizeImage && cacheSerializer && (targetStoreCacheType == SDImageCacheTypeDisk || targetStoreCacheType == SDImageCacheTypeAll)) { + dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{ + @autoreleasepool { + NSData *cacheData = [cacheSerializer cacheDataWithImage:fullSizeImage originalData:downloadedData imageURL:url]; + [self storeImage:fullSizeImage imageData:cacheData forKey:key imageCache:imageCache cacheType:targetStoreCacheType waitStoreCache:waitStoreCache completion:^{ + // Continue transform process + [self callTransformProcessForOperation:operation url:url options:options context:context originalImage:downloadedImage originalData:downloadedData cacheType:cacheType finished:finished completed:completedBlock]; + }]; + } + }); + } else { + [self storeImage:fullSizeImage imageData:downloadedData forKey:key imageCache:imageCache cacheType:targetStoreCacheType waitStoreCache:waitStoreCache completion:^{ + // Continue transform process + [self callTransformProcessForOperation:operation url:url options:options context:context originalImage:downloadedImage originalData:downloadedData cacheType:cacheType finished:finished completed:completedBlock]; + }]; + } + } else { + // Continue transform process + [self callTransformProcessForOperation:operation url:url options:options context:context originalImage:downloadedImage originalData:downloadedData cacheType:cacheType finished:finished completed:completedBlock]; + } +} + +// Transform process +- (void)callTransformProcessForOperation:(nonnull SDWebImageCombinedOperation *)operation + url:(nonnull NSURL *)url + options:(SDWebImageOptions)options + context:(SDWebImageContext *)context + originalImage:(nullable UIImage *)originalImage + originalData:(nullable NSData *)originalData + cacheType:(SDImageCacheType)cacheType + finished:(BOOL)finished + completed:(nullable SDInternalCompletionBlock)completedBlock { + id transformer = context[SDWebImageContextImageTransformer]; + if (![transformer conformsToProtocol:@protocol(SDImageTransformer)]) { + transformer = nil; + } + + // transformer check + BOOL shouldTransformImage = originalImage && transformer; + shouldTransformImage = shouldTransformImage && (!originalImage.sd_isAnimated || (options & SDWebImageTransformAnimatedImage)); + shouldTransformImage = shouldTransformImage && (!originalImage.sd_isVector || (options & SDWebImageTransformVectorImage)); + + // thumbnail check + // This exist when previous thumbnail pipeline callback into next full size pipeline, because we share the same URL download but need different image + // Actually this is a hack, we attach the metadata into image object, which should design a better concept like `ImageInfo` and keep that around + // Redecode need the full size data (progressive decoding or third-party loaders may callback nil data) + BOOL shouldRedecodeFullImage = originalData && cacheType == SDImageCacheTypeNone; + if (shouldRedecodeFullImage) { + // If the retuened image decode options exist (some loaders impl does not use `SDImageLoaderDecode`) but does not match the options we provide, redecode + SDImageCoderOptions *returnedDecodeOptions = originalImage.sd_decodeOptions; + if (returnedDecodeOptions) { + SDImageCoderOptions *decodeOptions = SDGetDecodeOptionsFromContext(context, options, url.absoluteString); + shouldRedecodeFullImage = ![returnedDecodeOptions isEqualToDictionary:decodeOptions]; + } else { + shouldRedecodeFullImage = NO; + } + } + + if (shouldTransformImage) { + dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{ + @autoreleasepool { + // transformed/thumbnailed cache key + NSString *key = [self cacheKeyForURL:url context:context]; + // Case that transformer one thumbnail, which this time need full pixel image + UIImage *fullSizeImage = originalImage; + BOOL imageWasRedecoded = NO; + if (shouldRedecodeFullImage) { + fullSizeImage = SDImageCacheDecodeImageData(originalData, key, options, context); + if (fullSizeImage) { + imageWasRedecoded = YES; + } else { + imageWasRedecoded = NO; + fullSizeImage = originalImage; // Fallback + } + } + UIImage *transformedImage = [transformer transformedImageWithImage:fullSizeImage forKey:key]; + if (transformedImage && finished) { + BOOL imageWasTransformed = ![transformedImage isEqual:fullSizeImage]; + // Continue store transform cache process + [self callStoreTransformCacheProcessForOperation:operation url:url options:options context:context image:transformedImage data:originalData cacheType:cacheType finished:finished transformed:imageWasTransformed || imageWasRedecoded completed:completedBlock]; + } else { + // Continue store transform cache process + [self callStoreTransformCacheProcessForOperation:operation url:url options:options context:context image:fullSizeImage data:originalData cacheType:cacheType finished:finished transformed:imageWasRedecoded completed:completedBlock]; + } + } + }); + } else if (shouldRedecodeFullImage) { + dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{ + @autoreleasepool { + // Re-decode because the returned image does not match current request pipeline's context + UIImage *fullSizeImage = SDImageCacheDecodeImageData(originalData, url.absoluteString, options, context); + BOOL imageWasRedecoded = NO; + if (fullSizeImage) { + imageWasRedecoded = YES; + } else { + imageWasRedecoded = NO; + fullSizeImage = originalImage; // Fallback + } + // Continue store transform cache process + [self callStoreTransformCacheProcessForOperation:operation url:url options:options context:context image:fullSizeImage data:originalData cacheType:cacheType finished:finished transformed:imageWasRedecoded completed:completedBlock]; + } + }); + } else { + // Continue store transform cache process + [self callStoreTransformCacheProcessForOperation:operation url:url options:options context:context image:originalImage data:originalData cacheType:cacheType finished:finished transformed:NO completed:completedBlock]; + } +} + +- (void)callStoreTransformCacheProcessForOperation:(nonnull SDWebImageCombinedOperation *)operation + url:(nonnull NSURL *)url + options:(SDWebImageOptions)options + context:(SDWebImageContext *)context + image:(nullable UIImage *)image + data:(nullable NSData *)data + cacheType:(SDImageCacheType)cacheType + finished:(BOOL)finished + transformed:(BOOL)transformed + completed:(nullable SDInternalCompletionBlock)completedBlock { + // Grab the image cache to use + id imageCache; + if ([context[SDWebImageContextImageCache] conformsToProtocol:@protocol(SDImageCache)]) { + imageCache = context[SDWebImageContextImageCache]; + } else { + imageCache = self.imageCache; + } + BOOL waitStoreCache = SD_OPTIONS_CONTAINS(options, SDWebImageWaitStoreCache); + // the target image store cache type + SDImageCacheType storeCacheType = SDImageCacheTypeAll; + if (context[SDWebImageContextStoreCacheType]) { + storeCacheType = [context[SDWebImageContextStoreCacheType] integerValue]; + } + id cacheSerializer = context[SDWebImageContextCacheSerializer]; + // thumbnail check + BOOL shouldThumbnailImage = context[SDWebImageContextImageThumbnailPixelSize] != nil || image.sd_decodeOptions[SDImageCoderDecodeThumbnailPixelSize] != nil; + + // Store the transformed/thumbnail image into the cache + if (image && (transformed || shouldThumbnailImage)) { + NSData *cacheData; + // pass nil if the image was transformed/thumbnailed, so we can recalculate the data from the image + if (cacheSerializer && (storeCacheType == SDImageCacheTypeDisk || storeCacheType == SDImageCacheTypeAll)) { + cacheData = [cacheSerializer cacheDataWithImage:image originalData:nil imageURL:url]; + } else { + cacheData = nil; + } + // transformed/thumbnailed cache key + NSString *key = [self cacheKeyForURL:url context:context]; + [self storeImage:image imageData:cacheData forKey:key imageCache:imageCache cacheType:storeCacheType waitStoreCache:waitStoreCache completion:^{ + [self callCompletionBlockForOperation:operation completion:completedBlock image:image data:data error:nil cacheType:cacheType finished:finished url:url]; + }]; + } else { + [self callCompletionBlockForOperation:operation completion:completedBlock image:image data:data error:nil cacheType:cacheType finished:finished url:url]; + } +} + +#pragma mark - Helper + +- (void)safelyRemoveOperationFromRunning:(nullable SDWebImageCombinedOperation*)operation { + if (!operation) { + return; + } + SD_LOCK(_runningOperationsLock); + [self.runningOperations removeObject:operation]; + SD_UNLOCK(_runningOperationsLock); +} + +- (void)storeImage:(nullable UIImage *)image + imageData:(nullable NSData *)data + forKey:(nullable NSString *)key + imageCache:(nonnull id)imageCache + cacheType:(SDImageCacheType)cacheType + waitStoreCache:(BOOL)waitStoreCache + completion:(nullable SDWebImageNoParamsBlock)completion { + // Check whether we should wait the store cache finished. If not, callback immediately + [imageCache storeImage:image imageData:data forKey:key cacheType:cacheType completion:^{ + if (waitStoreCache) { + if (completion) { + completion(); + } + } + }]; + if (!waitStoreCache) { + if (completion) { + completion(); + } + } +} + +- (void)callCompletionBlockForOperation:(nullable SDWebImageCombinedOperation*)operation + completion:(nullable SDInternalCompletionBlock)completionBlock + error:(nullable NSError *)error + url:(nullable NSURL *)url { + [self callCompletionBlockForOperation:operation completion:completionBlock image:nil data:nil error:error cacheType:SDImageCacheTypeNone finished:YES url:url]; +} + +- (void)callCompletionBlockForOperation:(nullable SDWebImageCombinedOperation*)operation + completion:(nullable SDInternalCompletionBlock)completionBlock + image:(nullable UIImage *)image + data:(nullable NSData *)data + error:(nullable NSError *)error + cacheType:(SDImageCacheType)cacheType + finished:(BOOL)finished + url:(nullable NSURL *)url { + dispatch_main_async_safe(^{ + if (completionBlock) { + completionBlock(image, data, error, cacheType, finished, url); + } + }); +} + +- (BOOL)shouldBlockFailedURLWithURL:(nonnull NSURL *)url + error:(nonnull NSError *)error + options:(SDWebImageOptions)options + context:(nullable SDWebImageContext *)context { + id imageLoader; + if ([context[SDWebImageContextImageLoader] conformsToProtocol:@protocol(SDImageLoader)]) { + imageLoader = context[SDWebImageContextImageLoader]; + } else { + imageLoader = self.imageLoader; + } + // Check whether we should block failed url + BOOL shouldBlockFailedURL; + if ([self.delegate respondsToSelector:@selector(imageManager:shouldBlockFailedURL:withError:)]) { + shouldBlockFailedURL = [self.delegate imageManager:self shouldBlockFailedURL:url withError:error]; + } else { + if ([imageLoader respondsToSelector:@selector(shouldBlockFailedURLWithURL:error:options:context:)]) { + shouldBlockFailedURL = [imageLoader shouldBlockFailedURLWithURL:url error:error options:options context:context]; + } else { + shouldBlockFailedURL = [imageLoader shouldBlockFailedURLWithURL:url error:error]; + } + } + + return shouldBlockFailedURL; +} + +- (SDWebImageOptionsResult *)processedResultForURL:(NSURL *)url options:(SDWebImageOptions)options context:(SDWebImageContext *)context { + SDWebImageOptionsResult *result; + SDWebImageMutableContext *mutableContext = [SDWebImageMutableContext dictionary]; + + // Image Transformer from manager + if (!context[SDWebImageContextImageTransformer]) { + id transformer = self.transformer; + [mutableContext setValue:transformer forKey:SDWebImageContextImageTransformer]; + } + // Cache key filter from manager + if (!context[SDWebImageContextCacheKeyFilter]) { + id cacheKeyFilter = self.cacheKeyFilter; + [mutableContext setValue:cacheKeyFilter forKey:SDWebImageContextCacheKeyFilter]; + } + // Cache serializer from manager + if (!context[SDWebImageContextCacheSerializer]) { + id cacheSerializer = self.cacheSerializer; + [mutableContext setValue:cacheSerializer forKey:SDWebImageContextCacheSerializer]; + } + + if (mutableContext.count > 0) { + if (context) { + [mutableContext addEntriesFromDictionary:context]; + } + context = [mutableContext copy]; + } + + // Apply options processor + if (self.optionsProcessor) { + result = [self.optionsProcessor processedResultForURL:url options:options context:context]; + } + if (!result) { + // Use default options result + result = [[SDWebImageOptionsResult alloc] initWithOptions:options context:context]; + } + + return result; +} + +@end + + +@implementation SDWebImageCombinedOperation + +- (void)cancel { + @synchronized(self) { + if (self.isCancelled) { + return; + } + self.cancelled = YES; + if (self.cacheOperation) { + [self.cacheOperation cancel]; + self.cacheOperation = nil; + } + if (self.loaderOperation) { + [self.loaderOperation cancel]; + self.loaderOperation = nil; + } + [self.manager safelyRemoveOperationFromRunning:self]; + } +} + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageOperation.h b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageOperation.h new file mode 100644 index 0000000..bc4224f --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageOperation.h @@ -0,0 +1,27 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import + +/// A protocol represents cancelable operation. +@protocol SDWebImageOperation + +/// Cancel the operation +- (void)cancel; + +@optional + +/// Whether the operation has been cancelled. +@property (nonatomic, assign, readonly, getter=isCancelled) BOOL cancelled; + +@end + +/// NSOperation conform to `SDWebImageOperation`. +@interface NSOperation (SDWebImageOperation) + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageOperation.m b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageOperation.m new file mode 100644 index 0000000..0d6e880 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageOperation.m @@ -0,0 +1,14 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageOperation.h" + +/// NSOperation conform to `SDWebImageOperation`. +@implementation NSOperation (SDWebImageOperation) + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageOptionsProcessor.h b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageOptionsProcessor.h new file mode 100644 index 0000000..31ef153 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageOptionsProcessor.h @@ -0,0 +1,72 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import +#import "SDWebImageCompat.h" +#import "SDWebImageDefine.h" + +@class SDWebImageOptionsResult; + +typedef SDWebImageOptionsResult * _Nullable(^SDWebImageOptionsProcessorBlock)(NSURL * _Nullable url, SDWebImageOptions options, SDWebImageContext * _Nullable context); + +/** + The options result contains both options and context. + */ +@interface SDWebImageOptionsResult : NSObject + +/** + WebCache options. + */ +@property (nonatomic, assign, readonly) SDWebImageOptions options; + +/** + Context options. + */ +@property (nonatomic, copy, readonly, nullable) SDWebImageContext *context; + +/** + Create a new options result. + + @param options options + @param context context + @return The options result contains both options and context. + */ +- (nonnull instancetype)initWithOptions:(SDWebImageOptions)options context:(nullable SDWebImageContext *)context; + +@end + +/** + This is the protocol for options processor. + Options processor can be used, to control the final result for individual image request's `SDWebImageOptions` and `SDWebImageContext` + Implements the protocol to have a global control for each indivadual image request's option. + */ +@protocol SDWebImageOptionsProcessor + +/** + Return the processed options result for specify image URL, with its options and context + + @param url The URL to the image + @param options A mask to specify options to use for this request + @param context A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold. + @return The processed result, contains both options and context + */ +- (nullable SDWebImageOptionsResult *)processedResultForURL:(nullable NSURL *)url + options:(SDWebImageOptions)options + context:(nullable SDWebImageContext *)context; + +@end + +/** + A options processor class with block. + */ +@interface SDWebImageOptionsProcessor : NSObject + +- (nonnull instancetype)initWithBlock:(nonnull SDWebImageOptionsProcessorBlock)block; ++ (nonnull instancetype)optionsProcessorWithBlock:(nonnull SDWebImageOptionsProcessorBlock)block; + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageOptionsProcessor.m b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageOptionsProcessor.m new file mode 100644 index 0000000..8e7bc35 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageOptionsProcessor.m @@ -0,0 +1,59 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageOptionsProcessor.h" + +@interface SDWebImageOptionsResult () + +@property (nonatomic, assign) SDWebImageOptions options; +@property (nonatomic, copy, nullable) SDWebImageContext *context; + +@end + +@implementation SDWebImageOptionsResult + +- (instancetype)initWithOptions:(SDWebImageOptions)options context:(SDWebImageContext *)context { + self = [super init]; + if (self) { + self.options = options; + self.context = context; + } + return self; +} + +@end + +@interface SDWebImageOptionsProcessor () + +@property (nonatomic, copy, nonnull) SDWebImageOptionsProcessorBlock block; + +@end + +@implementation SDWebImageOptionsProcessor + +- (instancetype)initWithBlock:(SDWebImageOptionsProcessorBlock)block { + self = [super init]; + if (self) { + self.block = block; + } + return self; +} + ++ (instancetype)optionsProcessorWithBlock:(SDWebImageOptionsProcessorBlock)block { + SDWebImageOptionsProcessor *optionsProcessor = [[SDWebImageOptionsProcessor alloc] initWithBlock:block]; + return optionsProcessor; +} + +- (SDWebImageOptionsResult *)processedResultForURL:(NSURL *)url options:(SDWebImageOptions)options context:(SDWebImageContext *)context { + if (!self.block) { + return nil; + } + return self.block(url, options, context); +} + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImagePrefetcher.h b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImagePrefetcher.h new file mode 100644 index 0000000..a9b2c1f --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImagePrefetcher.h @@ -0,0 +1,143 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import +#import "SDWebImageManager.h" + +@class SDWebImagePrefetcher; + +/** + A token represents a list of URLs, can be used to cancel the download. + */ +@interface SDWebImagePrefetchToken : NSObject + +/** + * Cancel the current prefetching. + */ +- (void)cancel; + +/** + list of URLs of current prefetching. + */ +@property (nonatomic, copy, readonly, nullable) NSArray *urls; + +@end + +/** + The prefetcher delegate protocol + */ +@protocol SDWebImagePrefetcherDelegate + +@optional + +/** + * Called when an image was prefetched. Which means it's called when one URL from any of prefetching finished. + * + * @param imagePrefetcher The current image prefetcher + * @param imageURL The image url that was prefetched + * @param finishedCount The total number of images that were prefetched (successful or not) + * @param totalCount The total number of images that were to be prefetched + */ +- (void)imagePrefetcher:(nonnull SDWebImagePrefetcher *)imagePrefetcher didPrefetchURL:(nullable NSURL *)imageURL finishedCount:(NSUInteger)finishedCount totalCount:(NSUInteger)totalCount; + +/** + * Called when all images are prefetched. Which means it's called when all URLs from all of prefetching finished. + * @param imagePrefetcher The current image prefetcher + * @param totalCount The total number of images that were prefetched (whether successful or not) + * @param skippedCount The total number of images that were skipped + */ +- (void)imagePrefetcher:(nonnull SDWebImagePrefetcher *)imagePrefetcher didFinishWithTotalCount:(NSUInteger)totalCount skippedCount:(NSUInteger)skippedCount; + +@end + +typedef void(^SDWebImagePrefetcherProgressBlock)(NSUInteger noOfFinishedUrls, NSUInteger noOfTotalUrls); +typedef void(^SDWebImagePrefetcherCompletionBlock)(NSUInteger noOfFinishedUrls, NSUInteger noOfSkippedUrls); + +/** + * Prefetch some URLs in the cache for future use. Images are downloaded in low priority. + */ +@interface SDWebImagePrefetcher : NSObject + +/** + * The web image manager used by prefetcher to prefetch images. + * @note You can specify a standalone manager and downloader with custom configuration suitable for image prefetching. Such as `currentDownloadCount` or `downloadTimeout`. + */ +@property (strong, nonatomic, readonly, nonnull) SDWebImageManager *manager; + +/** + * Maximum number of URLs to prefetch at the same time. Defaults to 3. + */ +@property (nonatomic, assign) NSUInteger maxConcurrentPrefetchCount; + +/** + * The options for prefetcher. Defaults to SDWebImageLowPriority. + */ +@property (nonatomic, assign) SDWebImageOptions options; + +/** + * The context for prefetcher. Defaults to nil. + */ +@property (nonatomic, copy, nullable) SDWebImageContext *context; + +/** + * Queue options for prefetcher when call the progressBlock, completionBlock and delegate methods. Defaults to Main Queue. + * @note The call is asynchronously to avoid blocking target queue. + * @note The delegate queue should be set before any prefetching start and may not be changed during prefetching to avoid thread-safe problem. + */ +@property (strong, nonatomic, nonnull) dispatch_queue_t delegateQueue; + +/** + * The delegate for the prefetcher. Defaults to nil. + */ +@property (weak, nonatomic, nullable) id delegate; + +/** + * Returns the global shared image prefetcher instance. It use a standalone manager which is different from shared manager. + */ +@property (nonatomic, class, readonly, nonnull) SDWebImagePrefetcher *sharedImagePrefetcher; + +/** + * Allows you to instantiate a prefetcher with any arbitrary image manager. + */ +- (nonnull instancetype)initWithImageManager:(nonnull SDWebImageManager *)manager NS_DESIGNATED_INITIALIZER; + +/** + * Assign list of URLs to let SDWebImagePrefetcher to queue the prefetching. It based on the image manager so the image may from the cache and network according to the `options` property. + * Prefetching is separate to each other, which means the progressBlock and completionBlock you provide is bind to the prefetching for the list of urls. + * Attention that call this will not cancel previous fetched urls. You should keep the token return by this to cancel or cancel all the prefetch. + * + * @param urls list of URLs to prefetch + * @return the token to cancel the current prefetching. + */ +- (nullable SDWebImagePrefetchToken *)prefetchURLs:(nullable NSArray *)urls; + +/** + * Assign list of URLs to let SDWebImagePrefetcher to queue the prefetching. It based on the image manager so the image may from the cache and network according to the `options` property. + * Prefetching is separate to each other, which means the progressBlock and completionBlock you provide is bind to the prefetching for the list of urls. + * Attention that call this will not cancel previous fetched urls. You should keep the token return by this to cancel or cancel all the prefetch. + * + * @param urls list of URLs to prefetch + * @param progressBlock block to be called when progress updates; + * first parameter is the number of completed (successful or not) requests, + * second parameter is the total number of images originally requested to be prefetched + * @param completionBlock block to be called when the current prefetching is completed + * first param is the number of completed (successful or not) requests, + * second parameter is the number of skipped requests + * @return the token to cancel the current prefetching. + */ +- (nullable SDWebImagePrefetchToken *)prefetchURLs:(nullable NSArray *)urls + progress:(nullable SDWebImagePrefetcherProgressBlock)progressBlock + completed:(nullable SDWebImagePrefetcherCompletionBlock)completionBlock; + +/** + * Remove and cancel all the prefeching for the prefetcher. + */ +- (void)cancelPrefetching; + + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImagePrefetcher.m b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImagePrefetcher.m new file mode 100644 index 0000000..b6632fa --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImagePrefetcher.m @@ -0,0 +1,305 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImagePrefetcher.h" +#import "SDAsyncBlockOperation.h" +#import "SDInternalMacros.h" +#import + +@interface SDWebImagePrefetchToken () { + @public + // Though current implementation, `SDWebImageManager` completion block is always on main queue. But however, there is no guarantee in docs. And we may introduce config to specify custom queue in the future. + // These value are just used as incrementing counter, keep thread-safe using memory_order_relaxed for performance. + atomic_ulong _skippedCount; + atomic_ulong _finishedCount; + atomic_flag _isAllFinished; + + unsigned long _totalCount; + + // Used to ensure NSPointerArray thread safe + SD_LOCK_DECLARE(_prefetchOperationsLock); + SD_LOCK_DECLARE(_loadOperationsLock); +} + +@property (nonatomic, copy, readwrite) NSArray *urls; +@property (nonatomic, strong) NSPointerArray *loadOperations; +@property (nonatomic, strong) NSPointerArray *prefetchOperations; +@property (nonatomic, weak) SDWebImagePrefetcher *prefetcher; +@property (nonatomic, copy, nullable) SDWebImagePrefetcherCompletionBlock completionBlock; +@property (nonatomic, copy, nullable) SDWebImagePrefetcherProgressBlock progressBlock; + +@end + +@interface SDWebImagePrefetcher () + +@property (strong, nonatomic, nonnull) SDWebImageManager *manager; +@property (strong, atomic, nonnull) NSMutableSet *runningTokens; +@property (strong, nonatomic, nonnull) NSOperationQueue *prefetchQueue; + +@end + +@implementation SDWebImagePrefetcher + ++ (nonnull instancetype)sharedImagePrefetcher { + static dispatch_once_t once; + static id instance; + dispatch_once(&once, ^{ + instance = [self new]; + }); + return instance; +} + +- (nonnull instancetype)init { + return [self initWithImageManager:[SDWebImageManager new]]; +} + +- (nonnull instancetype)initWithImageManager:(SDWebImageManager *)manager { + if ((self = [super init])) { + _manager = manager; + _runningTokens = [NSMutableSet set]; + _options = SDWebImageLowPriority; + _delegateQueue = dispatch_get_main_queue(); + _prefetchQueue = [NSOperationQueue new]; + self.maxConcurrentPrefetchCount = 3; + } + return self; +} + +- (void)setMaxConcurrentPrefetchCount:(NSUInteger)maxConcurrentPrefetchCount { + self.prefetchQueue.maxConcurrentOperationCount = maxConcurrentPrefetchCount; +} + +- (NSUInteger)maxConcurrentPrefetchCount { + return self.prefetchQueue.maxConcurrentOperationCount; +} + +#pragma mark - Prefetch +- (nullable SDWebImagePrefetchToken *)prefetchURLs:(nullable NSArray *)urls { + return [self prefetchURLs:urls progress:nil completed:nil]; +} + +- (nullable SDWebImagePrefetchToken *)prefetchURLs:(nullable NSArray *)urls + progress:(nullable SDWebImagePrefetcherProgressBlock)progressBlock + completed:(nullable SDWebImagePrefetcherCompletionBlock)completionBlock { + if (!urls || urls.count == 0) { + if (completionBlock) { + completionBlock(0, 0); + } + return nil; + } + SDWebImagePrefetchToken *token = [SDWebImagePrefetchToken new]; + token.prefetcher = self; + token.urls = urls; + token->_skippedCount = 0; + token->_finishedCount = 0; + token->_totalCount = token.urls.count; + atomic_flag_clear(&(token->_isAllFinished)); + token.loadOperations = [NSPointerArray weakObjectsPointerArray]; + token.prefetchOperations = [NSPointerArray weakObjectsPointerArray]; + token.progressBlock = progressBlock; + token.completionBlock = completionBlock; + [self addRunningToken:token]; + [self startPrefetchWithToken:token]; + + return token; +} + +- (void)startPrefetchWithToken:(SDWebImagePrefetchToken * _Nonnull)token { + for (NSURL *url in token.urls) { + @autoreleasepool { + @weakify(self); + SDAsyncBlockOperation *prefetchOperation = [SDAsyncBlockOperation blockOperationWithBlock:^(SDAsyncBlockOperation * _Nonnull asyncOperation) { + @strongify(self); + if (!self || asyncOperation.isCancelled) { + return; + } + id operation = [self.manager loadImageWithURL:url options:self.options context:self.context progress:nil completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL) { + @strongify(self); + if (!self) { + return; + } + if (!finished) { + return; + } + atomic_fetch_add_explicit(&(token->_finishedCount), 1, memory_order_relaxed); + if (error) { + // Add last failed + atomic_fetch_add_explicit(&(token->_skippedCount), 1, memory_order_relaxed); + } + + // Current operation finished + [self callProgressBlockForToken:token imageURL:imageURL]; + + if (atomic_load_explicit(&(token->_finishedCount), memory_order_relaxed) == token->_totalCount) { + // All finished + if (!atomic_flag_test_and_set_explicit(&(token->_isAllFinished), memory_order_relaxed)) { + [self callCompletionBlockForToken:token]; + [self removeRunningToken:token]; + } + } + [asyncOperation complete]; + }]; + NSAssert(operation != nil, @"Operation should not be nil, [SDWebImageManager loadImageWithURL:options:context:progress:completed:] break prefetch logic"); + SD_LOCK(token->_loadOperationsLock); + [token.loadOperations addPointer:(__bridge void *)operation]; + SD_UNLOCK(token->_loadOperationsLock); + }]; + SD_LOCK(token->_prefetchOperationsLock); + [token.prefetchOperations addPointer:(__bridge void *)prefetchOperation]; + SD_UNLOCK(token->_prefetchOperationsLock); + [self.prefetchQueue addOperation:prefetchOperation]; + } + } +} + +#pragma mark - Cancel +- (void)cancelPrefetching { + @synchronized(self.runningTokens) { + NSSet *copiedTokens = [self.runningTokens copy]; + [copiedTokens makeObjectsPerformSelector:@selector(cancel)]; + [self.runningTokens removeAllObjects]; + } +} + +- (void)callProgressBlockForToken:(SDWebImagePrefetchToken *)token imageURL:(NSURL *)url { + if (!token) { + return; + } + BOOL shouldCallDelegate = [self.delegate respondsToSelector:@selector(imagePrefetcher:didPrefetchURL:finishedCount:totalCount:)]; + NSUInteger tokenFinishedCount = [self tokenFinishedCount]; + NSUInteger tokenTotalCount = [self tokenTotalCount]; + NSUInteger finishedCount = atomic_load_explicit(&(token->_finishedCount), memory_order_relaxed); + NSUInteger totalCount = token->_totalCount; + dispatch_async(self.delegateQueue, ^{ + if (shouldCallDelegate) { + [self.delegate imagePrefetcher:self didPrefetchURL:url finishedCount:tokenFinishedCount totalCount:tokenTotalCount]; + } + if (token.progressBlock) { + token.progressBlock(finishedCount, totalCount); + } + }); +} + +- (void)callCompletionBlockForToken:(SDWebImagePrefetchToken *)token { + if (!token) { + return; + } + BOOL shoulCallDelegate = [self.delegate respondsToSelector:@selector(imagePrefetcher:didFinishWithTotalCount:skippedCount:)] && ([self countOfRunningTokens] == 1); // last one + NSUInteger tokenTotalCount = [self tokenTotalCount]; + NSUInteger tokenSkippedCount = [self tokenSkippedCount]; + NSUInteger finishedCount = atomic_load_explicit(&(token->_finishedCount), memory_order_relaxed); + NSUInteger skippedCount = atomic_load_explicit(&(token->_skippedCount), memory_order_relaxed); + dispatch_async(self.delegateQueue, ^{ + if (shoulCallDelegate) { + [self.delegate imagePrefetcher:self didFinishWithTotalCount:tokenTotalCount skippedCount:tokenSkippedCount]; + } + if (token.completionBlock) { + token.completionBlock(finishedCount, skippedCount); + } + }); +} + +#pragma mark - Helper +- (NSUInteger)tokenTotalCount { + NSUInteger tokenTotalCount = 0; + @synchronized (self.runningTokens) { + for (SDWebImagePrefetchToken *token in self.runningTokens) { + tokenTotalCount += token->_totalCount; + } + } + return tokenTotalCount; +} + +- (NSUInteger)tokenSkippedCount { + NSUInteger tokenSkippedCount = 0; + @synchronized (self.runningTokens) { + for (SDWebImagePrefetchToken *token in self.runningTokens) { + tokenSkippedCount += atomic_load_explicit(&(token->_skippedCount), memory_order_relaxed); + } + } + return tokenSkippedCount; +} + +- (NSUInteger)tokenFinishedCount { + NSUInteger tokenFinishedCount = 0; + @synchronized (self.runningTokens) { + for (SDWebImagePrefetchToken *token in self.runningTokens) { + tokenFinishedCount += atomic_load_explicit(&(token->_finishedCount), memory_order_relaxed); + } + } + return tokenFinishedCount; +} + +- (void)addRunningToken:(SDWebImagePrefetchToken *)token { + if (!token) { + return; + } + @synchronized (self.runningTokens) { + [self.runningTokens addObject:token]; + } +} + +- (void)removeRunningToken:(SDWebImagePrefetchToken *)token { + if (!token) { + return; + } + @synchronized (self.runningTokens) { + [self.runningTokens removeObject:token]; + } +} + +- (NSUInteger)countOfRunningTokens { + NSUInteger count = 0; + @synchronized (self.runningTokens) { + count = self.runningTokens.count; + } + return count; +} + +@end + +@implementation SDWebImagePrefetchToken + +- (instancetype)init { + self = [super init]; + if (self) { + SD_LOCK_INIT(_prefetchOperationsLock); + SD_LOCK_INIT(_loadOperationsLock); + } + return self; +} + +- (void)cancel { + SD_LOCK(_prefetchOperationsLock); + [self.prefetchOperations compact]; + for (id operation in self.prefetchOperations) { + id strongOperation = operation; + if (strongOperation) { + [strongOperation cancel]; + } + } + self.prefetchOperations.count = 0; + SD_UNLOCK(_prefetchOperationsLock); + + SD_LOCK(_loadOperationsLock); + [self.loadOperations compact]; + for (id operation in self.loadOperations) { + id strongOperation = operation; + if (strongOperation) { + [strongOperation cancel]; + } + } + self.loadOperations.count = 0; + SD_UNLOCK(_loadOperationsLock); + + self.completionBlock = nil; + self.progressBlock = nil; + [self.prefetcher removeRunningToken:self]; +} + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageTransition.h b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageTransition.h new file mode 100644 index 0000000..889372e --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageTransition.h @@ -0,0 +1,131 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageCompat.h" + +#if SD_UIKIT || SD_MAC +#import "SDImageCache.h" + +#if SD_UIKIT +typedef UIViewAnimationOptions SDWebImageAnimationOptions; +#else +typedef NS_OPTIONS(NSUInteger, SDWebImageAnimationOptions) { + SDWebImageAnimationOptionAllowsImplicitAnimation = 1 << 0, // specify `allowsImplicitAnimation` for the `NSAnimationContext` + + SDWebImageAnimationOptionCurveEaseInOut = 0 << 16, // default + SDWebImageAnimationOptionCurveEaseIn = 1 << 16, + SDWebImageAnimationOptionCurveEaseOut = 2 << 16, + SDWebImageAnimationOptionCurveLinear = 3 << 16, + + SDWebImageAnimationOptionTransitionNone = 0 << 20, // default + SDWebImageAnimationOptionTransitionFlipFromLeft = 1 << 20, + SDWebImageAnimationOptionTransitionFlipFromRight = 2 << 20, + SDWebImageAnimationOptionTransitionCurlUp = 3 << 20, + SDWebImageAnimationOptionTransitionCurlDown = 4 << 20, + SDWebImageAnimationOptionTransitionCrossDissolve = 5 << 20, + SDWebImageAnimationOptionTransitionFlipFromTop = 6 << 20, + SDWebImageAnimationOptionTransitionFlipFromBottom = 7 << 20, +}; +#endif + +typedef void (^SDWebImageTransitionPreparesBlock)(__kindof UIView * _Nonnull view, UIImage * _Nullable image, NSData * _Nullable imageData, SDImageCacheType cacheType, NSURL * _Nullable imageURL); +typedef void (^SDWebImageTransitionAnimationsBlock)(__kindof UIView * _Nonnull view, UIImage * _Nullable image); +typedef void (^SDWebImageTransitionCompletionBlock)(BOOL finished); + +/** + This class is used to provide a transition animation after the view category load image finished. Use this on `sd_imageTransition` in UIView+WebCache.h + for UIKit(iOS & tvOS), we use `+[UIView transitionWithView:duration:options:animations:completion]` for transition animation. + for AppKit(macOS), we use `+[NSAnimationContext runAnimationGroup:completionHandler:]` for transition animation. You can call `+[NSAnimationContext currentContext]` to grab the context during animations block. + @note These transition are provided for basic usage. If you need complicated animation, consider to directly use Core Animation or use `SDWebImageAvoidAutoSetImage` and implement your own after image load finished. + */ +@interface SDWebImageTransition : NSObject + +/** + By default, we set the image to the view at the beginning of the animations. You can disable this and provide custom set image process + */ +@property (nonatomic, assign) BOOL avoidAutoSetImage; +/** + The duration of the transition animation, measured in seconds. Defaults to 0.5. + */ +@property (nonatomic, assign) NSTimeInterval duration; +/** + The timing function used for all animations within this transition animation (macOS). + */ +@property (nonatomic, strong, nullable) CAMediaTimingFunction *timingFunction API_UNAVAILABLE(ios, tvos, watchos) API_DEPRECATED("Use SDWebImageAnimationOptions instead, or grab NSAnimationContext.currentContext and modify the timingFunction", macos(10.10, 10.10)); +/** + A mask of options indicating how you want to perform the animations. + */ +@property (nonatomic, assign) SDWebImageAnimationOptions animationOptions; +/** + A block object to be executed before the animation sequence starts. + */ +@property (nonatomic, copy, nullable) SDWebImageTransitionPreparesBlock prepares; +/** + A block object that contains the changes you want to make to the specified view. + */ +@property (nonatomic, copy, nullable) SDWebImageTransitionAnimationsBlock animations; +/** + A block object to be executed when the animation sequence ends. + */ +@property (nonatomic, copy, nullable) SDWebImageTransitionCompletionBlock completion; + +@end + +/** + Convenience way to create transition. Remember to specify the duration if needed. + for UIKit, these transition just use the correspond `animationOptions`. By default we enable `UIViewAnimationOptionAllowUserInteraction` to allow user interaction during transition. + for AppKit, these transition use Core Animation in `animations`. So your view must be layer-backed. Set `wantsLayer = YES` before you apply it. + */ +@interface SDWebImageTransition (Conveniences) + +/// Fade-in transition. +@property (nonatomic, class, nonnull, readonly) SDWebImageTransition *fadeTransition; +/// Flip from left transition. +@property (nonatomic, class, nonnull, readonly) SDWebImageTransition *flipFromLeftTransition; +/// Flip from right transition. +@property (nonatomic, class, nonnull, readonly) SDWebImageTransition *flipFromRightTransition; +/// Flip from top transition. +@property (nonatomic, class, nonnull, readonly) SDWebImageTransition *flipFromTopTransition; +/// Flip from bottom transition. +@property (nonatomic, class, nonnull, readonly) SDWebImageTransition *flipFromBottomTransition; +/// Curl up transition. +@property (nonatomic, class, nonnull, readonly) SDWebImageTransition *curlUpTransition; +/// Curl down transition. +@property (nonatomic, class, nonnull, readonly) SDWebImageTransition *curlDownTransition; + +/// Fade-in transition with duration. +/// @param duration transition duration, use ease-in-out ++ (nonnull instancetype)fadeTransitionWithDuration:(NSTimeInterval)duration NS_SWIFT_NAME(fade(duration:)); + +/// Flip from left transition with duration. +/// @param duration transition duration, use ease-in-out ++ (nonnull instancetype)flipFromLeftTransitionWithDuration:(NSTimeInterval)duration NS_SWIFT_NAME(flipFromLeft(duration:)); + +/// Flip from right transition with duration. +/// @param duration transition duration, use ease-in-out ++ (nonnull instancetype)flipFromRightTransitionWithDuration:(NSTimeInterval)duration NS_SWIFT_NAME(flipFromRight(duration:)); + +/// Flip from top transition with duration. +/// @param duration transition duration, use ease-in-out ++ (nonnull instancetype)flipFromTopTransitionWithDuration:(NSTimeInterval)duration NS_SWIFT_NAME(flipFromTop(duration:)); + +/// Flip from bottom transition with duration. +/// @param duration transition duration, use ease-in-out ++ (nonnull instancetype)flipFromBottomTransitionWithDuration:(NSTimeInterval)duration NS_SWIFT_NAME(flipFromBottom(duration:)); + +/// Curl up transition with duration. +/// @param duration transition duration, use ease-in-out ++ (nonnull instancetype)curlUpTransitionWithDuration:(NSTimeInterval)duration NS_SWIFT_NAME(curlUp(duration:)); + +/// Curl down transition with duration. +/// @param duration transition duration, use ease-in-out ++ (nonnull instancetype)curlDownTransitionWithDuration:(NSTimeInterval)duration NS_SWIFT_NAME(curlDown(duration:)); + +@end + +#endif diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageTransition.m b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageTransition.m new file mode 100644 index 0000000..4990a73 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/SDWebImageTransition.m @@ -0,0 +1,194 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageTransition.h" + +#if SD_UIKIT || SD_MAC + +#if SD_MAC +#import "SDWebImageTransitionInternal.h" +#import "SDInternalMacros.h" + +CAMediaTimingFunction * SDTimingFunctionFromAnimationOptions(SDWebImageAnimationOptions options) { + if (SD_OPTIONS_CONTAINS(SDWebImageAnimationOptionCurveLinear, options)) { + return [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear]; + } else if (SD_OPTIONS_CONTAINS(SDWebImageAnimationOptionCurveEaseIn, options)) { + return [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn]; + } else if (SD_OPTIONS_CONTAINS(SDWebImageAnimationOptionCurveEaseOut, options)) { + return [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut]; + } else if (SD_OPTIONS_CONTAINS(SDWebImageAnimationOptionCurveEaseInOut, options)) { + return [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; + } else { + return [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionDefault]; + } +} + +CATransition * SDTransitionFromAnimationOptions(SDWebImageAnimationOptions options) { + if (SD_OPTIONS_CONTAINS(options, SDWebImageAnimationOptionTransitionCrossDissolve)) { + CATransition *trans = [CATransition animation]; + trans.type = kCATransitionFade; + return trans; + } else if (SD_OPTIONS_CONTAINS(options, SDWebImageAnimationOptionTransitionFlipFromLeft)) { + CATransition *trans = [CATransition animation]; + trans.type = kCATransitionPush; + trans.subtype = kCATransitionFromLeft; + return trans; + } else if (SD_OPTIONS_CONTAINS(options, SDWebImageAnimationOptionTransitionFlipFromRight)) { + CATransition *trans = [CATransition animation]; + trans.type = kCATransitionPush; + trans.subtype = kCATransitionFromRight; + return trans; + } else if (SD_OPTIONS_CONTAINS(options, SDWebImageAnimationOptionTransitionFlipFromTop)) { + CATransition *trans = [CATransition animation]; + trans.type = kCATransitionPush; + trans.subtype = kCATransitionFromTop; + return trans; + } else if (SD_OPTIONS_CONTAINS(options, SDWebImageAnimationOptionTransitionFlipFromBottom)) { + CATransition *trans = [CATransition animation]; + trans.type = kCATransitionPush; + trans.subtype = kCATransitionFromBottom; + return trans; + } else if (SD_OPTIONS_CONTAINS(options, SDWebImageAnimationOptionTransitionCurlUp)) { + CATransition *trans = [CATransition animation]; + trans.type = kCATransitionReveal; + trans.subtype = kCATransitionFromTop; + return trans; + } else if (SD_OPTIONS_CONTAINS(options, SDWebImageAnimationOptionTransitionCurlDown)) { + CATransition *trans = [CATransition animation]; + trans.type = kCATransitionReveal; + trans.subtype = kCATransitionFromBottom; + return trans; + } else { + return nil; + } +} +#endif + +@implementation SDWebImageTransition + +- (instancetype)init { + self = [super init]; + if (self) { + self.duration = 0.5; + } + return self; +} + +@end + +@implementation SDWebImageTransition (Conveniences) + ++ (SDWebImageTransition *)fadeTransition { + return [self fadeTransitionWithDuration:0.5]; +} + ++ (SDWebImageTransition *)fadeTransitionWithDuration:(NSTimeInterval)duration { + SDWebImageTransition *transition = [SDWebImageTransition new]; + transition.duration = duration; +#if SD_UIKIT + transition.animationOptions = UIViewAnimationOptionTransitionCrossDissolve | UIViewAnimationOptionAllowUserInteraction; +#else + transition.animationOptions = SDWebImageAnimationOptionTransitionCrossDissolve; +#endif + return transition; +} + ++ (SDWebImageTransition *)flipFromLeftTransition { + return [self flipFromLeftTransitionWithDuration:0.5]; +} + ++ (SDWebImageTransition *)flipFromLeftTransitionWithDuration:(NSTimeInterval)duration { + SDWebImageTransition *transition = [SDWebImageTransition new]; + transition.duration = duration; +#if SD_UIKIT + transition.animationOptions = UIViewAnimationOptionTransitionFlipFromLeft | UIViewAnimationOptionAllowUserInteraction; +#else + transition.animationOptions = SDWebImageAnimationOptionTransitionFlipFromLeft; +#endif + return transition; +} + ++ (SDWebImageTransition *)flipFromRightTransition { + return [self flipFromRightTransitionWithDuration:0.5]; +} + ++ (SDWebImageTransition *)flipFromRightTransitionWithDuration:(NSTimeInterval)duration { + SDWebImageTransition *transition = [SDWebImageTransition new]; + transition.duration = duration; +#if SD_UIKIT + transition.animationOptions = UIViewAnimationOptionTransitionFlipFromRight | UIViewAnimationOptionAllowUserInteraction; +#else + transition.animationOptions = SDWebImageAnimationOptionTransitionFlipFromRight; +#endif + return transition; +} + ++ (SDWebImageTransition *)flipFromTopTransition { + return [self flipFromTopTransitionWithDuration:0.5]; +} + ++ (SDWebImageTransition *)flipFromTopTransitionWithDuration:(NSTimeInterval)duration { + SDWebImageTransition *transition = [SDWebImageTransition new]; + transition.duration = duration; +#if SD_UIKIT + transition.animationOptions = UIViewAnimationOptionTransitionFlipFromTop | UIViewAnimationOptionAllowUserInteraction; +#else + transition.animationOptions = SDWebImageAnimationOptionTransitionFlipFromTop; +#endif + return transition; +} + ++ (SDWebImageTransition *)flipFromBottomTransition { + return [self flipFromBottomTransitionWithDuration:0.5]; +} + ++ (SDWebImageTransition *)flipFromBottomTransitionWithDuration:(NSTimeInterval)duration { + SDWebImageTransition *transition = [SDWebImageTransition new]; + transition.duration = duration; +#if SD_UIKIT + transition.animationOptions = UIViewAnimationOptionTransitionFlipFromBottom | UIViewAnimationOptionAllowUserInteraction; +#else + transition.animationOptions = SDWebImageAnimationOptionTransitionFlipFromBottom; +#endif + return transition; +} + ++ (SDWebImageTransition *)curlUpTransition { + return [self curlUpTransitionWithDuration:0.5]; +} + ++ (SDWebImageTransition *)curlUpTransitionWithDuration:(NSTimeInterval)duration { + SDWebImageTransition *transition = [SDWebImageTransition new]; + transition.duration = duration; +#if SD_UIKIT + transition.animationOptions = UIViewAnimationOptionTransitionCurlUp | UIViewAnimationOptionAllowUserInteraction; +#else + transition.animationOptions = SDWebImageAnimationOptionTransitionCurlUp; +#endif + return transition; +} + ++ (SDWebImageTransition *)curlDownTransition { + return [self curlDownTransitionWithDuration:0.5]; +} + ++ (SDWebImageTransition *)curlDownTransitionWithDuration:(NSTimeInterval)duration { + SDWebImageTransition *transition = [SDWebImageTransition new]; + transition.duration = duration; +#if SD_UIKIT + transition.animationOptions = UIViewAnimationOptionTransitionCurlDown | UIViewAnimationOptionAllowUserInteraction; +#else + transition.animationOptions = SDWebImageAnimationOptionTransitionCurlDown; +#endif + transition.duration = duration; + return transition; +} + +@end + +#endif diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/UIButton+WebCache.h b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/UIButton+WebCache.h new file mode 100644 index 0000000..89d94b4 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/UIButton+WebCache.h @@ -0,0 +1,387 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageCompat.h" + +#if SD_UIKIT + +#import "SDWebImageManager.h" + +/** + * Integrates SDWebImage async downloading and caching of remote images with UIButton. + */ +@interface UIButton (WebCache) + +#pragma mark - Image + +/** + * Get the current image URL. + */ +@property (nonatomic, strong, readonly, nullable) NSURL *sd_currentImageURL; + +/** + * Get the image URL for a control state. + * + * @param state Which state you want to know the URL for. The values are described in UIControlState. + */ +- (nullable NSURL *)sd_imageURLForState:(UIControlState)state; + +/** + * Set the button `image` with an `url`. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param state The state that uses the specified title. The values are described in UIControlState. + */ +- (void)sd_setImageWithURL:(nullable NSURL *)url + forState:(UIControlState)state NS_REFINED_FOR_SWIFT; + +/** + * Set the button `image` with an `url` and a placeholder. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param state The state that uses the specified title. The values are described in UIControlState. + * @param placeholder The image to be set initially, until the image request finishes. + * @see sd_setImageWithURL:placeholderImage:options: + */ +- (void)sd_setImageWithURL:(nullable NSURL *)url + forState:(UIControlState)state + placeholderImage:(nullable UIImage *)placeholder NS_REFINED_FOR_SWIFT; + +/** + * Set the button `image` with an `url`, placeholder and custom options. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param state The state that uses the specified title. The values are described in UIControlState. + * @param placeholder The image to be set initially, until the image request finishes. + * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. + */ +- (void)sd_setImageWithURL:(nullable NSURL *)url + forState:(UIControlState)state + placeholderImage:(nullable UIImage *)placeholder + options:(SDWebImageOptions)options NS_REFINED_FOR_SWIFT; + +/** + * Set the button `image` with an `url`, placeholder, custom options and context. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param state The state that uses the specified title. The values are described in UIControlState. + * @param placeholder The image to be set initially, until the image request finishes. + * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. + * @param context A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold. + */ +- (void)sd_setImageWithURL:(nullable NSURL *)url + forState:(UIControlState)state + placeholderImage:(nullable UIImage *)placeholder + options:(SDWebImageOptions)options + context:(nullable SDWebImageContext *)context; + +/** + * Set the button `image` with an `url`. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param state The state that uses the specified title. The values are described in UIControlState. + * @param completedBlock A block called when operation has been completed. This block has no return value + * and takes the requested UIImage as first parameter. In case of error the image parameter + * is nil and the second parameter may contain an NSError. The third parameter is a Boolean + * indicating if the image was retrieved from the local cache or from the network. + * The fourth parameter is the original image url. + */ +- (void)sd_setImageWithURL:(nullable NSURL *)url + forState:(UIControlState)state + completed:(nullable SDExternalCompletionBlock)completedBlock; + +/** + * Set the button `image` with an `url`, placeholder. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param state The state that uses the specified title. The values are described in UIControlState. + * @param placeholder The image to be set initially, until the image request finishes. + * @param completedBlock A block called when operation has been completed. This block has no return value + * and takes the requested UIImage as first parameter. In case of error the image parameter + * is nil and the second parameter may contain an NSError. The third parameter is a Boolean + * indicating if the image was retrieved from the local cache or from the network. + * The fourth parameter is the original image url. + */ +- (void)sd_setImageWithURL:(nullable NSURL *)url + forState:(UIControlState)state + placeholderImage:(nullable UIImage *)placeholder + completed:(nullable SDExternalCompletionBlock)completedBlock NS_REFINED_FOR_SWIFT; + +/** + * Set the button `image` with an `url`, placeholder and custom options. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param state The state that uses the specified title. The values are described in UIControlState. + * @param placeholder The image to be set initially, until the image request finishes. + * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. + * @param completedBlock A block called when operation has been completed. This block has no return value + * and takes the requested UIImage as first parameter. In case of error the image parameter + * is nil and the second parameter may contain an NSError. The third parameter is a Boolean + * indicating if the image was retrieved from the local cache or from the network. + * The fourth parameter is the original image url. + */ +- (void)sd_setImageWithURL:(nullable NSURL *)url + forState:(UIControlState)state + placeholderImage:(nullable UIImage *)placeholder + options:(SDWebImageOptions)options + completed:(nullable SDExternalCompletionBlock)completedBlock; + +/** + * Set the button `image` with an `url`, placeholder and custom options. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param state The state that uses the specified title. The values are described in UIControlState. + * @param placeholder The image to be set initially, until the image request finishes. + * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. + * @param progressBlock A block called while image is downloading + * @note the progress block is executed on a background queue + * @param completedBlock A block called when operation has been completed. This block has no return value + * and takes the requested UIImage as first parameter. In case of error the image parameter + * is nil and the second parameter may contain an NSError. The third parameter is a Boolean + * indicating if the image was retrieved from the local cache or from the network. + * The fourth parameter is the original image url. + */ +- (void)sd_setImageWithURL:(nullable NSURL *)url + forState:(UIControlState)state + placeholderImage:(nullable UIImage *)placeholder + options:(SDWebImageOptions)options + progress:(nullable SDImageLoaderProgressBlock)progressBlock + completed:(nullable SDExternalCompletionBlock)completedBlock; + +/** + * Set the button `image` with an `url`, placeholder, custom options and context. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param state The state that uses the specified title. The values are described in UIControlState. + * @param placeholder The image to be set initially, until the image request finishes. + * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. + * @param context A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold. + * @param progressBlock A block called while image is downloading + * @note the progress block is executed on a background queue + * @param completedBlock A block called when operation has been completed. This block has no return value + * and takes the requested UIImage as first parameter. In case of error the image parameter + * is nil and the second parameter may contain an NSError. The third parameter is a Boolean + * indicating if the image was retrieved from the local cache or from the network. + * The fourth parameter is the original image url. + */ +- (void)sd_setImageWithURL:(nullable NSURL *)url + forState:(UIControlState)state + placeholderImage:(nullable UIImage *)placeholder + options:(SDWebImageOptions)options + context:(nullable SDWebImageContext *)context + progress:(nullable SDImageLoaderProgressBlock)progressBlock + completed:(nullable SDExternalCompletionBlock)completedBlock; + +#pragma mark - Background Image + +/** + * Get the current background image URL. + */ +@property (nonatomic, strong, readonly, nullable) NSURL *sd_currentBackgroundImageURL; + +/** + * Get the background image URL for a control state. + * + * @param state Which state you want to know the URL for. The values are described in UIControlState. + */ +- (nullable NSURL *)sd_backgroundImageURLForState:(UIControlState)state; + +/** + * Set the button `backgroundImage` with an `url`. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param state The state that uses the specified title. The values are described in UIControlState. + */ +- (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url + forState:(UIControlState)state NS_REFINED_FOR_SWIFT; + +/** + * Set the button `backgroundImage` with an `url` and a placeholder. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param state The state that uses the specified title. The values are described in UIControlState. + * @param placeholder The image to be set initially, until the image request finishes. + * @see sd_setImageWithURL:placeholderImage:options: + */ +- (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url + forState:(UIControlState)state + placeholderImage:(nullable UIImage *)placeholder NS_REFINED_FOR_SWIFT; + +/** + * Set the button `backgroundImage` with an `url`, placeholder and custom options. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param state The state that uses the specified title. The values are described in UIControlState. + * @param placeholder The image to be set initially, until the image request finishes. + * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. + */ +- (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url + forState:(UIControlState)state + placeholderImage:(nullable UIImage *)placeholder + options:(SDWebImageOptions)options NS_REFINED_FOR_SWIFT; + +/** + * Set the button `backgroundImage` with an `url`, placeholder, custom options and context. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param state The state that uses the specified title. The values are described in UIControlState. + * @param placeholder The image to be set initially, until the image request finishes. + * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. + * @param context A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold. + */ +- (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url + forState:(UIControlState)state + placeholderImage:(nullable UIImage *)placeholder + options:(SDWebImageOptions)options + context:(nullable SDWebImageContext *)context; + +/** + * Set the button `backgroundImage` with an `url`. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param state The state that uses the specified title. The values are described in UIControlState. + * @param completedBlock A block called when operation has been completed. This block has no return value + * and takes the requested UIImage as first parameter. In case of error the image parameter + * is nil and the second parameter may contain an NSError. The third parameter is a Boolean + * indicating if the image was retrieved from the local cache or from the network. + * The fourth parameter is the original image url. + */ +- (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url + forState:(UIControlState)state + completed:(nullable SDExternalCompletionBlock)completedBlock; + +/** + * Set the button `backgroundImage` with an `url`, placeholder. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param state The state that uses the specified title. The values are described in UIControlState. + * @param placeholder The image to be set initially, until the image request finishes. + * @param completedBlock A block called when operation has been completed. This block has no return value + * and takes the requested UIImage as first parameter. In case of error the image parameter + * is nil and the second parameter may contain an NSError. The third parameter is a Boolean + * indicating if the image was retrieved from the local cache or from the network. + * The fourth parameter is the original image url. + */ +- (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url + forState:(UIControlState)state + placeholderImage:(nullable UIImage *)placeholder + completed:(nullable SDExternalCompletionBlock)completedBlock NS_REFINED_FOR_SWIFT; + +/** + * Set the button `backgroundImage` with an `url`, placeholder and custom options. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param placeholder The image to be set initially, until the image request finishes. + * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. + * @param completedBlock A block called when operation has been completed. This block has no return value + * and takes the requested UIImage as first parameter. In case of error the image parameter + * is nil and the second parameter may contain an NSError. The third parameter is a Boolean + * indicating if the image was retrieved from the local cache or from the network. + * The fourth parameter is the original image url. + */ +- (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url + forState:(UIControlState)state + placeholderImage:(nullable UIImage *)placeholder + options:(SDWebImageOptions)options + completed:(nullable SDExternalCompletionBlock)completedBlock; + +/** + * Set the button `backgroundImage` with an `url`, placeholder and custom options. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param placeholder The image to be set initially, until the image request finishes. + * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. + * @param progressBlock A block called while image is downloading + * @note the progress block is executed on a background queue + * @param completedBlock A block called when operation has been completed. This block has no return value + * and takes the requested UIImage as first parameter. In case of error the image parameter + * is nil and the second parameter may contain an NSError. The third parameter is a Boolean + * indicating if the image was retrieved from the local cache or from the network. + * The fourth parameter is the original image url. + */ +- (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url + forState:(UIControlState)state + placeholderImage:(nullable UIImage *)placeholder + options:(SDWebImageOptions)options + progress:(nullable SDImageLoaderProgressBlock)progressBlock + completed:(nullable SDExternalCompletionBlock)completedBlock; + +/** + * Set the button `backgroundImage` with an `url`, placeholder, custom options and context. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param placeholder The image to be set initially, until the image request finishes. + * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. + * @param context A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold. + * @param progressBlock A block called while image is downloading + * @note the progress block is executed on a background queue + * @param completedBlock A block called when operation has been completed. This block has no return value + * and takes the requested UIImage as first parameter. In case of error the image parameter + * is nil and the second parameter may contain an NSError. The third parameter is a Boolean + * indicating if the image was retrieved from the local cache or from the network. + * The fourth parameter is the original image url. + */ +- (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url + forState:(UIControlState)state + placeholderImage:(nullable UIImage *)placeholder + options:(SDWebImageOptions)options + context:(nullable SDWebImageContext *)context + progress:(nullable SDImageLoaderProgressBlock)progressBlock + completed:(nullable SDExternalCompletionBlock)completedBlock; + +#pragma mark - Cancel + +/** + * Cancel the current image download + */ +- (void)sd_cancelImageLoadForState:(UIControlState)state; + +/** + * Cancel the current backgroundImage download + */ +- (void)sd_cancelBackgroundImageLoadForState:(UIControlState)state; + +@end + +#endif diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/UIButton+WebCache.m b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/UIButton+WebCache.m new file mode 100644 index 0000000..4ccd029 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/UIButton+WebCache.m @@ -0,0 +1,234 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "UIButton+WebCache.h" + +#if SD_UIKIT + +#import "objc/runtime.h" +#import "UIView+WebCacheOperation.h" +#import "UIView+WebCache.h" +#import "SDInternalMacros.h" + +static char imageURLStorageKey; + +typedef NSMutableDictionary SDStateImageURLDictionary; + +static inline NSString * imageURLKeyForState(UIControlState state) { + return [NSString stringWithFormat:@"image_%lu", (unsigned long)state]; +} + +static inline NSString * backgroundImageURLKeyForState(UIControlState state) { + return [NSString stringWithFormat:@"backgroundImage_%lu", (unsigned long)state]; +} + +static inline NSString * imageOperationKeyForState(UIControlState state) { + return [NSString stringWithFormat:@"UIButtonImageOperation%lu", (unsigned long)state]; +} + +static inline NSString * backgroundImageOperationKeyForState(UIControlState state) { + return [NSString stringWithFormat:@"UIButtonBackgroundImageOperation%lu", (unsigned long)state]; +} + +@implementation UIButton (WebCache) + +#pragma mark - Image + +- (nullable NSURL *)sd_currentImageURL { + NSURL *url = self.sd_imageURLStorage[imageURLKeyForState(self.state)]; + + if (!url) { + url = self.sd_imageURLStorage[imageURLKeyForState(UIControlStateNormal)]; + } + + return url; +} + +- (nullable NSURL *)sd_imageURLForState:(UIControlState)state { + return self.sd_imageURLStorage[imageURLKeyForState(state)]; +} + +- (void)sd_setImageWithURL:(nullable NSURL *)url forState:(UIControlState)state { + [self sd_setImageWithURL:url forState:state placeholderImage:nil options:0 completed:nil]; +} + +- (void)sd_setImageWithURL:(nullable NSURL *)url forState:(UIControlState)state placeholderImage:(nullable UIImage *)placeholder { + [self sd_setImageWithURL:url forState:state placeholderImage:placeholder options:0 completed:nil]; +} + +- (void)sd_setImageWithURL:(nullable NSURL *)url forState:(UIControlState)state placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options { + [self sd_setImageWithURL:url forState:state placeholderImage:placeholder options:options progress:nil completed:nil]; +} + +- (void)sd_setImageWithURL:(nullable NSURL *)url forState:(UIControlState)state placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options context:(nullable SDWebImageContext *)context { + [self sd_setImageWithURL:url forState:state placeholderImage:placeholder options:options context:context progress:nil completed:nil]; +} + +- (void)sd_setImageWithURL:(nullable NSURL *)url forState:(UIControlState)state completed:(nullable SDExternalCompletionBlock)completedBlock { + [self sd_setImageWithURL:url forState:state placeholderImage:nil options:0 completed:completedBlock]; +} + +- (void)sd_setImageWithURL:(nullable NSURL *)url forState:(UIControlState)state placeholderImage:(nullable UIImage *)placeholder completed:(nullable SDExternalCompletionBlock)completedBlock { + [self sd_setImageWithURL:url forState:state placeholderImage:placeholder options:0 completed:completedBlock]; +} + +- (void)sd_setImageWithURL:(nullable NSURL *)url forState:(UIControlState)state placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options completed:(nullable SDExternalCompletionBlock)completedBlock { + [self sd_setImageWithURL:url forState:state placeholderImage:placeholder options:options progress:nil completed:completedBlock]; +} + +- (void)sd_setImageWithURL:(nullable NSURL *)url forState:(UIControlState)state placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options progress:(nullable SDImageLoaderProgressBlock)progressBlock completed:(nullable SDExternalCompletionBlock)completedBlock { + [self sd_setImageWithURL:url forState:state placeholderImage:placeholder options:options context:nil progress:progressBlock completed:completedBlock]; +} + +- (void)sd_setImageWithURL:(nullable NSURL *)url + forState:(UIControlState)state + placeholderImage:(nullable UIImage *)placeholder + options:(SDWebImageOptions)options + context:(nullable SDWebImageContext *)context + progress:(nullable SDImageLoaderProgressBlock)progressBlock + completed:(nullable SDExternalCompletionBlock)completedBlock { + if (!url) { + [self.sd_imageURLStorage removeObjectForKey:imageURLKeyForState(state)]; + } else { + self.sd_imageURLStorage[imageURLKeyForState(state)] = url; + } + + SDWebImageMutableContext *mutableContext; + if (context) { + mutableContext = [context mutableCopy]; + } else { + mutableContext = [NSMutableDictionary dictionary]; + } + mutableContext[SDWebImageContextSetImageOperationKey] = imageOperationKeyForState(state); + @weakify(self); + [self sd_internalSetImageWithURL:url + placeholderImage:placeholder + options:options + context:mutableContext + setImageBlock:^(UIImage * _Nullable image, NSData * _Nullable imageData, SDImageCacheType cacheType, NSURL * _Nullable imageURL) { + @strongify(self); + [self setImage:image forState:state]; + } + progress:progressBlock + completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL) { + if (completedBlock) { + completedBlock(image, error, cacheType, imageURL); + } + }]; +} + +#pragma mark - Background Image + +- (nullable NSURL *)sd_currentBackgroundImageURL { + NSURL *url = self.sd_imageURLStorage[backgroundImageURLKeyForState(self.state)]; + + if (!url) { + url = self.sd_imageURLStorage[backgroundImageURLKeyForState(UIControlStateNormal)]; + } + + return url; +} + +- (nullable NSURL *)sd_backgroundImageURLForState:(UIControlState)state { + return self.sd_imageURLStorage[backgroundImageURLKeyForState(state)]; +} + +- (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url forState:(UIControlState)state { + [self sd_setBackgroundImageWithURL:url forState:state placeholderImage:nil options:0 completed:nil]; +} + +- (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url forState:(UIControlState)state placeholderImage:(nullable UIImage *)placeholder { + [self sd_setBackgroundImageWithURL:url forState:state placeholderImage:placeholder options:0 completed:nil]; +} + +- (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url forState:(UIControlState)state placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options { + [self sd_setBackgroundImageWithURL:url forState:state placeholderImage:placeholder options:options progress:nil completed:nil]; +} + +- (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url forState:(UIControlState)state placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options context:(nullable SDWebImageContext *)context { + [self sd_setBackgroundImageWithURL:url forState:state placeholderImage:placeholder options:options context:context progress:nil completed:nil]; +} + +- (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url forState:(UIControlState)state completed:(nullable SDExternalCompletionBlock)completedBlock { + [self sd_setBackgroundImageWithURL:url forState:state placeholderImage:nil options:0 completed:completedBlock]; +} + +- (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url forState:(UIControlState)state placeholderImage:(nullable UIImage *)placeholder completed:(nullable SDExternalCompletionBlock)completedBlock { + [self sd_setBackgroundImageWithURL:url forState:state placeholderImage:placeholder options:0 completed:completedBlock]; +} + +- (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url forState:(UIControlState)state placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options completed:(nullable SDExternalCompletionBlock)completedBlock { + [self sd_setBackgroundImageWithURL:url forState:state placeholderImage:placeholder options:options progress:nil completed:completedBlock]; +} + +- (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url forState:(UIControlState)state placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options progress:(nullable SDImageLoaderProgressBlock)progressBlock completed:(nullable SDExternalCompletionBlock)completedBlock { + [self sd_setBackgroundImageWithURL:url forState:state placeholderImage:placeholder options:options context:nil progress:progressBlock completed:completedBlock]; +} + +- (void)sd_setBackgroundImageWithURL:(nullable NSURL *)url + forState:(UIControlState)state + placeholderImage:(nullable UIImage *)placeholder + options:(SDWebImageOptions)options + context:(nullable SDWebImageContext *)context + progress:(nullable SDImageLoaderProgressBlock)progressBlock + completed:(nullable SDExternalCompletionBlock)completedBlock { + if (!url) { + [self.sd_imageURLStorage removeObjectForKey:backgroundImageURLKeyForState(state)]; + } else { + self.sd_imageURLStorage[backgroundImageURLKeyForState(state)] = url; + } + + SDWebImageMutableContext *mutableContext; + if (context) { + mutableContext = [context mutableCopy]; + } else { + mutableContext = [NSMutableDictionary dictionary]; + } + mutableContext[SDWebImageContextSetImageOperationKey] = backgroundImageOperationKeyForState(state); + @weakify(self); + [self sd_internalSetImageWithURL:url + placeholderImage:placeholder + options:options + context:mutableContext + setImageBlock:^(UIImage * _Nullable image, NSData * _Nullable imageData, SDImageCacheType cacheType, NSURL * _Nullable imageURL) { + @strongify(self); + [self setBackgroundImage:image forState:state]; + } + progress:progressBlock + completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL) { + if (completedBlock) { + completedBlock(image, error, cacheType, imageURL); + } + }]; +} + +#pragma mark - Cancel + +- (void)sd_cancelImageLoadForState:(UIControlState)state { + [self sd_cancelImageLoadOperationWithKey:imageOperationKeyForState(state)]; +} + +- (void)sd_cancelBackgroundImageLoadForState:(UIControlState)state { + [self sd_cancelImageLoadOperationWithKey:backgroundImageOperationKeyForState(state)]; +} + +#pragma mark - Private + +- (SDStateImageURLDictionary *)sd_imageURLStorage { + SDStateImageURLDictionary *storage = objc_getAssociatedObject(self, &imageURLStorageKey); + if (!storage) { + storage = [NSMutableDictionary dictionary]; + objc_setAssociatedObject(self, &imageURLStorageKey, storage, OBJC_ASSOCIATION_RETAIN_NONATOMIC); + } + + return storage; +} + +@end + +#endif diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/UIImage+ExtendedCacheData.h b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/UIImage+ExtendedCacheData.h new file mode 100644 index 0000000..482c8c4 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/UIImage+ExtendedCacheData.h @@ -0,0 +1,24 @@ +/* +* This file is part of the SDWebImage package. +* (c) Olivier Poitrey +* (c) Fabrice Aneche +* +* For the full copyright and license information, please view the LICENSE +* file that was distributed with this source code. +*/ + +#import +#import "SDWebImageCompat.h" + +@interface UIImage (ExtendedCacheData) + +/** + Read and Write the extended object and bind it to the image. Which can hold some extra metadata like Image's scale factor, URL rich link, date, etc. + The extended object should conforms to NSCoding, which we use `NSKeyedArchiver` and `NSKeyedUnarchiver` to archive it to data, and write to disk cache. + @note The disk cache preserve both of the data and extended data with the same cache key. For manual query, use the `SDDiskCache` protocol method `extendedDataForKey:` instead. + @note You can specify arbitrary object conforms to NSCoding (NSObject protocol here is used to support object using `NS_ROOT_CLASS`, which is not NSObject subclass). If you load image from disk cache, you should check the extended object class to avoid corrupted data. + @warning This object don't need to implements NSSecureCoding (but it's recommended), because we allows arbitrary class. + */ +@property (nonatomic, strong, nullable) id sd_extendedObject; + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/UIImage+ExtendedCacheData.m b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/UIImage+ExtendedCacheData.m new file mode 100644 index 0000000..05d29cf --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/UIImage+ExtendedCacheData.m @@ -0,0 +1,23 @@ +/* +* This file is part of the SDWebImage package. +* (c) Olivier Poitrey +* (c) Fabrice Aneche +* +* For the full copyright and license information, please view the LICENSE +* file that was distributed with this source code. +*/ + +#import "UIImage+ExtendedCacheData.h" +#import + +@implementation UIImage (ExtendedCacheData) + +- (id)sd_extendedObject { + return objc_getAssociatedObject(self, @selector(sd_extendedObject)); +} + +- (void)setSd_extendedObject:(id)sd_extendedObject { + objc_setAssociatedObject(self, @selector(sd_extendedObject), sd_extendedObject, OBJC_ASSOCIATION_RETAIN_NONATOMIC); +} + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/UIImage+ForceDecode.h b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/UIImage+ForceDecode.h new file mode 100644 index 0000000..f368746 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/UIImage+ForceDecode.h @@ -0,0 +1,46 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageCompat.h" + +/** + UIImage category about force decode feature (avoid Image/IO's lazy decoding during rendering behavior). + */ +@interface UIImage (ForceDecode) + +/** + A bool value indicating whether the image has already been decoded. This can help to avoid extra force decode. + */ +@property (nonatomic, assign) BOOL sd_isDecoded; + +/** + Decode the provided image. This is useful if you want to force decode the image before rendering to improve performance. + + @param image The image to be decoded + @return The decoded image + */ ++ (nullable UIImage *)sd_decodedImageWithImage:(nullable UIImage *)image; + +/** + Decode and scale down the provided image + + @param image The image to be decoded + @return The decoded and scaled down image + */ ++ (nullable UIImage *)sd_decodedAndScaledDownImageWithImage:(nullable UIImage *)image; + +/** + Decode and scale down the provided image with limit bytes + + @param image The image to be decoded + @param bytes The limit bytes size. Provide 0 to use the build-in limit. + @return The decoded and scaled down image + */ ++ (nullable UIImage *)sd_decodedAndScaledDownImageWithImage:(nullable UIImage *)image limitBytes:(NSUInteger)bytes; + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/UIImage+ForceDecode.m b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/UIImage+ForceDecode.m new file mode 100644 index 0000000..9fc7258 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/UIImage+ForceDecode.m @@ -0,0 +1,60 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "UIImage+ForceDecode.h" +#import "SDImageCoderHelper.h" +#import "objc/runtime.h" +#import "NSImage+Compatibility.h" + +@implementation UIImage (ForceDecode) + +- (BOOL)sd_isDecoded { + NSNumber *value = objc_getAssociatedObject(self, @selector(sd_isDecoded)); + if (value != nil) { + return value.boolValue; + } else { + // Assume only CGImage based can use lazy decoding + CGImageRef cgImage = self.CGImage; + if (cgImage) { + CFStringRef uttype = CGImageGetUTType(self.CGImage); + if (uttype) { + // Only ImageIO can set `com.apple.ImageIO.imageSourceTypeIdentifier` + return NO; + } else { + // Thumbnail or CGBitmapContext drawn image + return YES; + } + } + } + // Assume others as non-decoded + return NO; +} + +- (void)setSd_isDecoded:(BOOL)sd_isDecoded { + objc_setAssociatedObject(self, @selector(sd_isDecoded), @(sd_isDecoded), OBJC_ASSOCIATION_RETAIN_NONATOMIC); +} + ++ (nullable UIImage *)sd_decodedImageWithImage:(nullable UIImage *)image { + if (!image) { + return nil; + } + return [SDImageCoderHelper decodedImageWithImage:image]; +} + ++ (nullable UIImage *)sd_decodedAndScaledDownImageWithImage:(nullable UIImage *)image { + return [self sd_decodedAndScaledDownImageWithImage:image limitBytes:0]; +} + ++ (nullable UIImage *)sd_decodedAndScaledDownImageWithImage:(nullable UIImage *)image limitBytes:(NSUInteger)bytes { + if (!image) { + return nil; + } + return [SDImageCoderHelper decodedAndScaledDownImageWithImage:image limitBytes:bytes]; +} + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/UIImage+GIF.h b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/UIImage+GIF.h new file mode 100644 index 0000000..5da8e19 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/UIImage+GIF.h @@ -0,0 +1,26 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * (c) Laurin Brandner + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageCompat.h" + +/** + This category is just use as a convenience method. For more detail control, use methods in `UIImage+MultiFormat.h` or directly use `SDImageCoder`. + */ +@interface UIImage (GIF) + +/** + Creates an animated UIImage from an NSData. + This will create animated image if the data is Animated GIF. And will create a static image is the data is Static GIF. + + @param data The GIF data + @return The created image + */ ++ (nullable UIImage *)sd_imageWithGIFData:(nullable NSData *)data; + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/UIImage+GIF.m b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/UIImage+GIF.m new file mode 100644 index 0000000..7158cf3 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/UIImage+GIF.m @@ -0,0 +1,22 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * (c) Laurin Brandner + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "UIImage+GIF.h" +#import "SDImageGIFCoder.h" + +@implementation UIImage (GIF) + ++ (nullable UIImage *)sd_imageWithGIFData:(nullable NSData *)data { + if (!data) { + return nil; + } + return [[SDImageGIFCoder sharedCoder] decodedImageWithData:data options:0]; +} + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/UIImage+MemoryCacheCost.h b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/UIImage+MemoryCacheCost.h new file mode 100644 index 0000000..0ff2f2f --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/UIImage+MemoryCacheCost.h @@ -0,0 +1,27 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageCompat.h" + +/** + UIImage category for memory cache cost. + */ +@interface UIImage (MemoryCacheCost) + +/** + The memory cache cost for specify image used by image cache. The cost function is the bytes size held in memory. + If you set some associated object to `UIImage`, you can set the custom value to indicate the memory cost. + + For `UIImage`, this method return the single frame bytes size when `image.images` is nil for static image. Return full frame bytes size when `image.images` is not nil for animated image. + For `NSImage`, this method return the single frame bytes size because `NSImage` does not store all frames in memory. + @note Note that because of the limitations of category this property can get out of sync if you create another instance with CGImage or other methods. + @note For custom animated class conforms to `SDAnimatedImage`, you can override this getter method in your subclass to return a more proper value instead, which representing the current frame's total bytes. + */ +@property (assign, nonatomic) NSUInteger sd_memoryCost; + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/UIImage+MemoryCacheCost.m b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/UIImage+MemoryCacheCost.m new file mode 100644 index 0000000..b936500 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/UIImage+MemoryCacheCost.m @@ -0,0 +1,47 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "UIImage+MemoryCacheCost.h" +#import "objc/runtime.h" +#import "NSImage+Compatibility.h" + +FOUNDATION_STATIC_INLINE NSUInteger SDMemoryCacheCostForImage(UIImage *image) { + CGImageRef imageRef = image.CGImage; + if (!imageRef) { + return 0; + } + NSUInteger bytesPerFrame = CGImageGetBytesPerRow(imageRef) * CGImageGetHeight(imageRef); + NSUInteger frameCount; +#if SD_MAC + frameCount = 1; +#elif SD_UIKIT || SD_WATCH + // Filter the same frame in `_UIAnimatedImage`. + frameCount = image.images.count > 1 ? [NSSet setWithArray:image.images].count : 1; +#endif + NSUInteger cost = bytesPerFrame * frameCount; + return cost; +} + +@implementation UIImage (MemoryCacheCost) + +- (NSUInteger)sd_memoryCost { + NSNumber *value = objc_getAssociatedObject(self, @selector(sd_memoryCost)); + NSUInteger memoryCost; + if (value != nil) { + memoryCost = [value unsignedIntegerValue]; + } else { + memoryCost = SDMemoryCacheCostForImage(self); + } + return memoryCost; +} + +- (void)setSd_memoryCost:(NSUInteger)sd_memoryCost { + objc_setAssociatedObject(self, @selector(sd_memoryCost), @(sd_memoryCost), OBJC_ASSOCIATION_RETAIN_NONATOMIC); +} + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/UIImage+Metadata.h b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/UIImage+Metadata.h new file mode 100644 index 0000000..90481eb --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/UIImage+Metadata.h @@ -0,0 +1,77 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageCompat.h" +#import "NSData+ImageContentType.h" +#import "SDImageCoder.h" + +/** + UIImage category for image metadata, including animation, loop count, format, incremental, etc. + */ +@interface UIImage (Metadata) + +/** + * UIKit: + * For static image format, this value is always 0. + * For animated image format, 0 means infinite looping. + * Note that because of the limitations of categories this property can get out of sync if you create another instance with CGImage or other methods. + * AppKit: + * NSImage currently only support animated via `NSBitmapImageRep`(GIF) or `SDAnimatedImageRep`(APNG/GIF/WebP) unlike UIImage. + * The getter of this property will get the loop count from animated imageRep + * The setter of this property will set the loop count from animated imageRep + */ +@property (nonatomic, assign) NSUInteger sd_imageLoopCount; + +/** + * UIKit: + * Returns the `images`'s count by unapply the patch for the different frame durations. Which matches the real visible frame count when displaying on UIImageView. + * See more in `SDImageCoderHelper.animatedImageWithFrames`. + * Returns 1 for static image. + * AppKit: + * Returns the underlaying `NSBitmapImageRep` or `SDAnimatedImageRep` frame count. + * Returns 1 for static image. + */ +@property (nonatomic, assign, readonly) NSUInteger sd_imageFrameCount; + +/** + * UIKit: + * Check the `images` array property. + * AppKit: + * NSImage currently only support animated via GIF imageRep unlike UIImage. It will check the imageRep's frame count. + */ +@property (nonatomic, assign, readonly) BOOL sd_isAnimated; + +/** + * UIKit: + * Check the `isSymbolImage` property. Also check the system PDF(iOS 11+) && SVG(iOS 13+) support. + * AppKit: + * NSImage supports PDF && SVG && EPS imageRep, check the imageRep class. + */ +@property (nonatomic, assign, readonly) BOOL sd_isVector; + +/** + * The image format represent the original compressed image data format. + * If you don't manually specify a format, this information is retrieve from CGImage using `CGImageGetUTType`, which may return nil for non-CG based image. At this time it will return `SDImageFormatUndefined` as default value. + * @note Note that because of the limitations of categories this property can get out of sync if you create another instance with CGImage or other methods. + */ +@property (nonatomic, assign) SDImageFormat sd_imageFormat; + +/** + A bool value indicating whether the image is during incremental decoding and may not contains full pixels. + */ +@property (nonatomic, assign) BOOL sd_isIncremental; + +/** + A dictionary value contains the decode options when decoded from SDWebImage loading system (say, `SDImageCacheDecodeImageData/SDImageLoaderDecode[Progressive]ImageData`) + It may not always available and only image decoding related options will be saved. (including [.decodeScaleFactor, .decodeThumbnailPixelSize, .decodePreserveAspectRatio, .decodeFirstFrameOnly]) + @note This is used to identify and check the image from downloader when multiple different request (which want different image thumbnail size, image class, etc) share the same URLOperation. + @warning This API exist only because of current SDWebImageDownloader bad design which does not callback the context we call it. There will be refactory in future (API break) and you SHOULD NOT rely on this property at all. + */ +@property (nonatomic, copy) SDImageCoderOptions *sd_decodeOptions; + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/UIImage+Metadata.m b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/UIImage+Metadata.m new file mode 100644 index 0000000..a526f9b --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/UIImage+Metadata.m @@ -0,0 +1,199 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "UIImage+Metadata.h" +#import "NSImage+Compatibility.h" +#import "SDInternalMacros.h" +#import "objc/runtime.h" + +@implementation UIImage (Metadata) + +#if SD_UIKIT || SD_WATCH + +- (NSUInteger)sd_imageLoopCount { + NSUInteger imageLoopCount = 0; + NSNumber *value = objc_getAssociatedObject(self, @selector(sd_imageLoopCount)); + if ([value isKindOfClass:[NSNumber class]]) { + imageLoopCount = value.unsignedIntegerValue; + } + return imageLoopCount; +} + +- (void)setSd_imageLoopCount:(NSUInteger)sd_imageLoopCount { + NSNumber *value = @(sd_imageLoopCount); + objc_setAssociatedObject(self, @selector(sd_imageLoopCount), value, OBJC_ASSOCIATION_RETAIN_NONATOMIC); +} + +- (NSUInteger)sd_imageFrameCount { + NSArray *animatedImages = self.images; + if (!animatedImages || animatedImages.count <= 1) { + return 1; + } + NSNumber *value = objc_getAssociatedObject(self, @selector(sd_imageFrameCount)); + if ([value isKindOfClass:[NSNumber class]]) { + return [value unsignedIntegerValue]; + } + __block NSUInteger frameCount = 1; + __block UIImage *previousImage = animatedImages.firstObject; + [animatedImages enumerateObjectsUsingBlock:^(UIImage * _Nonnull image, NSUInteger idx, BOOL * _Nonnull stop) { + // ignore first + if (idx == 0) { + return; + } + if (![image isEqual:previousImage]) { + frameCount++; + } + previousImage = image; + }]; + objc_setAssociatedObject(self, @selector(sd_imageFrameCount), @(frameCount), OBJC_ASSOCIATION_RETAIN_NONATOMIC); + + return frameCount; +} + +- (BOOL)sd_isAnimated { + return (self.images != nil); +} + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Warc-performSelector-leaks" +- (BOOL)sd_isVector { + if (@available(iOS 13.0, tvOS 13.0, watchOS 6.0, *)) { + // Xcode 11 supports symbol image, keep Xcode 10 compatible currently + SEL SymbolSelector = NSSelectorFromString(@"isSymbolImage"); + if ([self respondsToSelector:SymbolSelector] && [self performSelector:SymbolSelector]) { + return YES; + } + // SVG + SEL SVGSelector = SD_SEL_SPI(CGSVGDocument); + if ([self respondsToSelector:SVGSelector] && [self performSelector:SVGSelector]) { + return YES; + } + } + if (@available(iOS 11.0, tvOS 11.0, watchOS 4.0, *)) { + // PDF + SEL PDFSelector = SD_SEL_SPI(CGPDFPage); + if ([self respondsToSelector:PDFSelector] && [self performSelector:PDFSelector]) { + return YES; + } + } + return NO; +} +#pragma clang diagnostic pop + +#else + +- (NSUInteger)sd_imageLoopCount { + NSUInteger imageLoopCount = 0; + NSRect imageRect = NSMakeRect(0, 0, self.size.width, self.size.height); + NSImageRep *imageRep = [self bestRepresentationForRect:imageRect context:nil hints:nil]; + NSBitmapImageRep *bitmapImageRep; + if ([imageRep isKindOfClass:[NSBitmapImageRep class]]) { + bitmapImageRep = (NSBitmapImageRep *)imageRep; + } + if (bitmapImageRep) { + imageLoopCount = [[bitmapImageRep valueForProperty:NSImageLoopCount] unsignedIntegerValue]; + } + return imageLoopCount; +} + +- (void)setSd_imageLoopCount:(NSUInteger)sd_imageLoopCount { + NSRect imageRect = NSMakeRect(0, 0, self.size.width, self.size.height); + NSImageRep *imageRep = [self bestRepresentationForRect:imageRect context:nil hints:nil]; + NSBitmapImageRep *bitmapImageRep; + if ([imageRep isKindOfClass:[NSBitmapImageRep class]]) { + bitmapImageRep = (NSBitmapImageRep *)imageRep; + } + if (bitmapImageRep) { + [bitmapImageRep setProperty:NSImageLoopCount withValue:@(sd_imageLoopCount)]; + } +} + +- (NSUInteger)sd_imageFrameCount { + NSRect imageRect = NSMakeRect(0, 0, self.size.width, self.size.height); + NSImageRep *imageRep = [self bestRepresentationForRect:imageRect context:nil hints:nil]; + NSBitmapImageRep *bitmapImageRep; + if ([imageRep isKindOfClass:[NSBitmapImageRep class]]) { + bitmapImageRep = (NSBitmapImageRep *)imageRep; + } + if (bitmapImageRep) { + return [[bitmapImageRep valueForProperty:NSImageFrameCount] unsignedIntegerValue]; + } + return 1; +} + +- (BOOL)sd_isAnimated { + BOOL isAnimated = NO; + NSRect imageRect = NSMakeRect(0, 0, self.size.width, self.size.height); + NSImageRep *imageRep = [self bestRepresentationForRect:imageRect context:nil hints:nil]; + NSBitmapImageRep *bitmapImageRep; + if ([imageRep isKindOfClass:[NSBitmapImageRep class]]) { + bitmapImageRep = (NSBitmapImageRep *)imageRep; + } + if (bitmapImageRep) { + NSUInteger frameCount = [[bitmapImageRep valueForProperty:NSImageFrameCount] unsignedIntegerValue]; + isAnimated = frameCount > 1 ? YES : NO; + } + return isAnimated; +} + +- (BOOL)sd_isVector { + NSRect imageRect = NSMakeRect(0, 0, self.size.width, self.size.height); + NSImageRep *imageRep = [self bestRepresentationForRect:imageRect context:nil hints:nil]; + if ([imageRep isKindOfClass:[NSPDFImageRep class]]) { + return YES; + } + if ([imageRep isKindOfClass:[NSEPSImageRep class]]) { + return YES; + } + if ([NSStringFromClass(imageRep.class) hasSuffix:@"NSSVGImageRep"]) { + return YES; + } + return NO; +} + +#endif + +- (SDImageFormat)sd_imageFormat { + SDImageFormat imageFormat = SDImageFormatUndefined; + NSNumber *value = objc_getAssociatedObject(self, @selector(sd_imageFormat)); + if ([value isKindOfClass:[NSNumber class]]) { + imageFormat = value.integerValue; + return imageFormat; + } + // Check CGImage's UTType, may return nil for non-Image/IO based image + CFStringRef uttype = CGImageGetUTType(self.CGImage); + imageFormat = [NSData sd_imageFormatFromUTType:uttype]; + return imageFormat; +} + +- (void)setSd_imageFormat:(SDImageFormat)sd_imageFormat { + objc_setAssociatedObject(self, @selector(sd_imageFormat), @(sd_imageFormat), OBJC_ASSOCIATION_RETAIN_NONATOMIC); +} + +- (void)setSd_isIncremental:(BOOL)sd_isIncremental { + objc_setAssociatedObject(self, @selector(sd_isIncremental), @(sd_isIncremental), OBJC_ASSOCIATION_RETAIN_NONATOMIC); +} + +- (BOOL)sd_isIncremental { + NSNumber *value = objc_getAssociatedObject(self, @selector(sd_isIncremental)); + return value.boolValue; +} + +- (void)setSd_decodeOptions:(SDImageCoderOptions *)sd_decodeOptions { + objc_setAssociatedObject(self, @selector(sd_decodeOptions), sd_decodeOptions, OBJC_ASSOCIATION_COPY_NONATOMIC); +} + +- (SDImageCoderOptions *)sd_decodeOptions { + SDImageCoderOptions *value = objc_getAssociatedObject(self, @selector(sd_decodeOptions)); + if ([value isKindOfClass:NSDictionary.class]) { + return value; + } + return nil; +} + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/UIImage+MultiFormat.h b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/UIImage+MultiFormat.h new file mode 100644 index 0000000..a0935b5 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/UIImage+MultiFormat.h @@ -0,0 +1,80 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageCompat.h" +#import "NSData+ImageContentType.h" + +/** + UIImage category for convenient image format decoding/encoding. + */ +@interface UIImage (MultiFormat) +#pragma mark - Decode +/** + Create and decode a image with the specify image data + + @param data The image data + @return The created image + */ ++ (nullable UIImage *)sd_imageWithData:(nullable NSData *)data; + +/** + Create and decode a image with the specify image data and scale + + @param data The image data + @param scale The image scale factor. Should be greater than or equal to 1.0. + @return The created image + */ ++ (nullable UIImage *)sd_imageWithData:(nullable NSData *)data scale:(CGFloat)scale; + +/** + Create and decode a image with the specify image data and scale, allow specify animate/static control + + @param data The image data + @param scale The image scale factor. Should be greater than or equal to 1.0. + @param firstFrameOnly Even if the image data is animated image format, decode the first frame only as static image. + @return The created image + */ ++ (nullable UIImage *)sd_imageWithData:(nullable NSData *)data scale:(CGFloat)scale firstFrameOnly:(BOOL)firstFrameOnly; + +#pragma mark - Encode +/** + Encode the current image to the data, the image format is unspecified + + @note If the receiver is `SDAnimatedImage`, this will return the animated image data if available. No more extra encoding process. + @return The encoded data. If can't encode, return nil + */ +- (nullable NSData *)sd_imageData; + +/** + Encode the current image to data with the specify image format + + @param imageFormat The specify image format + @return The encoded data. If can't encode, return nil + */ +- (nullable NSData *)sd_imageDataAsFormat:(SDImageFormat)imageFormat NS_SWIFT_NAME(sd_imageData(as:)); + +/** + Encode the current image to data with the specify image format and compression quality + + @param imageFormat The specify image format + @param compressionQuality The quality of the resulting image data. Value between 0.0-1.0. Some coders may not support compression quality. + @return The encoded data. If can't encode, return nil + */ +- (nullable NSData *)sd_imageDataAsFormat:(SDImageFormat)imageFormat compressionQuality:(double)compressionQuality NS_SWIFT_NAME(sd_imageData(as:compressionQuality:)); + +/** + Encode the current image to data with the specify image format and compression quality, allow specify animate/static control + + @param imageFormat The specify image format + @param compressionQuality The quality of the resulting image data. Value between 0.0-1.0. Some coders may not support compression quality. + @param firstFrameOnly Even if the image is animated image, encode the first frame only as static image. + @return The encoded data. If can't encode, return nil + */ +- (nullable NSData *)sd_imageDataAsFormat:(SDImageFormat)imageFormat compressionQuality:(double)compressionQuality firstFrameOnly:(BOOL)firstFrameOnly NS_SWIFT_NAME(sd_imageData(as:compressionQuality:firstFrameOnly:)); + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/UIImage+MultiFormat.m b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/UIImage+MultiFormat.m new file mode 100644 index 0000000..04d08c5 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/UIImage+MultiFormat.m @@ -0,0 +1,47 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "UIImage+MultiFormat.h" +#import "SDImageCodersManager.h" + +@implementation UIImage (MultiFormat) + ++ (nullable UIImage *)sd_imageWithData:(nullable NSData *)data { + return [self sd_imageWithData:data scale:1]; +} + ++ (nullable UIImage *)sd_imageWithData:(nullable NSData *)data scale:(CGFloat)scale { + return [self sd_imageWithData:data scale:scale firstFrameOnly:NO]; +} + ++ (nullable UIImage *)sd_imageWithData:(nullable NSData *)data scale:(CGFloat)scale firstFrameOnly:(BOOL)firstFrameOnly { + if (!data) { + return nil; + } + SDImageCoderOptions *options = @{SDImageCoderDecodeScaleFactor : @(MAX(scale, 1)), SDImageCoderDecodeFirstFrameOnly : @(firstFrameOnly)}; + return [[SDImageCodersManager sharedManager] decodedImageWithData:data options:options]; +} + +- (nullable NSData *)sd_imageData { + return [self sd_imageDataAsFormat:SDImageFormatUndefined]; +} + +- (nullable NSData *)sd_imageDataAsFormat:(SDImageFormat)imageFormat { + return [self sd_imageDataAsFormat:imageFormat compressionQuality:1]; +} + +- (nullable NSData *)sd_imageDataAsFormat:(SDImageFormat)imageFormat compressionQuality:(double)compressionQuality { + return [self sd_imageDataAsFormat:imageFormat compressionQuality:compressionQuality firstFrameOnly:NO]; +} + +- (nullable NSData *)sd_imageDataAsFormat:(SDImageFormat)imageFormat compressionQuality:(double)compressionQuality firstFrameOnly:(BOOL)firstFrameOnly { + SDImageCoderOptions *options = @{SDImageCoderEncodeCompressionQuality : @(compressionQuality), SDImageCoderEncodeFirstFrameOnly : @(firstFrameOnly)}; + return [[SDImageCodersManager sharedManager] encodedDataWithImage:self format:imageFormat options:options]; +} + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/UIImage+Transform.h b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/UIImage+Transform.h new file mode 100644 index 0000000..06cb66d --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/UIImage+Transform.h @@ -0,0 +1,146 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageCompat.h" + +typedef NS_ENUM(NSUInteger, SDImageScaleMode) { + SDImageScaleModeFill = 0, + SDImageScaleModeAspectFit = 1, + SDImageScaleModeAspectFill = 2 +}; + +#if SD_UIKIT || SD_WATCH +typedef UIRectCorner SDRectCorner; +#else +typedef NS_OPTIONS(NSUInteger, SDRectCorner) { + SDRectCornerTopLeft = 1 << 0, + SDRectCornerTopRight = 1 << 1, + SDRectCornerBottomLeft = 1 << 2, + SDRectCornerBottomRight = 1 << 3, + SDRectCornerAllCorners = ~0UL +}; +#endif + +/** + Provide some common method for `UIImage`. + Image process is based on Core Graphics and vImage. + */ +@interface UIImage (Transform) + +#pragma mark - Image Geometry + +/** + Returns a new image which is resized from this image. + You can specify a larger or smaller size than the image size. The image content will be changed with the scale mode. + + @param size The new size to be resized, values should be positive. + @param scaleMode The scale mode for image content. + @return The new image with the given size. + */ +- (nullable UIImage *)sd_resizedImageWithSize:(CGSize)size scaleMode:(SDImageScaleMode)scaleMode; + +/** + Returns a new image which is cropped from this image. + + @param rect Image's inner rect. + @return The new image with the cropping rect. + */ +- (nullable UIImage *)sd_croppedImageWithRect:(CGRect)rect; + +/** + Rounds a new image with a given corner radius and corners. + + @param cornerRadius The radius of each corner oval. Values larger than half the + rectangle's width or height are clamped appropriately to + half the width or height. + @param corners A bitmask value that identifies the corners that you want + rounded. You can use this parameter to round only a subset + of the corners of the rectangle. + @param borderWidth The inset border line width. Values larger than half the rectangle's + width or height are clamped appropriately to half the width + or height. + @param borderColor The border stroke color. nil means clear color. + @return The new image with the round corner. + */ +- (nullable UIImage *)sd_roundedCornerImageWithRadius:(CGFloat)cornerRadius + corners:(SDRectCorner)corners + borderWidth:(CGFloat)borderWidth + borderColor:(nullable UIColor *)borderColor; + +/** + Returns a new rotated image (relative to the center). + + @param angle Rotated radians in counterclockwise.⟲ + @param fitSize YES: new image's size is extend to fit all content. + NO: image's size will not change, content may be clipped. + @return The new image with the rotation. + */ +- (nullable UIImage *)sd_rotatedImageWithAngle:(CGFloat)angle fitSize:(BOOL)fitSize; + +/** + Returns a new horizontally(vertically) flipped image. + + @param horizontal YES to flip the image horizontally. ⇋ + @param vertical YES to flip the image vertically. ⥯ + @return The new image with the flipping. + */ +- (nullable UIImage *)sd_flippedImageWithHorizontal:(BOOL)horizontal vertical:(BOOL)vertical; + +#pragma mark - Image Blending + +/** + Return a tinted image with the given color. This actually use alpha blending of current image and the tint color. + + @param tintColor The tint color. + @return The new image with the tint color. + */ +- (nullable UIImage *)sd_tintedImageWithColor:(nonnull UIColor *)tintColor; + +/** + Return the pixel color at specify position. The point is from the top-left to the bottom-right and 0-based. The returned the color is always be RGBA format. The image must be CG-based. + @note The point's x/y should not be smaller than 0, or greater than or equal to width/height. + @note The overhead of object creation means this method is best suited for infrequent color sampling. For heavy image processing, grab the raw bitmap data and process yourself. + + @param point The position of pixel + @return The color for specify pixel, or nil if any error occur + */ +- (nullable UIColor *)sd_colorAtPoint:(CGPoint)point; + +/** + Return the pixel color array with specify rectangle. The rect is from the top-left to the bottom-right and 0-based. The returned the color is always be RGBA format. The image must be CG-based. + @note The rect's width/height should not be smaller than or equal to 0. The minX/minY should not be smaller than 0. The maxX/maxY should not be greater than width/height. Attention this limit is different from `sd_colorAtPoint:` (point: (0, 0) like rect: (0, 0, 1, 1)) + @note The overhead of object creation means this method is best suited for infrequent color sampling. For heavy image processing, grab the raw bitmap data and process yourself. + + @param rect The rectangle of pixels + @return The color array for specify pixels, or nil if any error occur + */ +- (nullable NSArray *)sd_colorsWithRect:(CGRect)rect; + +#pragma mark - Image Effect + +/** + Return a new image applied a blur effect. + + @param blurRadius The radius of the blur in points, 0 means no blur effect. + + @return The new image with blur effect, or nil if an error occurs (e.g. no enough memory). + */ +- (nullable UIImage *)sd_blurredImageWithRadius:(CGFloat)blurRadius; + +#if SD_UIKIT || SD_MAC +/** + Return a new image applied a CIFilter. + + @param filter The CIFilter to be applied to the image. + @return The new image with the CIFilter, or nil if an error occurs (e.g. no + enough memory). + */ +- (nullable UIImage *)sd_filteredImageWithFilter:(nonnull CIFilter *)filter; +#endif + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/UIImage+Transform.m b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/UIImage+Transform.m new file mode 100644 index 0000000..2cd8a6f --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/UIImage+Transform.m @@ -0,0 +1,824 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "UIImage+Transform.h" +#import "NSImage+Compatibility.h" +#import "SDImageGraphics.h" +#import "SDGraphicsImageRenderer.h" +#import "NSBezierPath+SDRoundedCorners.h" +#import +#if SD_UIKIT || SD_MAC +#import +#endif + +static inline CGRect SDCGRectFitWithScaleMode(CGRect rect, CGSize size, SDImageScaleMode scaleMode) { + rect = CGRectStandardize(rect); + size.width = size.width < 0 ? -size.width : size.width; + size.height = size.height < 0 ? -size.height : size.height; + CGPoint center = CGPointMake(CGRectGetMidX(rect), CGRectGetMidY(rect)); + switch (scaleMode) { + case SDImageScaleModeAspectFit: + case SDImageScaleModeAspectFill: { + if (rect.size.width < 0.01 || rect.size.height < 0.01 || + size.width < 0.01 || size.height < 0.01) { + rect.origin = center; + rect.size = CGSizeZero; + } else { + CGFloat scale; + if (scaleMode == SDImageScaleModeAspectFit) { + if (size.width / size.height < rect.size.width / rect.size.height) { + scale = rect.size.height / size.height; + } else { + scale = rect.size.width / size.width; + } + } else { + if (size.width / size.height < rect.size.width / rect.size.height) { + scale = rect.size.width / size.width; + } else { + scale = rect.size.height / size.height; + } + } + size.width *= scale; + size.height *= scale; + rect.size = size; + rect.origin = CGPointMake(center.x - size.width * 0.5, center.y - size.height * 0.5); + } + } break; + case SDImageScaleModeFill: + default: { + rect = rect; + } + } + return rect; +} + +static inline UIColor * SDGetColorFromGrayscale(Pixel_88 pixel, CGBitmapInfo bitmapInfo) { + // Get alpha info, byteOrder info + CGImageAlphaInfo alphaInfo = bitmapInfo & kCGBitmapAlphaInfoMask; + CGBitmapInfo byteOrderInfo = bitmapInfo & kCGBitmapByteOrderMask; + CGFloat w = 0, a = 1; + + BOOL byteOrderNormal = NO; + switch (byteOrderInfo) { + case kCGBitmapByteOrderDefault: { + byteOrderNormal = YES; + } break; + case kCGBitmapByteOrder32Little: { + } break; + case kCGBitmapByteOrder32Big: { + byteOrderNormal = YES; + } break; + default: break; + } + switch (alphaInfo) { + case kCGImageAlphaPremultipliedFirst: + case kCGImageAlphaFirst: { + if (byteOrderNormal) { + // AW + a = pixel[0] / 255.0; + w = pixel[1] / 255.0; + } else { + // WA + w = pixel[0] / 255.0; + a = pixel[1] / 255.0; + } + } + break; + case kCGImageAlphaPremultipliedLast: + case kCGImageAlphaLast: { + if (byteOrderNormal) { + // WA + w = pixel[0] / 255.0; + a = pixel[1] / 255.0; + } else { + // AW + a = pixel[0] / 255.0; + w = pixel[1] / 255.0; + } + } + break; + case kCGImageAlphaNone: { + // W + w = pixel[0] / 255.0; + } + break; + case kCGImageAlphaNoneSkipLast: { + if (byteOrderNormal) { + // WX + w = pixel[0] / 255.0; + } else { + // XW + a = pixel[1] / 255.0; + } + } + break; + case kCGImageAlphaNoneSkipFirst: { + if (byteOrderNormal) { + // XW + a = pixel[1] / 255.0; + } else { + // WX + a = pixel[0] / 255.0; + } + } + break; + case kCGImageAlphaOnly: { + // A + a = pixel[0] / 255.0; + } + break; + default: + break; + } + + return [UIColor colorWithWhite:w alpha:a]; +} + +static inline UIColor * SDGetColorFromRGBA(Pixel_8888 pixel, CGBitmapInfo bitmapInfo) { + // Get alpha info, byteOrder info + CGImageAlphaInfo alphaInfo = bitmapInfo & kCGBitmapAlphaInfoMask; + CGBitmapInfo byteOrderInfo = bitmapInfo & kCGBitmapByteOrderMask; + CGFloat r = 0, g = 0, b = 0, a = 1; + + BOOL byteOrderNormal = NO; + switch (byteOrderInfo) { + case kCGBitmapByteOrderDefault: { + byteOrderNormal = YES; + } break; + case kCGBitmapByteOrder32Little: { + } break; + case kCGBitmapByteOrder32Big: { + byteOrderNormal = YES; + } break; + default: break; + } + switch (alphaInfo) { + case kCGImageAlphaPremultipliedFirst: + case kCGImageAlphaFirst: { + if (byteOrderNormal) { + // ARGB8888 + a = pixel[0] / 255.0; + r = pixel[1] / 255.0; + g = pixel[2] / 255.0; + b = pixel[3] / 255.0; + } else { + // BGRA8888 + b = pixel[0] / 255.0; + g = pixel[1] / 255.0; + r = pixel[2] / 255.0; + a = pixel[3] / 255.0; + } + } + break; + case kCGImageAlphaPremultipliedLast: + case kCGImageAlphaLast: { + if (byteOrderNormal) { + // RGBA8888 + r = pixel[0] / 255.0; + g = pixel[1] / 255.0; + b = pixel[2] / 255.0; + a = pixel[3] / 255.0; + } else { + // ABGR8888 + a = pixel[0] / 255.0; + b = pixel[1] / 255.0; + g = pixel[2] / 255.0; + r = pixel[3] / 255.0; + } + } + break; + case kCGImageAlphaNone: { + if (byteOrderNormal) { + // RGB + r = pixel[0] / 255.0; + g = pixel[1] / 255.0; + b = pixel[2] / 255.0; + } else { + // BGR + b = pixel[0] / 255.0; + g = pixel[1] / 255.0; + r = pixel[2] / 255.0; + } + } + break; + case kCGImageAlphaNoneSkipLast: { + if (byteOrderNormal) { + // RGBX + r = pixel[0] / 255.0; + g = pixel[1] / 255.0; + b = pixel[2] / 255.0; + } else { + // XBGR + b = pixel[1] / 255.0; + g = pixel[2] / 255.0; + r = pixel[3] / 255.0; + } + } + break; + case kCGImageAlphaNoneSkipFirst: { + if (byteOrderNormal) { + // XRGB + r = pixel[1] / 255.0; + g = pixel[2] / 255.0; + b = pixel[3] / 255.0; + } else { + // BGRX + b = pixel[0] / 255.0; + g = pixel[1] / 255.0; + r = pixel[2] / 255.0; + } + } + break; + case kCGImageAlphaOnly: { + // A + a = pixel[0] / 255.0; + } + break; + default: + break; + } + + return [UIColor colorWithRed:r green:g blue:b alpha:a]; +} + +#if SD_UIKIT || SD_MAC +// Create-Rule, caller should call CGImageRelease +static inline CGImageRef _Nullable SDCreateCGImageFromCIImage(CIImage * _Nonnull ciImage) { + CGImageRef imageRef = NULL; + if (@available(iOS 10, macOS 10.12, tvOS 10, *)) { + imageRef = ciImage.CGImage; + } + if (!imageRef) { + CIContext *context = [CIContext context]; + imageRef = [context createCGImage:ciImage fromRect:ciImage.extent]; + } else { + CGImageRetain(imageRef); + } + return imageRef; +} +#endif + +@implementation UIImage (Transform) + +- (void)sd_drawInRect:(CGRect)rect context:(CGContextRef)context scaleMode:(SDImageScaleMode)scaleMode clipsToBounds:(BOOL)clips { + CGRect drawRect = SDCGRectFitWithScaleMode(rect, self.size, scaleMode); + if (drawRect.size.width == 0 || drawRect.size.height == 0) return; + if (clips) { + if (context) { + CGContextSaveGState(context); + CGContextAddRect(context, rect); + CGContextClip(context); + [self drawInRect:drawRect]; + CGContextRestoreGState(context); + } + } else { + [self drawInRect:drawRect]; + } +} + +- (nullable UIImage *)sd_resizedImageWithSize:(CGSize)size scaleMode:(SDImageScaleMode)scaleMode { + if (size.width <= 0 || size.height <= 0) return nil; + SDGraphicsImageRendererFormat *format = [[SDGraphicsImageRendererFormat alloc] init]; + format.scale = self.scale; + SDGraphicsImageRenderer *renderer = [[SDGraphicsImageRenderer alloc] initWithSize:size format:format]; + UIImage *image = [renderer imageWithActions:^(CGContextRef _Nonnull context) { + [self sd_drawInRect:CGRectMake(0, 0, size.width, size.height) context:context scaleMode:scaleMode clipsToBounds:NO]; + }]; + return image; +} + +- (nullable UIImage *)sd_croppedImageWithRect:(CGRect)rect { + rect.origin.x *= self.scale; + rect.origin.y *= self.scale; + rect.size.width *= self.scale; + rect.size.height *= self.scale; + if (rect.size.width <= 0 || rect.size.height <= 0) return nil; + +#if SD_UIKIT || SD_MAC + // CIImage shortcut + if (self.CIImage) { + CGRect croppingRect = CGRectMake(rect.origin.x, self.size.height - CGRectGetMaxY(rect), rect.size.width, rect.size.height); + CIImage *ciImage = [self.CIImage imageByCroppingToRect:croppingRect]; +#if SD_UIKIT + UIImage *image = [UIImage imageWithCIImage:ciImage scale:self.scale orientation:self.imageOrientation]; +#else + UIImage *image = [[UIImage alloc] initWithCIImage:ciImage scale:self.scale orientation:kCGImagePropertyOrientationUp]; +#endif + return image; + } +#endif + + CGImageRef imageRef = self.CGImage; + if (!imageRef) { + return nil; + } + + CGImageRef croppedImageRef = CGImageCreateWithImageInRect(imageRef, rect); + if (!croppedImageRef) { + return nil; + } +#if SD_UIKIT || SD_WATCH + UIImage *image = [UIImage imageWithCGImage:croppedImageRef scale:self.scale orientation:self.imageOrientation]; +#else + UIImage *image = [[UIImage alloc] initWithCGImage:croppedImageRef scale:self.scale orientation:kCGImagePropertyOrientationUp]; +#endif + CGImageRelease(croppedImageRef); + return image; +} + +- (nullable UIImage *)sd_roundedCornerImageWithRadius:(CGFloat)cornerRadius corners:(SDRectCorner)corners borderWidth:(CGFloat)borderWidth borderColor:(nullable UIColor *)borderColor { + SDGraphicsImageRendererFormat *format = [[SDGraphicsImageRendererFormat alloc] init]; + format.scale = self.scale; + SDGraphicsImageRenderer *renderer = [[SDGraphicsImageRenderer alloc] initWithSize:self.size format:format]; + UIImage *image = [renderer imageWithActions:^(CGContextRef _Nonnull context) { + CGRect rect = CGRectMake(0, 0, self.size.width, self.size.height); + + CGFloat minSize = MIN(self.size.width, self.size.height); + if (borderWidth < minSize / 2) { +#if SD_UIKIT || SD_WATCH + UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:CGRectInset(rect, borderWidth, borderWidth) byRoundingCorners:corners cornerRadii:CGSizeMake(cornerRadius, cornerRadius)]; +#else + NSBezierPath *path = [NSBezierPath sd_bezierPathWithRoundedRect:CGRectInset(rect, borderWidth, borderWidth) byRoundingCorners:corners cornerRadius:cornerRadius]; +#endif + [path closePath]; + + CGContextSaveGState(context); + [path addClip]; + [self drawInRect:rect]; + CGContextRestoreGState(context); + } + + if (borderColor && borderWidth < minSize / 2 && borderWidth > 0) { + CGFloat strokeInset = (floor(borderWidth * self.scale) + 0.5) / self.scale; + CGRect strokeRect = CGRectInset(rect, strokeInset, strokeInset); + CGFloat strokeRadius = cornerRadius > self.scale / 2 ? cornerRadius - self.scale / 2 : 0; +#if SD_UIKIT || SD_WATCH + UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:strokeRect byRoundingCorners:corners cornerRadii:CGSizeMake(strokeRadius, strokeRadius)]; +#else + NSBezierPath *path = [NSBezierPath sd_bezierPathWithRoundedRect:strokeRect byRoundingCorners:corners cornerRadius:strokeRadius]; +#endif + [path closePath]; + + path.lineWidth = borderWidth; + [borderColor setStroke]; + [path stroke]; + } + }]; + return image; +} + +- (nullable UIImage *)sd_rotatedImageWithAngle:(CGFloat)angle fitSize:(BOOL)fitSize { + size_t width = self.size.width; + size_t height = self.size.height; + CGRect newRect = CGRectApplyAffineTransform(CGRectMake(0, 0, width, height), + fitSize ? CGAffineTransformMakeRotation(angle) : CGAffineTransformIdentity); + +#if SD_UIKIT || SD_MAC + // CIImage shortcut + if (self.CIImage) { + CIImage *ciImage = self.CIImage; + if (fitSize) { + CGAffineTransform transform = CGAffineTransformMakeRotation(angle); + ciImage = [ciImage imageByApplyingTransform:transform]; + } else { + CIFilter *filter = [CIFilter filterWithName:@"CIStraightenFilter"]; + [filter setValue:ciImage forKey:kCIInputImageKey]; + [filter setValue:@(angle) forKey:kCIInputAngleKey]; + ciImage = filter.outputImage; + } +#if SD_UIKIT || SD_WATCH + UIImage *image = [UIImage imageWithCIImage:ciImage scale:self.scale orientation:self.imageOrientation]; +#else + UIImage *image = [[UIImage alloc] initWithCIImage:ciImage scale:self.scale orientation:kCGImagePropertyOrientationUp]; +#endif + return image; + } +#endif + + SDGraphicsImageRendererFormat *format = [[SDGraphicsImageRendererFormat alloc] init]; + format.scale = self.scale; + SDGraphicsImageRenderer *renderer = [[SDGraphicsImageRenderer alloc] initWithSize:newRect.size format:format]; + UIImage *image = [renderer imageWithActions:^(CGContextRef _Nonnull context) { + CGContextSetShouldAntialias(context, true); + CGContextSetAllowsAntialiasing(context, true); + CGContextSetInterpolationQuality(context, kCGInterpolationHigh); + CGContextTranslateCTM(context, +(newRect.size.width * 0.5), +(newRect.size.height * 0.5)); +#if SD_UIKIT || SD_WATCH + // Use UIKit coordinate system counterclockwise (⟲) + CGContextRotateCTM(context, -angle); +#else + CGContextRotateCTM(context, angle); +#endif + + [self drawInRect:CGRectMake(-(width * 0.5), -(height * 0.5), width, height)]; + }]; + return image; +} + +- (nullable UIImage *)sd_flippedImageWithHorizontal:(BOOL)horizontal vertical:(BOOL)vertical { + size_t width = self.size.width; + size_t height = self.size.height; + +#if SD_UIKIT || SD_MAC + // CIImage shortcut + if (self.CIImage) { + CGAffineTransform transform = CGAffineTransformIdentity; + // Use UIKit coordinate system + if (horizontal) { + CGAffineTransform flipHorizontal = CGAffineTransformMake(-1, 0, 0, 1, width, 0); + transform = CGAffineTransformConcat(transform, flipHorizontal); + } + if (vertical) { + CGAffineTransform flipVertical = CGAffineTransformMake(1, 0, 0, -1, 0, height); + transform = CGAffineTransformConcat(transform, flipVertical); + } + CIImage *ciImage = [self.CIImage imageByApplyingTransform:transform]; +#if SD_UIKIT + UIImage *image = [UIImage imageWithCIImage:ciImage scale:self.scale orientation:self.imageOrientation]; +#else + UIImage *image = [[UIImage alloc] initWithCIImage:ciImage scale:self.scale orientation:kCGImagePropertyOrientationUp]; +#endif + return image; + } +#endif + + SDGraphicsImageRendererFormat *format = [[SDGraphicsImageRendererFormat alloc] init]; + format.scale = self.scale; + SDGraphicsImageRenderer *renderer = [[SDGraphicsImageRenderer alloc] initWithSize:self.size format:format]; + UIImage *image = [renderer imageWithActions:^(CGContextRef _Nonnull context) { + // Use UIKit coordinate system + if (horizontal) { + CGAffineTransform flipHorizontal = CGAffineTransformMake(-1, 0, 0, 1, width, 0); + CGContextConcatCTM(context, flipHorizontal); + } + if (vertical) { + CGAffineTransform flipVertical = CGAffineTransformMake(1, 0, 0, -1, 0, height); + CGContextConcatCTM(context, flipVertical); + } + [self drawInRect:CGRectMake(0, 0, width, height)]; + }]; + return image; +} + +#pragma mark - Image Blending + +- (nullable UIImage *)sd_tintedImageWithColor:(nonnull UIColor *)tintColor { + BOOL hasTint = CGColorGetAlpha(tintColor.CGColor) > __FLT_EPSILON__; + if (!hasTint) { + return self; + } + +#if SD_UIKIT || SD_MAC + // CIImage shortcut + if (self.CIImage) { + CIImage *ciImage = self.CIImage; + CIImage *colorImage = [CIImage imageWithColor:[[CIColor alloc] initWithColor:tintColor]]; + colorImage = [colorImage imageByCroppingToRect:ciImage.extent]; + CIFilter *filter = [CIFilter filterWithName:@"CISourceAtopCompositing"]; + [filter setValue:colorImage forKey:kCIInputImageKey]; + [filter setValue:ciImage forKey:kCIInputBackgroundImageKey]; + ciImage = filter.outputImage; +#if SD_UIKIT + UIImage *image = [UIImage imageWithCIImage:ciImage scale:self.scale orientation:self.imageOrientation]; +#else + UIImage *image = [[UIImage alloc] initWithCIImage:ciImage scale:self.scale orientation:kCGImagePropertyOrientationUp]; +#endif + return image; + } +#endif + + CGSize size = self.size; + CGRect rect = { CGPointZero, size }; + CGFloat scale = self.scale; + + // blend mode, see https://en.wikipedia.org/wiki/Alpha_compositing + CGBlendMode blendMode = kCGBlendModeSourceAtop; + + SDGraphicsImageRendererFormat *format = [[SDGraphicsImageRendererFormat alloc] init]; + format.scale = scale; + SDGraphicsImageRenderer *renderer = [[SDGraphicsImageRenderer alloc] initWithSize:size format:format]; + UIImage *image = [renderer imageWithActions:^(CGContextRef _Nonnull context) { + [self drawInRect:rect]; + CGContextSetBlendMode(context, blendMode); + CGContextSetFillColorWithColor(context, tintColor.CGColor); + CGContextFillRect(context, rect); + }]; + return image; +} + +- (nullable UIColor *)sd_colorAtPoint:(CGPoint)point { + CGImageRef imageRef = NULL; + // CIImage compatible +#if SD_UIKIT || SD_MAC + if (self.CIImage) { + imageRef = SDCreateCGImageFromCIImage(self.CIImage); + } +#endif + if (!imageRef) { + imageRef = self.CGImage; + CGImageRetain(imageRef); + } + if (!imageRef) { + return nil; + } + + // Check point + CGFloat width = CGImageGetWidth(imageRef); + CGFloat height = CGImageGetHeight(imageRef); + if (point.x < 0 || point.y < 0 || point.x >= width || point.y >= height) { + CGImageRelease(imageRef); + return nil; + } + + // Get pixels + CGDataProviderRef provider = CGImageGetDataProvider(imageRef); + if (!provider) { + CGImageRelease(imageRef); + return nil; + } + CFDataRef data = CGDataProviderCopyData(provider); + if (!data) { + CGImageRelease(imageRef); + return nil; + } + + // Get pixel at point + size_t bytesPerRow = CGImageGetBytesPerRow(imageRef); + size_t components = CGImageGetBitsPerPixel(imageRef) / CGImageGetBitsPerComponent(imageRef); + CGBitmapInfo bitmapInfo = CGImageGetBitmapInfo(imageRef); + + CFRange range = CFRangeMake(bytesPerRow * point.y + components * point.x, components); + if (CFDataGetLength(data) < range.location + range.length) { + CFRelease(data); + CGImageRelease(imageRef); + return nil; + } + // greyscale + if (components == 2) { + Pixel_88 pixel = {0}; + CFDataGetBytes(data, range, pixel); + CFRelease(data); + CGImageRelease(imageRef); + // Convert to color + return SDGetColorFromGrayscale(pixel, bitmapInfo); + } else if (components == 3 || components == 4) { + // RGB/RGBA + Pixel_8888 pixel = {0}; + CFDataGetBytes(data, range, pixel); + CFRelease(data); + CGImageRelease(imageRef); + // Convert to color + return SDGetColorFromRGBA(pixel, bitmapInfo); + } else { + NSLog(@"Unsupported components: %zu", components); + CFRelease(data); + CGImageRelease(imageRef); + return nil; + } +} + +- (nullable NSArray *)sd_colorsWithRect:(CGRect)rect { + CGImageRef imageRef = NULL; + // CIImage compatible +#if SD_UIKIT || SD_MAC + if (self.CIImage) { + imageRef = SDCreateCGImageFromCIImage(self.CIImage); + } +#endif + if (!imageRef) { + imageRef = self.CGImage; + CGImageRetain(imageRef); + } + if (!imageRef) { + return nil; + } + + // Check rect + CGFloat width = CGImageGetWidth(imageRef); + CGFloat height = CGImageGetHeight(imageRef); + if (CGRectGetWidth(rect) <= 0 || CGRectGetHeight(rect) <= 0 || CGRectGetMinX(rect) < 0 || CGRectGetMinY(rect) < 0 || CGRectGetMaxX(rect) > width || CGRectGetMaxY(rect) > height) { + CGImageRelease(imageRef); + return nil; + } + + // Get pixels + CGDataProviderRef provider = CGImageGetDataProvider(imageRef); + if (!provider) { + CGImageRelease(imageRef); + return nil; + } + CFDataRef data = CGDataProviderCopyData(provider); + if (!data) { + CGImageRelease(imageRef); + return nil; + } + + // Get pixels with rect + size_t bytesPerRow = CGImageGetBytesPerRow(imageRef); + size_t components = CGImageGetBitsPerPixel(imageRef) / CGImageGetBitsPerComponent(imageRef); + + size_t start = bytesPerRow * CGRectGetMinY(rect) + components * CGRectGetMinX(rect); + size_t end = bytesPerRow * (CGRectGetMaxY(rect) - 1) + components * CGRectGetMaxX(rect); + if (CFDataGetLength(data) < (CFIndex)end) { + CFRelease(data); + CGImageRelease(imageRef); + return nil; + } + + const UInt8 *pixels = CFDataGetBytePtr(data); + size_t row = CGRectGetMinY(rect); + size_t col = CGRectGetMaxX(rect); + + // Convert to color + CGBitmapInfo bitmapInfo = CGImageGetBitmapInfo(imageRef); + NSMutableArray *colors = [NSMutableArray arrayWithCapacity:CGRectGetWidth(rect) * CGRectGetHeight(rect)]; + for (size_t index = start; index < end; index += components) { + if (index >= row * bytesPerRow + col * components) { + // Index beyond the end of current row, go next row + row++; + index = row * bytesPerRow + CGRectGetMinX(rect) * components; + index -= components; + continue; + } + UIColor *color; + if (components == 2) { + Pixel_88 pixel = {pixels[index], pixel[index+1]}; + color = SDGetColorFromGrayscale(pixel, bitmapInfo); + } else { + if (components == 3) { + Pixel_8888 pixel = {pixels[index], pixels[index+1], pixels[index+2], 0}; + color = SDGetColorFromRGBA(pixel, bitmapInfo); + } else if (components == 4) { + Pixel_8888 pixel = {pixels[index], pixels[index+1], pixels[index+2], pixels[index+3]}; + color = SDGetColorFromRGBA(pixel, bitmapInfo); + } else { + NSLog(@"Unsupported components: %zu", components); + } + } + if (color) { + [colors addObject:color]; + } + } + CFRelease(data); + CGImageRelease(imageRef); + + return [colors copy]; +} + +#pragma mark - Image Effect + +// We use vImage to do box convolve for performance and support for watchOS. However, you can just use `CIFilter.CIGaussianBlur`. For other blur effect, use any filter in `CICategoryBlur` +- (nullable UIImage *)sd_blurredImageWithRadius:(CGFloat)blurRadius { + if (self.size.width < 1 || self.size.height < 1) { + return nil; + } + BOOL hasBlur = blurRadius > __FLT_EPSILON__; + if (!hasBlur) { + return self; + } + + CGFloat scale = self.scale; + CGFloat inputRadius = blurRadius * scale; +#if SD_UIKIT || SD_MAC + if (self.CIImage) { + CIFilter *filter = [CIFilter filterWithName:@"CIGaussianBlur"]; + [filter setValue:self.CIImage forKey:kCIInputImageKey]; + [filter setValue:@(inputRadius) forKey:kCIInputRadiusKey]; + CIImage *ciImage = filter.outputImage; + ciImage = [ciImage imageByCroppingToRect:CGRectMake(0, 0, self.size.width, self.size.height)]; +#if SD_UIKIT + UIImage *image = [UIImage imageWithCIImage:ciImage scale:self.scale orientation:self.imageOrientation]; +#else + UIImage *image = [[UIImage alloc] initWithCIImage:ciImage scale:self.scale orientation:kCGImagePropertyOrientationUp]; +#endif + return image; + } +#endif + + CGImageRef imageRef = self.CGImage; + + //convert to BGRA if it isn't + if (CGImageGetBitsPerPixel(imageRef) != 32 || + CGImageGetBitsPerComponent(imageRef) != 8 || + !((CGImageGetBitmapInfo(imageRef) & kCGBitmapAlphaInfoMask))) { + SDGraphicsBeginImageContextWithOptions(self.size, NO, self.scale); + [self drawInRect:CGRectMake(0, 0, self.size.width, self.size.height)]; + imageRef = SDGraphicsGetImageFromCurrentImageContext().CGImage; + SDGraphicsEndImageContext(); + } + + vImage_Buffer effect = {}, scratch = {}; + vImage_Buffer *input = NULL, *output = NULL; + + vImage_CGImageFormat format = { + .bitsPerComponent = 8, + .bitsPerPixel = 32, + .colorSpace = NULL, + .bitmapInfo = kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host, //requests a BGRA buffer. + .version = 0, + .decode = NULL, + .renderingIntent = CGImageGetRenderingIntent(imageRef) + }; + + vImage_Error err; + err = vImageBuffer_InitWithCGImage(&effect, &format, NULL, imageRef, kvImageNoFlags); + if (err != kvImageNoError) { + NSLog(@"UIImage+Transform error: vImageBuffer_InitWithCGImage returned error code %zi for inputImage: %@", err, self); + return nil; + } + err = vImageBuffer_Init(&scratch, effect.height, effect.width, format.bitsPerPixel, kvImageNoFlags); + if (err != kvImageNoError) { + NSLog(@"UIImage+Transform error: vImageBuffer_Init returned error code %zi for inputImage: %@", err, self); + return nil; + } + + input = &effect; + output = &scratch; + + if (hasBlur) { + // A description of how to compute the box kernel width from the Gaussian + // radius (aka standard deviation) appears in the SVG spec: + // http://www.w3.org/TR/SVG/filters.html#feGaussianBlurElement + // + // For larger values of 's' (s >= 2.0), an approximation can be used: Three + // successive box-blurs build a piece-wise quadratic convolution kernel, which + // approximates the Gaussian kernel to within roughly 3%. + // + // let d = floor(s * 3*sqrt(2*pi)/4 + 0.5) + // + // ... if d is odd, use three box-blurs of size 'd', centered on the output pixel. + // + if (inputRadius - 2.0 < __FLT_EPSILON__) inputRadius = 2.0; + uint32_t radius = floor(inputRadius * 3.0 * sqrt(2 * M_PI) / 4 + 0.5); + radius |= 1; // force radius to be odd so that the three box-blur methodology works. + int iterations; + if (blurRadius * scale < 0.5) iterations = 1; + else if (blurRadius * scale < 1.5) iterations = 2; + else iterations = 3; + NSInteger tempSize = vImageBoxConvolve_ARGB8888(input, output, NULL, 0, 0, radius, radius, NULL, kvImageGetTempBufferSize | kvImageEdgeExtend); + void *temp = malloc(tempSize); + for (int i = 0; i < iterations; i++) { + vImageBoxConvolve_ARGB8888(input, output, temp, 0, 0, radius, radius, NULL, kvImageEdgeExtend); + vImage_Buffer *tmp = input; + input = output; + output = tmp; + } + free(temp); + } + + CGImageRef effectCGImage = NULL; + effectCGImage = vImageCreateCGImageFromBuffer(input, &format, NULL, NULL, kvImageNoAllocate, NULL); + if (effectCGImage == NULL) { + effectCGImage = vImageCreateCGImageFromBuffer(input, &format, NULL, NULL, kvImageNoFlags, NULL); + free(input->data); + } + free(output->data); +#if SD_UIKIT || SD_WATCH + UIImage *outputImage = [UIImage imageWithCGImage:effectCGImage scale:self.scale orientation:self.imageOrientation]; +#else + UIImage *outputImage = [[UIImage alloc] initWithCGImage:effectCGImage scale:self.scale orientation:kCGImagePropertyOrientationUp]; +#endif + CGImageRelease(effectCGImage); + + return outputImage; +} + +#if SD_UIKIT || SD_MAC +- (nullable UIImage *)sd_filteredImageWithFilter:(nonnull CIFilter *)filter { + CIImage *inputImage; + if (self.CIImage) { + inputImage = self.CIImage; + } else { + CGImageRef imageRef = self.CGImage; + if (!imageRef) { + return nil; + } + inputImage = [CIImage imageWithCGImage:imageRef]; + } + if (!inputImage) return nil; + + CIContext *context = [CIContext context]; + [filter setValue:inputImage forKey:kCIInputImageKey]; + CIImage *outputImage = filter.outputImage; + if (!outputImage) return nil; + + CGImageRef imageRef = [context createCGImage:outputImage fromRect:outputImage.extent]; + if (!imageRef) return nil; + +#if SD_UIKIT + UIImage *image = [UIImage imageWithCGImage:imageRef scale:self.scale orientation:self.imageOrientation]; +#else + UIImage *image = [[UIImage alloc] initWithCGImage:imageRef scale:self.scale orientation:kCGImagePropertyOrientationUp]; +#endif + CGImageRelease(imageRef); + + return image; +} +#endif + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/UIImageView+HighlightedWebCache.h b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/UIImageView+HighlightedWebCache.h new file mode 100644 index 0000000..6cd3ba6 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/UIImageView+HighlightedWebCache.h @@ -0,0 +1,129 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageCompat.h" + +#if SD_UIKIT + +#import "SDWebImageManager.h" + +/** + * Integrates SDWebImage async downloading and caching of remote images with UIImageView for highlighted state. + */ +@interface UIImageView (HighlightedWebCache) + +/** + * Set the imageView `highlightedImage` with an `url`. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + */ +- (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url NS_REFINED_FOR_SWIFT; + +/** + * Set the imageView `highlightedImage` with an `url` and custom options. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. + */ +- (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url + options:(SDWebImageOptions)options NS_REFINED_FOR_SWIFT; + +/** + * Set the imageView `highlightedImage` with an `url`, custom options and context. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. + * @param context A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold. + */ +- (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url + options:(SDWebImageOptions)options + context:(nullable SDWebImageContext *)context; + +/** + * Set the imageView `highlightedImage` with an `url`. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param completedBlock A block called when operation has been completed. This block has no return value + * and takes the requested UIImage as first parameter. In case of error the image parameter + * is nil and the second parameter may contain an NSError. The third parameter is a Boolean + * indicating if the image was retrieved from the local cache or from the network. + * The fourth parameter is the original image url. + */ +- (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url + completed:(nullable SDExternalCompletionBlock)completedBlock NS_REFINED_FOR_SWIFT; + +/** + * Set the imageView `highlightedImage` with an `url` and custom options. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. + * @param completedBlock A block called when operation has been completed. This block has no return value + * and takes the requested UIImage as first parameter. In case of error the image parameter + * is nil and the second parameter may contain an NSError. The third parameter is a Boolean + * indicating if the image was retrieved from the local cache or from the network. + * The fourth parameter is the original image url. + */ +- (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url + options:(SDWebImageOptions)options + completed:(nullable SDExternalCompletionBlock)completedBlock; + +/** + * Set the imageView `highlightedImage` with an `url` and custom options. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. + * @param progressBlock A block called while image is downloading + * @note the progress block is executed on a background queue + * @param completedBlock A block called when operation has been completed. This block has no return value + * and takes the requested UIImage as first parameter. In case of error the image parameter + * is nil and the second parameter may contain an NSError. The third parameter is a Boolean + * indicating if the image was retrieved from the local cache or from the network. + * The fourth parameter is the original image url. + */ +- (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url + options:(SDWebImageOptions)options + progress:(nullable SDImageLoaderProgressBlock)progressBlock + completed:(nullable SDExternalCompletionBlock)completedBlock; + +/** + * Set the imageView `highlightedImage` with an `url`, custom options and context. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. + * @param context A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold. + * @param progressBlock A block called while image is downloading + * @note the progress block is executed on a background queue + * @param completedBlock A block called when operation has been completed. This block has no return value + * and takes the requested UIImage as first parameter. In case of error the image parameter + * is nil and the second parameter may contain an NSError. The third parameter is a Boolean + * indicating if the image was retrieved from the local cache or from the network. + * The fourth parameter is the original image url. + */ +- (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url + options:(SDWebImageOptions)options + context:(nullable SDWebImageContext *)context + progress:(nullable SDImageLoaderProgressBlock)progressBlock + completed:(nullable SDExternalCompletionBlock)completedBlock; + +@end + +#endif diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/UIImageView+HighlightedWebCache.m b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/UIImageView+HighlightedWebCache.m new file mode 100644 index 0000000..96c09c1 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/UIImageView+HighlightedWebCache.m @@ -0,0 +1,76 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "UIImageView+HighlightedWebCache.h" + +#if SD_UIKIT + +#import "UIView+WebCacheOperation.h" +#import "UIView+WebCache.h" +#import "SDInternalMacros.h" + +static NSString * const SDHighlightedImageOperationKey = @"UIImageViewImageOperationHighlighted"; + +@implementation UIImageView (HighlightedWebCache) + +- (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url { + [self sd_setHighlightedImageWithURL:url options:0 progress:nil completed:nil]; +} + +- (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url options:(SDWebImageOptions)options { + [self sd_setHighlightedImageWithURL:url options:options progress:nil completed:nil]; +} + +- (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url options:(SDWebImageOptions)options context:(nullable SDWebImageContext *)context { + [self sd_setHighlightedImageWithURL:url options:options context:context progress:nil completed:nil]; +} + +- (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url completed:(nullable SDExternalCompletionBlock)completedBlock { + [self sd_setHighlightedImageWithURL:url options:0 progress:nil completed:completedBlock]; +} + +- (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url options:(SDWebImageOptions)options completed:(nullable SDExternalCompletionBlock)completedBlock { + [self sd_setHighlightedImageWithURL:url options:options progress:nil completed:completedBlock]; +} + +- (void)sd_setHighlightedImageWithURL:(NSURL *)url options:(SDWebImageOptions)options progress:(nullable SDImageLoaderProgressBlock)progressBlock completed:(nullable SDExternalCompletionBlock)completedBlock { + [self sd_setHighlightedImageWithURL:url options:options context:nil progress:progressBlock completed:completedBlock]; +} + +- (void)sd_setHighlightedImageWithURL:(nullable NSURL *)url + options:(SDWebImageOptions)options + context:(nullable SDWebImageContext *)context + progress:(nullable SDImageLoaderProgressBlock)progressBlock + completed:(nullable SDExternalCompletionBlock)completedBlock { + @weakify(self); + SDWebImageMutableContext *mutableContext; + if (context) { + mutableContext = [context mutableCopy]; + } else { + mutableContext = [NSMutableDictionary dictionary]; + } + mutableContext[SDWebImageContextSetImageOperationKey] = SDHighlightedImageOperationKey; + [self sd_internalSetImageWithURL:url + placeholderImage:nil + options:options + context:mutableContext + setImageBlock:^(UIImage * _Nullable image, NSData * _Nullable imageData, SDImageCacheType cacheType, NSURL * _Nullable imageURL) { + @strongify(self); + self.highlightedImage = image; + } + progress:progressBlock + completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL) { + if (completedBlock) { + completedBlock(image, error, cacheType, imageURL); + } + }]; +} + +@end + +#endif diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/UIImageView+WebCache.h b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/UIImageView+WebCache.h new file mode 100644 index 0000000..626de9d --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/UIImageView+WebCache.h @@ -0,0 +1,194 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageCompat.h" +#import "SDWebImageManager.h" + +/** + * Usage with a UITableViewCell sub-class: + * + * @code + +#import + +... + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath +{ + static NSString *MyIdentifier = @"MyIdentifier"; + + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier]; + + if (cell == nil) { + cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:MyIdentifier]; + } + + // Here we use the provided sd_setImageWithURL:placeholderImage: method to load the web image + // Ensure you use a placeholder image otherwise cells will be initialized with no image + [cell.imageView sd_setImageWithURL:[NSURL URLWithString:@"http://example.com/image.jpg"] + placeholderImage:[UIImage imageNamed:@"placeholder"]]; + + cell.textLabel.text = @"My Text"; + return cell; +} + + * @endcode + */ + +/** + * Integrates SDWebImage async downloading and caching of remote images with UIImageView. + */ +@interface UIImageView (WebCache) + +/** + * Set the imageView `image` with an `url`. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + */ +- (void)sd_setImageWithURL:(nullable NSURL *)url NS_REFINED_FOR_SWIFT; + +/** + * Set the imageView `image` with an `url` and a placeholder. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param placeholder The image to be set initially, until the image request finishes. + * @see sd_setImageWithURL:placeholderImage:options: + */ +- (void)sd_setImageWithURL:(nullable NSURL *)url + placeholderImage:(nullable UIImage *)placeholder NS_REFINED_FOR_SWIFT; + +/** + * Set the imageView `image` with an `url`, placeholder and custom options. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param placeholder The image to be set initially, until the image request finishes. + * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. + */ +- (void)sd_setImageWithURL:(nullable NSURL *)url + placeholderImage:(nullable UIImage *)placeholder + options:(SDWebImageOptions)options NS_REFINED_FOR_SWIFT; + +/** + * Set the imageView `image` with an `url`, placeholder, custom options and context. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param placeholder The image to be set initially, until the image request finishes. + * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. + * @param context A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold. + */ +- (void)sd_setImageWithURL:(nullable NSURL *)url + placeholderImage:(nullable UIImage *)placeholder + options:(SDWebImageOptions)options + context:(nullable SDWebImageContext *)context; + +/** + * Set the imageView `image` with an `url`. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param completedBlock A block called when operation has been completed. This block has no return value + * and takes the requested UIImage as first parameter. In case of error the image parameter + * is nil and the second parameter may contain an NSError. The third parameter is a Boolean + * indicating if the image was retrieved from the local cache or from the network. + * The fourth parameter is the original image url. + */ +- (void)sd_setImageWithURL:(nullable NSURL *)url + completed:(nullable SDExternalCompletionBlock)completedBlock; + +/** + * Set the imageView `image` with an `url`, placeholder. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param placeholder The image to be set initially, until the image request finishes. + * @param completedBlock A block called when operation has been completed. This block has no return value + * and takes the requested UIImage as first parameter. In case of error the image parameter + * is nil and the second parameter may contain an NSError. The third parameter is a Boolean + * indicating if the image was retrieved from the local cache or from the network. + * The fourth parameter is the original image url. + */ +- (void)sd_setImageWithURL:(nullable NSURL *)url + placeholderImage:(nullable UIImage *)placeholder + completed:(nullable SDExternalCompletionBlock)completedBlock NS_REFINED_FOR_SWIFT; + +/** + * Set the imageView `image` with an `url`, placeholder and custom options. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param placeholder The image to be set initially, until the image request finishes. + * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. + * @param completedBlock A block called when operation has been completed. This block has no return value + * and takes the requested UIImage as first parameter. In case of error the image parameter + * is nil and the second parameter may contain an NSError. The third parameter is a Boolean + * indicating if the image was retrieved from the local cache or from the network. + * The fourth parameter is the original image url. + */ +- (void)sd_setImageWithURL:(nullable NSURL *)url + placeholderImage:(nullable UIImage *)placeholder + options:(SDWebImageOptions)options + completed:(nullable SDExternalCompletionBlock)completedBlock; + +/** + * Set the imageView `image` with an `url`, placeholder and custom options. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param placeholder The image to be set initially, until the image request finishes. + * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. + * @param progressBlock A block called while image is downloading + * @note the progress block is executed on a background queue + * @param completedBlock A block called when operation has been completed. This block has no return value + * and takes the requested UIImage as first parameter. In case of error the image parameter + * is nil and the second parameter may contain an NSError. The third parameter is a Boolean + * indicating if the image was retrieved from the local cache or from the network. + * The fourth parameter is the original image url. + */ +- (void)sd_setImageWithURL:(nullable NSURL *)url + placeholderImage:(nullable UIImage *)placeholder + options:(SDWebImageOptions)options + progress:(nullable SDImageLoaderProgressBlock)progressBlock + completed:(nullable SDExternalCompletionBlock)completedBlock; + +/** + * Set the imageView `image` with an `url`, placeholder, custom options and context. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param placeholder The image to be set initially, until the image request finishes. + * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. + * @param context A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold. + * @param progressBlock A block called while image is downloading + * @note the progress block is executed on a background queue + * @param completedBlock A block called when operation has been completed. This block has no return value + * and takes the requested UIImage as first parameter. In case of error the image parameter + * is nil and the second parameter may contain an NSError. The third parameter is a Boolean + * indicating if the image was retrieved from the local cache or from the network. + * The fourth parameter is the original image url. + */ +- (void)sd_setImageWithURL:(nullable NSURL *)url + placeholderImage:(nullable UIImage *)placeholder + options:(SDWebImageOptions)options + context:(nullable SDWebImageContext *)context + progress:(nullable SDImageLoaderProgressBlock)progressBlock + completed:(nullable SDExternalCompletionBlock)completedBlock; + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/UIImageView+WebCache.m b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/UIImageView+WebCache.m new file mode 100644 index 0000000..9d7f18e --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/UIImageView+WebCache.m @@ -0,0 +1,67 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "UIImageView+WebCache.h" +#import "objc/runtime.h" +#import "UIView+WebCacheOperation.h" +#import "UIView+WebCache.h" + +@implementation UIImageView (WebCache) + +- (void)sd_setImageWithURL:(nullable NSURL *)url { + [self sd_setImageWithURL:url placeholderImage:nil options:0 progress:nil completed:nil]; +} + +- (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder { + [self sd_setImageWithURL:url placeholderImage:placeholder options:0 progress:nil completed:nil]; +} + +- (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options { + [self sd_setImageWithURL:url placeholderImage:placeholder options:options progress:nil completed:nil]; +} + +- (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options context:(nullable SDWebImageContext *)context { + [self sd_setImageWithURL:url placeholderImage:placeholder options:options context:context progress:nil completed:nil]; +} + +- (void)sd_setImageWithURL:(nullable NSURL *)url completed:(nullable SDExternalCompletionBlock)completedBlock { + [self sd_setImageWithURL:url placeholderImage:nil options:0 progress:nil completed:completedBlock]; +} + +- (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder completed:(nullable SDExternalCompletionBlock)completedBlock { + [self sd_setImageWithURL:url placeholderImage:placeholder options:0 progress:nil completed:completedBlock]; +} + +- (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options completed:(nullable SDExternalCompletionBlock)completedBlock { + [self sd_setImageWithURL:url placeholderImage:placeholder options:options progress:nil completed:completedBlock]; +} + +- (void)sd_setImageWithURL:(nullable NSURL *)url placeholderImage:(nullable UIImage *)placeholder options:(SDWebImageOptions)options progress:(nullable SDImageLoaderProgressBlock)progressBlock completed:(nullable SDExternalCompletionBlock)completedBlock { + [self sd_setImageWithURL:url placeholderImage:placeholder options:options context:nil progress:progressBlock completed:completedBlock]; +} + +- (void)sd_setImageWithURL:(nullable NSURL *)url + placeholderImage:(nullable UIImage *)placeholder + options:(SDWebImageOptions)options + context:(nullable SDWebImageContext *)context + progress:(nullable SDImageLoaderProgressBlock)progressBlock + completed:(nullable SDExternalCompletionBlock)completedBlock { + [self sd_internalSetImageWithURL:url + placeholderImage:placeholder + options:options + context:context + setImageBlock:nil + progress:progressBlock + completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL) { + if (completedBlock) { + completedBlock(image, error, cacheType, imageURL); + } + }]; +} + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/UIView+WebCache.h b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/UIView+WebCache.h new file mode 100644 index 0000000..48175f1 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/UIView+WebCache.h @@ -0,0 +1,110 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageCompat.h" +#import "SDWebImageDefine.h" +#import "SDWebImageManager.h" +#import "SDWebImageTransition.h" +#import "SDWebImageIndicator.h" + +/** + The value specify that the image progress unit count cannot be determined because the progressBlock is not been called. + */ +FOUNDATION_EXPORT const int64_t SDWebImageProgressUnitCountUnknown; /* 1LL */ + +typedef void(^SDSetImageBlock)(UIImage * _Nullable image, NSData * _Nullable imageData, SDImageCacheType cacheType, NSURL * _Nullable imageURL); + +/** + Integrates SDWebImage async downloading and caching of remote images with UIView subclass. + */ +@interface UIView (WebCache) + +/** + * Get the current image URL. + * + * @note Note that because of the limitations of categories this property can get out of sync if you use setImage: directly. + */ +@property (nonatomic, strong, readonly, nullable) NSURL *sd_imageURL; + +/** + * Get the current image operation key. Operation key is used to identify the different queries for one view instance (like UIButton). + * See more about this in `SDWebImageContextSetImageOperationKey`. + * If you cancel current image load, the key will be set to nil. + * @note You can use method `UIView+WebCacheOperation` to investigate different queries' operation. + */ +@property (nonatomic, strong, readonly, nullable) NSString *sd_latestOperationKey; + +/** + * The current image loading progress associated to the view. The unit count is the received size and excepted size of download. + * The `totalUnitCount` and `completedUnitCount` will be reset to 0 after a new image loading start (change from current queue). And they will be set to `SDWebImageProgressUnitCountUnknown` if the progressBlock not been called but the image loading success to mark the progress finished (change from main queue). + * @note You can use Key-Value Observing on the progress, but you should take care that the change to progress is from a background queue during download(the same as progressBlock). If you want to using KVO and update the UI, make sure to dispatch on the main queue. And it's recommend to use some KVO libs like KVOController because it's more safe and easy to use. + * @note The getter will create a progress instance if the value is nil. But by default, we don't create one. If you need to use Key-Value Observing, you must trigger the getter or set a custom progress instance before the loading start. The default value is nil. + * @note Note that because of the limitations of categories this property can get out of sync if you update the progress directly. + */ +@property (nonatomic, strong, null_resettable) NSProgress *sd_imageProgress; + +/** + * Set the imageView `image` with an `url` and optionally a placeholder image. + * + * The download is asynchronous and cached. + * + * @param url The url for the image. + * @param placeholder The image to be set initially, until the image request finishes. + * @param options The options to use when downloading the image. @see SDWebImageOptions for the possible values. + * @param context A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold. + * @param setImageBlock Block used for custom set image code. If not provide, use the built-in set image code (supports `UIImageView/NSImageView` and `UIButton/NSButton` currently) + * @param progressBlock A block called while image is downloading + * @note the progress block is executed on a background queue + * @param completedBlock A block called when operation has been completed. + * This block has no return value and takes the requested UIImage as first parameter and the NSData representation as second parameter. + * In case of error the image parameter is nil and the third parameter may contain an NSError. + * + * The forth parameter is an `SDImageCacheType` enum indicating if the image was retrieved from the local cache + * or from the memory cache or from the network. + * + * The fifth parameter normally is always YES. However, if you provide SDWebImageAvoidAutoSetImage with SDWebImageProgressiveLoad options to enable progressive downloading and set the image yourself. This block is thus called repeatedly with a partial image. When image is fully downloaded, the + * block is called a last time with the full image and the last parameter set to YES. + * + * The last parameter is the original image URL + * @return The returned operation for cancelling cache and download operation, typically type is `SDWebImageCombinedOperation` + */ +- (nullable id)sd_internalSetImageWithURL:(nullable NSURL *)url + placeholderImage:(nullable UIImage *)placeholder + options:(SDWebImageOptions)options + context:(nullable SDWebImageContext *)context + setImageBlock:(nullable SDSetImageBlock)setImageBlock + progress:(nullable SDImageLoaderProgressBlock)progressBlock + completed:(nullable SDInternalCompletionBlock)completedBlock; + +/** + * Cancel the current image load + */ +- (void)sd_cancelCurrentImageLoad; + +#if SD_UIKIT || SD_MAC + +#pragma mark - Image Transition + +/** + The image transition when image load finished. See `SDWebImageTransition`. + If you specify nil, do not do transition. Defaults to nil. + */ +@property (nonatomic, strong, nullable) SDWebImageTransition *sd_imageTransition; + +#pragma mark - Image Indicator + +/** + The image indicator during the image loading. If you do not need indicator, specify nil. Defaults to nil + The setter will remove the old indicator view and add new indicator view to current view's subview. + @note Because this is UI related, you should access only from the main queue. + */ +@property (nonatomic, strong, nullable) id sd_imageIndicator; + +#endif + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/UIView+WebCache.m b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/UIView+WebCache.m new file mode 100644 index 0000000..486584f --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/UIView+WebCache.m @@ -0,0 +1,446 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "UIView+WebCache.h" +#import "objc/runtime.h" +#import "UIView+WebCacheOperation.h" +#import "SDWebImageError.h" +#import "SDInternalMacros.h" +#import "SDWebImageTransitionInternal.h" +#import "SDImageCache.h" + +const int64_t SDWebImageProgressUnitCountUnknown = 1LL; + +@implementation UIView (WebCache) + +- (nullable NSURL *)sd_imageURL { + return objc_getAssociatedObject(self, @selector(sd_imageURL)); +} + +- (void)setSd_imageURL:(NSURL * _Nullable)sd_imageURL { + objc_setAssociatedObject(self, @selector(sd_imageURL), sd_imageURL, OBJC_ASSOCIATION_RETAIN_NONATOMIC); +} + +- (nullable NSString *)sd_latestOperationKey { + return objc_getAssociatedObject(self, @selector(sd_latestOperationKey)); +} + +- (void)setSd_latestOperationKey:(NSString * _Nullable)sd_latestOperationKey { + objc_setAssociatedObject(self, @selector(sd_latestOperationKey), sd_latestOperationKey, OBJC_ASSOCIATION_COPY_NONATOMIC); +} + +- (NSProgress *)sd_imageProgress { + NSProgress *progress = objc_getAssociatedObject(self, @selector(sd_imageProgress)); + if (!progress) { + progress = [[NSProgress alloc] initWithParent:nil userInfo:nil]; + self.sd_imageProgress = progress; + } + return progress; +} + +- (void)setSd_imageProgress:(NSProgress *)sd_imageProgress { + objc_setAssociatedObject(self, @selector(sd_imageProgress), sd_imageProgress, OBJC_ASSOCIATION_RETAIN_NONATOMIC); +} + +- (nullable id)sd_internalSetImageWithURL:(nullable NSURL *)url + placeholderImage:(nullable UIImage *)placeholder + options:(SDWebImageOptions)options + context:(nullable SDWebImageContext *)context + setImageBlock:(nullable SDSetImageBlock)setImageBlock + progress:(nullable SDImageLoaderProgressBlock)progressBlock + completed:(nullable SDInternalCompletionBlock)completedBlock { + if (context) { + // copy to avoid mutable object + context = [context copy]; + } else { + context = [NSDictionary dictionary]; + } + NSString *validOperationKey = context[SDWebImageContextSetImageOperationKey]; + if (!validOperationKey) { + // pass through the operation key to downstream, which can used for tracing operation or image view class + validOperationKey = NSStringFromClass([self class]); + SDWebImageMutableContext *mutableContext = [context mutableCopy]; + mutableContext[SDWebImageContextSetImageOperationKey] = validOperationKey; + context = [mutableContext copy]; + } + self.sd_latestOperationKey = validOperationKey; + [self sd_cancelImageLoadOperationWithKey:validOperationKey]; + self.sd_imageURL = url; + + SDWebImageManager *manager = context[SDWebImageContextCustomManager]; + if (!manager) { + manager = [SDWebImageManager sharedManager]; + } else { + // remove this manager to avoid retain cycle (manger -> loader -> operation -> context -> manager) + SDWebImageMutableContext *mutableContext = [context mutableCopy]; + mutableContext[SDWebImageContextCustomManager] = nil; + context = [mutableContext copy]; + } + + BOOL shouldUseWeakCache = NO; + if ([manager.imageCache isKindOfClass:SDImageCache.class]) { + shouldUseWeakCache = ((SDImageCache *)manager.imageCache).config.shouldUseWeakMemoryCache; + } + if (!(options & SDWebImageDelayPlaceholder)) { + if (shouldUseWeakCache) { + NSString *key = [manager cacheKeyForURL:url context:context]; + // call memory cache to trigger weak cache sync logic, ignore the return value and go on normal query + // this unfortunately will cause twice memory cache query, but it's fast enough + // in the future the weak cache feature may be re-design or removed + [((SDImageCache *)manager.imageCache) imageFromMemoryCacheForKey:key]; + } + dispatch_main_async_safe(^{ + [self sd_setImage:placeholder imageData:nil basedOnClassOrViaCustomSetImageBlock:setImageBlock cacheType:SDImageCacheTypeNone imageURL:url]; + }); + } + + id operation = nil; + + if (url) { + // reset the progress + NSProgress *imageProgress = objc_getAssociatedObject(self, @selector(sd_imageProgress)); + if (imageProgress) { + imageProgress.totalUnitCount = 0; + imageProgress.completedUnitCount = 0; + } + +#if SD_UIKIT || SD_MAC + // check and start image indicator + [self sd_startImageIndicator]; + id imageIndicator = self.sd_imageIndicator; +#endif + + SDImageLoaderProgressBlock combinedProgressBlock = ^(NSInteger receivedSize, NSInteger expectedSize, NSURL * _Nullable targetURL) { + if (imageProgress) { + imageProgress.totalUnitCount = expectedSize; + imageProgress.completedUnitCount = receivedSize; + } +#if SD_UIKIT || SD_MAC + if ([imageIndicator respondsToSelector:@selector(updateIndicatorProgress:)]) { + double progress = 0; + if (expectedSize != 0) { + progress = (double)receivedSize / expectedSize; + } + progress = MAX(MIN(progress, 1), 0); // 0.0 - 1.0 + dispatch_async(dispatch_get_main_queue(), ^{ + [imageIndicator updateIndicatorProgress:progress]; + }); + } +#endif + if (progressBlock) { + progressBlock(receivedSize, expectedSize, targetURL); + } + }; + @weakify(self); + operation = [manager loadImageWithURL:url options:options context:context progress:combinedProgressBlock completed:^(UIImage *image, NSData *data, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) { + @strongify(self); + if (!self) { return; } + // if the progress not been updated, mark it to complete state + if (imageProgress && finished && !error && imageProgress.totalUnitCount == 0 && imageProgress.completedUnitCount == 0) { + imageProgress.totalUnitCount = SDWebImageProgressUnitCountUnknown; + imageProgress.completedUnitCount = SDWebImageProgressUnitCountUnknown; + } + +#if SD_UIKIT || SD_MAC + // check and stop image indicator + if (finished) { + [self sd_stopImageIndicator]; + } +#endif + + BOOL shouldCallCompletedBlock = finished || (options & SDWebImageAvoidAutoSetImage); + BOOL shouldNotSetImage = ((image && (options & SDWebImageAvoidAutoSetImage)) || + (!image && !(options & SDWebImageDelayPlaceholder))); + SDWebImageNoParamsBlock callCompletedBlockClosure = ^{ + if (!self) { return; } + if (!shouldNotSetImage) { + [self sd_setNeedsLayout]; + } + if (completedBlock && shouldCallCompletedBlock) { + completedBlock(image, data, error, cacheType, finished, url); + } + }; + + // case 1a: we got an image, but the SDWebImageAvoidAutoSetImage flag is set + // OR + // case 1b: we got no image and the SDWebImageDelayPlaceholder is not set + if (shouldNotSetImage) { + dispatch_main_async_safe(callCompletedBlockClosure); + return; + } + + UIImage *targetImage = nil; + NSData *targetData = nil; + if (image) { + // case 2a: we got an image and the SDWebImageAvoidAutoSetImage is not set + targetImage = image; + targetData = data; + } else if (options & SDWebImageDelayPlaceholder) { + // case 2b: we got no image and the SDWebImageDelayPlaceholder flag is set + targetImage = placeholder; + targetData = nil; + } + +#if SD_UIKIT || SD_MAC + // check whether we should use the image transition + SDWebImageTransition *transition = nil; + BOOL shouldUseTransition = NO; + if (options & SDWebImageForceTransition) { + // Always + shouldUseTransition = YES; + } else if (cacheType == SDImageCacheTypeNone) { + // From network + shouldUseTransition = YES; + } else { + // From disk (and, user don't use sync query) + if (cacheType == SDImageCacheTypeMemory) { + shouldUseTransition = NO; + } else if (cacheType == SDImageCacheTypeDisk) { + if (options & SDWebImageQueryMemoryDataSync || options & SDWebImageQueryDiskDataSync) { + shouldUseTransition = NO; + } else { + shouldUseTransition = YES; + } + } else { + // Not valid cache type, fallback + shouldUseTransition = NO; + } + } + if (finished && shouldUseTransition) { + transition = self.sd_imageTransition; + } +#endif + dispatch_main_async_safe(^{ +#if SD_UIKIT || SD_MAC + [self sd_setImage:targetImage imageData:targetData basedOnClassOrViaCustomSetImageBlock:setImageBlock transition:transition cacheType:cacheType imageURL:imageURL]; +#else + [self sd_setImage:targetImage imageData:targetData basedOnClassOrViaCustomSetImageBlock:setImageBlock cacheType:cacheType imageURL:imageURL]; +#endif + callCompletedBlockClosure(); + }); + }]; + [self sd_setImageLoadOperation:operation forKey:validOperationKey]; + } else { +#if SD_UIKIT || SD_MAC + [self sd_stopImageIndicator]; +#endif + dispatch_main_async_safe(^{ + if (completedBlock) { + NSError *error = [NSError errorWithDomain:SDWebImageErrorDomain code:SDWebImageErrorInvalidURL userInfo:@{NSLocalizedDescriptionKey : @"Image url is nil"}]; + completedBlock(nil, nil, error, SDImageCacheTypeNone, YES, url); + } + }); + } + + return operation; +} + +- (void)sd_cancelCurrentImageLoad { + [self sd_cancelImageLoadOperationWithKey:self.sd_latestOperationKey]; + self.sd_latestOperationKey = nil; +} + +- (void)sd_setImage:(UIImage *)image imageData:(NSData *)imageData basedOnClassOrViaCustomSetImageBlock:(SDSetImageBlock)setImageBlock cacheType:(SDImageCacheType)cacheType imageURL:(NSURL *)imageURL { +#if SD_UIKIT || SD_MAC + [self sd_setImage:image imageData:imageData basedOnClassOrViaCustomSetImageBlock:setImageBlock transition:nil cacheType:cacheType imageURL:imageURL]; +#else + // watchOS does not support view transition. Simplify the logic + if (setImageBlock) { + setImageBlock(image, imageData, cacheType, imageURL); + } else if ([self isKindOfClass:[UIImageView class]]) { + UIImageView *imageView = (UIImageView *)self; + [imageView setImage:image]; + } +#endif +} + +#if SD_UIKIT || SD_MAC +- (void)sd_setImage:(UIImage *)image imageData:(NSData *)imageData basedOnClassOrViaCustomSetImageBlock:(SDSetImageBlock)setImageBlock transition:(SDWebImageTransition *)transition cacheType:(SDImageCacheType)cacheType imageURL:(NSURL *)imageURL { + UIView *view = self; + SDSetImageBlock finalSetImageBlock; + if (setImageBlock) { + finalSetImageBlock = setImageBlock; + } else if ([view isKindOfClass:[UIImageView class]]) { + UIImageView *imageView = (UIImageView *)view; + finalSetImageBlock = ^(UIImage *setImage, NSData *setImageData, SDImageCacheType setCacheType, NSURL *setImageURL) { + imageView.image = setImage; + }; + } +#if SD_UIKIT + else if ([view isKindOfClass:[UIButton class]]) { + UIButton *button = (UIButton *)view; + finalSetImageBlock = ^(UIImage *setImage, NSData *setImageData, SDImageCacheType setCacheType, NSURL *setImageURL) { + [button setImage:setImage forState:UIControlStateNormal]; + }; + } +#endif +#if SD_MAC + else if ([view isKindOfClass:[NSButton class]]) { + NSButton *button = (NSButton *)view; + finalSetImageBlock = ^(UIImage *setImage, NSData *setImageData, SDImageCacheType setCacheType, NSURL *setImageURL) { + button.image = setImage; + }; + } +#endif + + if (transition) { + NSString *originalOperationKey = view.sd_latestOperationKey; + +#if SD_UIKIT + [UIView transitionWithView:view duration:0 options:0 animations:^{ + if (!view.sd_latestOperationKey || ![originalOperationKey isEqualToString:view.sd_latestOperationKey]) { + return; + } + // 0 duration to let UIKit render placeholder and prepares block + if (transition.prepares) { + transition.prepares(view, image, imageData, cacheType, imageURL); + } + } completion:^(BOOL tempFinished) { + [UIView transitionWithView:view duration:transition.duration options:transition.animationOptions animations:^{ + if (!view.sd_latestOperationKey || ![originalOperationKey isEqualToString:view.sd_latestOperationKey]) { + return; + } + if (finalSetImageBlock && !transition.avoidAutoSetImage) { + finalSetImageBlock(image, imageData, cacheType, imageURL); + } + if (transition.animations) { + transition.animations(view, image); + } + } completion:^(BOOL finished) { + if (!view.sd_latestOperationKey || ![originalOperationKey isEqualToString:view.sd_latestOperationKey]) { + return; + } + if (transition.completion) { + transition.completion(finished); + } + }]; + }]; +#elif SD_MAC + [NSAnimationContext runAnimationGroup:^(NSAnimationContext * _Nonnull prepareContext) { + if (!view.sd_latestOperationKey || ![originalOperationKey isEqualToString:view.sd_latestOperationKey]) { + return; + } + // 0 duration to let AppKit render placeholder and prepares block + prepareContext.duration = 0; + if (transition.prepares) { + transition.prepares(view, image, imageData, cacheType, imageURL); + } + } completionHandler:^{ + [NSAnimationContext runAnimationGroup:^(NSAnimationContext * _Nonnull context) { + if (!view.sd_latestOperationKey || ![originalOperationKey isEqualToString:view.sd_latestOperationKey]) { + return; + } + context.duration = transition.duration; +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + CAMediaTimingFunction *timingFunction = transition.timingFunction; +#pragma clang diagnostic pop + if (!timingFunction) { + timingFunction = SDTimingFunctionFromAnimationOptions(transition.animationOptions); + } + context.timingFunction = timingFunction; + context.allowsImplicitAnimation = SD_OPTIONS_CONTAINS(transition.animationOptions, SDWebImageAnimationOptionAllowsImplicitAnimation); + if (finalSetImageBlock && !transition.avoidAutoSetImage) { + finalSetImageBlock(image, imageData, cacheType, imageURL); + } + CATransition *trans = SDTransitionFromAnimationOptions(transition.animationOptions); + if (trans) { + [view.layer addAnimation:trans forKey:kCATransition]; + } + if (transition.animations) { + transition.animations(view, image); + } + } completionHandler:^{ + if (!view.sd_latestOperationKey || ![originalOperationKey isEqualToString:view.sd_latestOperationKey]) { + return; + } + if (transition.completion) { + transition.completion(YES); + } + }]; + }]; +#endif + } else { + if (finalSetImageBlock) { + finalSetImageBlock(image, imageData, cacheType, imageURL); + } + } +} +#endif + +- (void)sd_setNeedsLayout { +#if SD_UIKIT + [self setNeedsLayout]; +#elif SD_MAC + [self setNeedsLayout:YES]; +#elif SD_WATCH + // Do nothing because WatchKit automatically layout the view after property change +#endif +} + +#if SD_UIKIT || SD_MAC + +#pragma mark - Image Transition +- (SDWebImageTransition *)sd_imageTransition { + return objc_getAssociatedObject(self, @selector(sd_imageTransition)); +} + +- (void)setSd_imageTransition:(SDWebImageTransition *)sd_imageTransition { + objc_setAssociatedObject(self, @selector(sd_imageTransition), sd_imageTransition, OBJC_ASSOCIATION_RETAIN_NONATOMIC); +} + +#pragma mark - Indicator +- (id)sd_imageIndicator { + return objc_getAssociatedObject(self, @selector(sd_imageIndicator)); +} + +- (void)setSd_imageIndicator:(id)sd_imageIndicator { + // Remove the old indicator view + id previousIndicator = self.sd_imageIndicator; + [previousIndicator.indicatorView removeFromSuperview]; + + objc_setAssociatedObject(self, @selector(sd_imageIndicator), sd_imageIndicator, OBJC_ASSOCIATION_RETAIN_NONATOMIC); + + // Add the new indicator view + UIView *view = sd_imageIndicator.indicatorView; + if (CGRectEqualToRect(view.frame, CGRectZero)) { + view.frame = self.bounds; + } + // Center the indicator view +#if SD_MAC + [view setFrameOrigin:CGPointMake(round((NSWidth(self.bounds) - NSWidth(view.frame)) / 2), round((NSHeight(self.bounds) - NSHeight(view.frame)) / 2))]; +#else + view.center = CGPointMake(CGRectGetMidX(self.bounds), CGRectGetMidY(self.bounds)); +#endif + view.hidden = NO; + [self addSubview:view]; +} + +- (void)sd_startImageIndicator { + id imageIndicator = self.sd_imageIndicator; + if (!imageIndicator) { + return; + } + dispatch_main_async_safe(^{ + [imageIndicator startAnimatingIndicator]; + }); +} + +- (void)sd_stopImageIndicator { + id imageIndicator = self.sd_imageIndicator; + if (!imageIndicator) { + return; + } + dispatch_main_async_safe(^{ + [imageIndicator stopAnimatingIndicator]; + }); +} + +#endif + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/UIView+WebCacheOperation.h b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/UIView+WebCacheOperation.h new file mode 100644 index 0000000..fc23508 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/UIView+WebCacheOperation.h @@ -0,0 +1,48 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageCompat.h" +#import "SDWebImageOperation.h" + +/** + These methods are used to support canceling for UIView image loading, it's designed to be used internal but not external. + All the stored operations are weak, so it will be dealloced after image loading finished. If you need to store operations, use your own class to keep a strong reference for them. + */ +@interface UIView (WebCacheOperation) + +/** + * Get the image load operation for key + * + * @param key key for identifying the operations + * @return the image load operation + */ +- (nullable id)sd_imageLoadOperationForKey:(nullable NSString *)key; + +/** + * Set the image load operation (storage in a UIView based weak map table) + * + * @param operation the operation + * @param key key for storing the operation + */ +- (void)sd_setImageLoadOperation:(nullable id)operation forKey:(nullable NSString *)key; + +/** + * Cancel the operation for the current UIView and key + * + * @param key key for identifying the operations + */ +- (void)sd_cancelImageLoadOperationWithKey:(nullable NSString *)key; + +/** + * Just remove the operation corresponding to the current UIView and key without cancelling them + * + * @param key key for identifying the operations + */ +- (void)sd_removeImageLoadOperationWithKey:(nullable NSString *)key; + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/UIView+WebCacheOperation.m b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/UIView+WebCacheOperation.m new file mode 100644 index 0000000..6fe23e4 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Core/UIView+WebCacheOperation.m @@ -0,0 +1,82 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "UIView+WebCacheOperation.h" +#import "objc/runtime.h" + +// key is strong, value is weak because operation instance is retained by SDWebImageManager's runningOperations property +// we should use lock to keep thread-safe because these method may not be accessed from main queue +typedef NSMapTable> SDOperationsDictionary; + +@implementation UIView (WebCacheOperation) + +- (SDOperationsDictionary *)sd_operationDictionary { + @synchronized(self) { + SDOperationsDictionary *operations = objc_getAssociatedObject(self, @selector(sd_operationDictionary)); + if (operations) { + return operations; + } + operations = [[NSMapTable alloc] initWithKeyOptions:NSPointerFunctionsStrongMemory valueOptions:NSPointerFunctionsWeakMemory capacity:0]; + objc_setAssociatedObject(self, @selector(sd_operationDictionary), operations, OBJC_ASSOCIATION_RETAIN_NONATOMIC); + return operations; + } +} + +- (nullable id)sd_imageLoadOperationForKey:(nullable NSString *)key { + id operation; + if (key) { + SDOperationsDictionary *operationDictionary = [self sd_operationDictionary]; + @synchronized (self) { + operation = [operationDictionary objectForKey:key]; + } + } + return operation; +} + +- (void)sd_setImageLoadOperation:(nullable id)operation forKey:(nullable NSString *)key { + if (key) { + [self sd_cancelImageLoadOperationWithKey:key]; + if (operation) { + SDOperationsDictionary *operationDictionary = [self sd_operationDictionary]; + @synchronized (self) { + [operationDictionary setObject:operation forKey:key]; + } + } + } +} + +- (void)sd_cancelImageLoadOperationWithKey:(nullable NSString *)key { + if (key) { + // Cancel in progress downloader from queue + SDOperationsDictionary *operationDictionary = [self sd_operationDictionary]; + id operation; + + @synchronized (self) { + operation = [operationDictionary objectForKey:key]; + } + if (operation) { + if ([operation conformsToProtocol:@protocol(SDWebImageOperation)]) { + [operation cancel]; + } + @synchronized (self) { + [operationDictionary removeObjectForKey:key]; + } + } + } +} + +- (void)sd_removeImageLoadOperationWithKey:(nullable NSString *)key { + if (key) { + SDOperationsDictionary *operationDictionary = [self sd_operationDictionary]; + @synchronized (self) { + [operationDictionary removeObjectForKey:key]; + } + } +} + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/NSBezierPath+SDRoundedCorners.h b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/NSBezierPath+SDRoundedCorners.h new file mode 100644 index 0000000..dfec18b --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/NSBezierPath+SDRoundedCorners.h @@ -0,0 +1,24 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageCompat.h" + +#if SD_MAC + +#import "UIImage+Transform.h" + +@interface NSBezierPath (SDRoundedCorners) + +/** + Convenience way to create a bezier path with the specify rounding corners on macOS. Same as the one on `UIBezierPath`. + */ ++ (nonnull instancetype)sd_bezierPathWithRoundedRect:(NSRect)rect byRoundingCorners:(SDRectCorner)corners cornerRadius:(CGFloat)cornerRadius; + +@end + +#endif diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/NSBezierPath+SDRoundedCorners.m b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/NSBezierPath+SDRoundedCorners.m new file mode 100644 index 0000000..b6f7a01 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/NSBezierPath+SDRoundedCorners.m @@ -0,0 +1,42 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "NSBezierPath+SDRoundedCorners.h" + +#if SD_MAC + +@implementation NSBezierPath (SDRoundedCorners) + ++ (instancetype)sd_bezierPathWithRoundedRect:(NSRect)rect byRoundingCorners:(SDRectCorner)corners cornerRadius:(CGFloat)cornerRadius { + NSBezierPath *path = [NSBezierPath bezierPath]; + + CGFloat maxCorner = MIN(NSWidth(rect), NSHeight(rect)) / 2; + + CGFloat topLeftRadius = MIN(maxCorner, (corners & SDRectCornerTopLeft) ? cornerRadius : 0); + CGFloat topRightRadius = MIN(maxCorner, (corners & SDRectCornerTopRight) ? cornerRadius : 0); + CGFloat bottomLeftRadius = MIN(maxCorner, (corners & SDRectCornerBottomLeft) ? cornerRadius : 0); + CGFloat bottomRightRadius = MIN(maxCorner, (corners & SDRectCornerBottomRight) ? cornerRadius : 0); + + NSPoint topLeft = NSMakePoint(NSMinX(rect), NSMaxY(rect)); + NSPoint topRight = NSMakePoint(NSMaxX(rect), NSMaxY(rect)); + NSPoint bottomLeft = NSMakePoint(NSMinX(rect), NSMinY(rect)); + NSPoint bottomRight = NSMakePoint(NSMaxX(rect), NSMinY(rect)); + + [path moveToPoint:NSMakePoint(NSMidX(rect), NSMaxY(rect))]; + [path appendBezierPathWithArcFromPoint:topLeft toPoint:bottomLeft radius:topLeftRadius]; + [path appendBezierPathWithArcFromPoint:bottomLeft toPoint:bottomRight radius:bottomLeftRadius]; + [path appendBezierPathWithArcFromPoint:bottomRight toPoint:topRight radius:bottomRightRadius]; + [path appendBezierPathWithArcFromPoint:topRight toPoint:topLeft radius:topRightRadius]; + [path closePath]; + + return path; +} + +@end + +#endif diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/SDAssociatedObject.h b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/SDAssociatedObject.h new file mode 100644 index 0000000..199cf4f --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/SDAssociatedObject.h @@ -0,0 +1,14 @@ +/* +* This file is part of the SDWebImage package. +* (c) Olivier Poitrey +* +* For the full copyright and license information, please view the LICENSE +* file that was distributed with this source code. +*/ + +#import "SDWebImageCompat.h" + +/// Copy the associated object from source image to target image. The associated object including all the category read/write properties. +/// @param source source +/// @param target target +FOUNDATION_EXPORT void SDImageCopyAssociatedObject(UIImage * _Nullable source, UIImage * _Nullable target); diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/SDAssociatedObject.m b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/SDAssociatedObject.m new file mode 100644 index 0000000..c122da4 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/SDAssociatedObject.m @@ -0,0 +1,28 @@ +/* +* This file is part of the SDWebImage package. +* (c) Olivier Poitrey +* +* For the full copyright and license information, please view the LICENSE +* file that was distributed with this source code. +*/ + +#import "SDAssociatedObject.h" +#import "UIImage+Metadata.h" +#import "UIImage+ExtendedCacheData.h" +#import "UIImage+MemoryCacheCost.h" +#import "UIImage+ForceDecode.h" + +void SDImageCopyAssociatedObject(UIImage * _Nullable source, UIImage * _Nullable target) { + if (!source || !target) { + return; + } + // Image Metadata + target.sd_isIncremental = source.sd_isIncremental; + target.sd_decodeOptions = source.sd_decodeOptions; + target.sd_imageLoopCount = source.sd_imageLoopCount; + target.sd_imageFormat = source.sd_imageFormat; + // Force Decode + target.sd_isDecoded = source.sd_isDecoded; + // Extended Cache Data + target.sd_extendedObject = source.sd_extendedObject; +} diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/SDAsyncBlockOperation.h b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/SDAsyncBlockOperation.h new file mode 100644 index 0000000..a3480de --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/SDAsyncBlockOperation.h @@ -0,0 +1,21 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageCompat.h" + +@class SDAsyncBlockOperation; +typedef void (^SDAsyncBlock)(SDAsyncBlockOperation * __nonnull asyncOperation); + +/// A async block operation, success after you call `completer` (not like `NSBlockOperation` which is for sync block, success on return) +@interface SDAsyncBlockOperation : NSOperation + +- (nonnull instancetype)initWithBlock:(nonnull SDAsyncBlock)block; ++ (nonnull instancetype)blockOperationWithBlock:(nonnull SDAsyncBlock)block; +- (void)complete; + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/SDAsyncBlockOperation.m b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/SDAsyncBlockOperation.m new file mode 100644 index 0000000..0b2fefe --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/SDAsyncBlockOperation.m @@ -0,0 +1,92 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDAsyncBlockOperation.h" + +@interface SDAsyncBlockOperation () + +@property (assign, nonatomic, getter = isExecuting) BOOL executing; +@property (assign, nonatomic, getter = isFinished) BOOL finished; +@property (nonatomic, copy, nonnull) SDAsyncBlock executionBlock; + +@end + +@implementation SDAsyncBlockOperation + +@synthesize executing = _executing; +@synthesize finished = _finished; + +- (nonnull instancetype)initWithBlock:(nonnull SDAsyncBlock)block { + self = [super init]; + if (self) { + self.executionBlock = block; + } + return self; +} + ++ (nonnull instancetype)blockOperationWithBlock:(nonnull SDAsyncBlock)block { + SDAsyncBlockOperation *operation = [[SDAsyncBlockOperation alloc] initWithBlock:block]; + return operation; +} + +- (void)start { + @synchronized (self) { + if (self.isCancelled) { + self.finished = YES; + return; + } + + self.finished = NO; + self.executing = YES; + + if (self.executionBlock) { + self.executionBlock(self); + } else { + self.executing = NO; + self.finished = YES; + } + } +} + +- (void)cancel { + @synchronized (self) { + [super cancel]; + if (self.isExecuting) { + self.executing = NO; + self.finished = YES; + } + } +} + + +- (void)complete { + @synchronized (self) { + if (self.isExecuting) { + self.finished = YES; + self.executing = NO; + } + } + } + +- (void)setFinished:(BOOL)finished { + [self willChangeValueForKey:@"isFinished"]; + _finished = finished; + [self didChangeValueForKey:@"isFinished"]; +} + +- (void)setExecuting:(BOOL)executing { + [self willChangeValueForKey:@"isExecuting"]; + _executing = executing; + [self didChangeValueForKey:@"isExecuting"]; +} + +- (BOOL)isConcurrent { + return YES; +} + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/SDDeviceHelper.h b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/SDDeviceHelper.h new file mode 100644 index 0000000..5d5676b --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/SDDeviceHelper.h @@ -0,0 +1,18 @@ +/* +* This file is part of the SDWebImage package. +* (c) Olivier Poitrey +* +* For the full copyright and license information, please view the LICENSE +* file that was distributed with this source code. +*/ + +#import +#import "SDWebImageCompat.h" + +/// Device information helper methods +@interface SDDeviceHelper : NSObject + ++ (NSUInteger)totalMemory; ++ (NSUInteger)freeMemory; + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/SDDeviceHelper.m b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/SDDeviceHelper.m new file mode 100644 index 0000000..83d0229 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/SDDeviceHelper.m @@ -0,0 +1,32 @@ +/* +* This file is part of the SDWebImage package. +* (c) Olivier Poitrey +* +* For the full copyright and license information, please view the LICENSE +* file that was distributed with this source code. +*/ + +#import "SDDeviceHelper.h" +#import + +@implementation SDDeviceHelper + ++ (NSUInteger)totalMemory { + return (NSUInteger)[[NSProcessInfo processInfo] physicalMemory]; +} + ++ (NSUInteger)freeMemory { + mach_port_t host_port = mach_host_self(); + mach_msg_type_number_t host_size = sizeof(vm_statistics_data_t) / sizeof(integer_t); + vm_size_t page_size; + vm_statistics_data_t vm_stat; + kern_return_t kern; + + kern = host_page_size(host_port, &page_size); + if (kern != KERN_SUCCESS) return 0; + kern = host_statistics(host_port, HOST_VM_INFO, (host_info_t)&vm_stat, &host_size); + if (kern != KERN_SUCCESS) return 0; + return vm_stat.free_count * page_size; +} + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/SDDisplayLink.h b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/SDDisplayLink.h new file mode 100644 index 0000000..3ee8c6f --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/SDDisplayLink.h @@ -0,0 +1,29 @@ +/* +* This file is part of the SDWebImage package. +* (c) Olivier Poitrey +* +* For the full copyright and license information, please view the LICENSE +* file that was distributed with this source code. +*/ + +#import +#import "SDWebImageCompat.h" + +/// Cross-platform display link wrapper. Do not retain the target +/// Use `CADisplayLink` on iOS/tvOS, `CVDisplayLink` on macOS, `NSTimer` on watchOS +@interface SDDisplayLink : NSObject + +@property (readonly, nonatomic, weak, nullable) id target; +@property (readonly, nonatomic, assign, nonnull) SEL selector; +@property (readonly, nonatomic) CFTimeInterval duration; +@property (readonly, nonatomic) BOOL isRunning; + ++ (nonnull instancetype)displayLinkWithTarget:(nonnull id)target selector:(nonnull SEL)sel; + +- (void)addToRunLoop:(nonnull NSRunLoop *)runloop forMode:(nonnull NSRunLoopMode)mode; +- (void)removeFromRunLoop:(nonnull NSRunLoop *)runloop forMode:(nonnull NSRunLoopMode)mode; + +- (void)start; +- (void)stop; + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/SDDisplayLink.m b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/SDDisplayLink.m new file mode 100644 index 0000000..1dcfd99 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/SDDisplayLink.m @@ -0,0 +1,227 @@ +/* +* This file is part of the SDWebImage package. +* (c) Olivier Poitrey +* +* For the full copyright and license information, please view the LICENSE +* file that was distributed with this source code. +*/ + +#import "SDDisplayLink.h" +#import "SDWeakProxy.h" +#if SD_MAC +#import +#elif SD_IOS || SD_TV +#import +#endif + +#if SD_MAC +static CVReturn DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeStamp *inNow, const CVTimeStamp *inOutputTime, CVOptionFlags flagsIn, CVOptionFlags *flagsOut, void *displayLinkContext); +#endif + +#define kSDDisplayLinkInterval 1.0 / 60 + +@interface SDDisplayLink () + +#if SD_MAC +@property (nonatomic, assign) CVDisplayLinkRef displayLink; +@property (nonatomic, assign) CVTimeStamp outputTime; +@property (nonatomic, copy) NSRunLoopMode runloopMode; +#elif SD_IOS || SD_TV +@property (nonatomic, strong) CADisplayLink *displayLink; +#else +@property (nonatomic, strong) NSTimer *displayLink; +@property (nonatomic, strong) NSRunLoop *runloop; +@property (nonatomic, copy) NSRunLoopMode runloopMode; +@property (nonatomic, assign) NSTimeInterval currentFireDate; +#endif + +@end + +@implementation SDDisplayLink + +- (void)dealloc { +#if SD_MAC + if (_displayLink) { + CVDisplayLinkRelease(_displayLink); + _displayLink = NULL; + } +#elif SD_IOS || SD_TV + [_displayLink invalidate]; + _displayLink = nil; +#else + [_displayLink invalidate]; + _displayLink = nil; +#endif +} + +- (instancetype)initWithTarget:(id)target selector:(SEL)sel { + self = [super init]; + if (self) { + _target = target; + _selector = sel; +#if SD_MAC + CVDisplayLinkCreateWithActiveCGDisplays(&_displayLink); + CVDisplayLinkSetOutputCallback(_displayLink, DisplayLinkCallback, (__bridge void *)self); +#elif SD_IOS || SD_TV + SDWeakProxy *weakProxy = [SDWeakProxy proxyWithTarget:self]; + _displayLink = [CADisplayLink displayLinkWithTarget:weakProxy selector:@selector(displayLinkDidRefresh:)]; +#else + SDWeakProxy *weakProxy = [SDWeakProxy proxyWithTarget:self]; + _displayLink = [NSTimer timerWithTimeInterval:kSDDisplayLinkInterval target:weakProxy selector:@selector(displayLinkDidRefresh:) userInfo:nil repeats:YES]; +#endif + } + return self; +} + ++ (instancetype)displayLinkWithTarget:(id)target selector:(SEL)sel { + SDDisplayLink *displayLink = [[SDDisplayLink alloc] initWithTarget:target selector:sel]; + return displayLink; +} + +- (CFTimeInterval)duration { +#if SD_MAC + CVTimeStamp outputTime = self.outputTime; + NSTimeInterval duration = 0; + double periodPerSecond = (double)outputTime.videoTimeScale * outputTime.rateScalar; + if (periodPerSecond > 0) { + duration = (double)outputTime.videoRefreshPeriod / periodPerSecond; + } +#elif SD_IOS || SD_TV +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + NSTimeInterval duration = 0; + if (@available(iOS 10.0, tvOS 10.0, *)) { + duration = self.displayLink.targetTimestamp - CACurrentMediaTime(); + } else { + duration = self.displayLink.duration * self.displayLink.frameInterval; + } +#pragma clang diagnostic pop +#else + NSTimeInterval duration = 0; + if (self.displayLink.isValid && self.currentFireDate != 0) { + NSTimeInterval nextFireDate = CFRunLoopTimerGetNextFireDate((__bridge CFRunLoopTimerRef)self.displayLink); + duration = nextFireDate - self.currentFireDate; + } +#endif + if (duration <= 0) { + duration = kSDDisplayLinkInterval; + } + return duration; +} + +- (BOOL)isRunning { +#if SD_MAC + return CVDisplayLinkIsRunning(self.displayLink); +#elif SD_IOS || SD_TV + return !self.displayLink.isPaused; +#else + return self.displayLink.isValid; +#endif +} + +- (void)addToRunLoop:(NSRunLoop *)runloop forMode:(NSRunLoopMode)mode { + if (!runloop || !mode) { + return; + } +#if SD_MAC + self.runloopMode = mode; +#elif SD_IOS || SD_TV + [self.displayLink addToRunLoop:runloop forMode:mode]; +#else + self.runloop = runloop; + self.runloopMode = mode; + CFRunLoopMode cfMode; + if ([mode isEqualToString:NSDefaultRunLoopMode]) { + cfMode = kCFRunLoopDefaultMode; + } else if ([mode isEqualToString:NSRunLoopCommonModes]) { + cfMode = kCFRunLoopCommonModes; + } else { + cfMode = (__bridge CFStringRef)mode; + } + CFRunLoopAddTimer(runloop.getCFRunLoop, (__bridge CFRunLoopTimerRef)self.displayLink, cfMode); +#endif +} + +- (void)removeFromRunLoop:(NSRunLoop *)runloop forMode:(NSRunLoopMode)mode { + if (!runloop || !mode) { + return; + } +#if SD_MAC + self.runloopMode = nil; +#elif SD_IOS || SD_TV + [self.displayLink removeFromRunLoop:runloop forMode:mode]; +#else + self.runloop = nil; + self.runloopMode = nil; + CFRunLoopMode cfMode; + if ([mode isEqualToString:NSDefaultRunLoopMode]) { + cfMode = kCFRunLoopDefaultMode; + } else if ([mode isEqualToString:NSRunLoopCommonModes]) { + cfMode = kCFRunLoopCommonModes; + } else { + cfMode = (__bridge CFStringRef)mode; + } + CFRunLoopRemoveTimer(runloop.getCFRunLoop, (__bridge CFRunLoopTimerRef)self.displayLink, cfMode); +#endif +} + +- (void)start { +#if SD_MAC + CVDisplayLinkStart(self.displayLink); +#elif SD_IOS || SD_TV + self.displayLink.paused = NO; +#else + if (self.displayLink.isValid) { + [self.displayLink fire]; + } else { + SDWeakProxy *weakProxy = [SDWeakProxy proxyWithTarget:self]; + self.displayLink = [NSTimer timerWithTimeInterval:kSDDisplayLinkInterval target:weakProxy selector:@selector(displayLinkDidRefresh:) userInfo:nil repeats:YES]; + [self addToRunLoop:self.runloop forMode:self.runloopMode]; + } +#endif +} + +- (void)stop { +#if SD_MAC + CVDisplayLinkStop(self.displayLink); +#elif SD_IOS || SD_TV + self.displayLink.paused = YES; +#else + [self.displayLink invalidate]; +#endif +} + +- (void)displayLinkDidRefresh:(id)displayLink { +#if SD_MAC + // CVDisplayLink does not use runloop, but we can provide similar behavior for modes + // May use `default` runloop to avoid extra callback when in `eventTracking` (mouse drag, scroll) or `modalPanel` (modal panel) + NSString *runloopMode = self.runloopMode; + if (![runloopMode isEqualToString:NSRunLoopCommonModes] && ![runloopMode isEqualToString:NSRunLoop.mainRunLoop.currentMode]) { + return; + } +#endif +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Warc-performSelector-leaks" + [_target performSelector:_selector withObject:self]; +#pragma clang diagnostic pop +#if SD_WATCH + self.currentFireDate = CFRunLoopTimerGetNextFireDate((__bridge CFRunLoopTimerRef)self.displayLink); +#endif +} + +@end + +#if SD_MAC +static CVReturn DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeStamp *inNow, const CVTimeStamp *inOutputTime, CVOptionFlags flagsIn, CVOptionFlags *flagsOut, void *displayLinkContext) { + // CVDisplayLink callback is not on main queue + SDDisplayLink *object = (__bridge SDDisplayLink *)displayLinkContext; + if (inOutputTime) { + object.outputTime = *inOutputTime; + } + __weak SDDisplayLink *weakObject = object; + dispatch_async(dispatch_get_main_queue(), ^{ + [weakObject displayLinkDidRefresh:(__bridge id)(displayLink)]; + }); + return kCVReturnSuccess; +} +#endif diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/SDFileAttributeHelper.h b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/SDFileAttributeHelper.h new file mode 100644 index 0000000..3ce6bad --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/SDFileAttributeHelper.h @@ -0,0 +1,19 @@ +// +// This file is from https://gist.github.com/zydeco/6292773 +// +// Created by Jesús A. Álvarez on 2008-12-17. +// Copyright 2008-2009 namedfork.net. All rights reserved. +// + +#import + +/// File Extended Attribute (xattr) helper methods +@interface SDFileAttributeHelper : NSObject + ++ (nullable NSArray *)extendedAttributeNamesAtPath:(nonnull NSString *)path traverseLink:(BOOL)follow error:(NSError * _Nullable * _Nullable)err; ++ (BOOL)hasExtendedAttribute:(nonnull NSString *)name atPath:(nonnull NSString *)path traverseLink:(BOOL)follow error:(NSError * _Nullable * _Nullable)err; ++ (nullable NSData *)extendedAttribute:(nonnull NSString *)name atPath:(nonnull NSString *)path traverseLink:(BOOL)follow error:(NSError * _Nullable * _Nullable)err; ++ (BOOL)setExtendedAttribute:(nonnull NSString *)name value:(nonnull NSData *)value atPath:(nonnull NSString *)path traverseLink:(BOOL)follow overwrite:(BOOL)overwrite error:(NSError * _Nullable * _Nullable)err; ++ (BOOL)removeExtendedAttribute:(nonnull NSString *)name atPath:(nonnull NSString *)path traverseLink:(BOOL)follow error:(NSError * _Nullable * _Nullable)err; + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/SDFileAttributeHelper.m b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/SDFileAttributeHelper.m new file mode 100644 index 0000000..5122089 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/SDFileAttributeHelper.m @@ -0,0 +1,127 @@ +// +// This file is from https://gist.github.com/zydeco/6292773 +// +// Created by Jesús A. Álvarez on 2008-12-17. +// Copyright 2008-2009 namedfork.net. All rights reserved. +// + +#import "SDFileAttributeHelper.h" +#import + +@implementation SDFileAttributeHelper + ++ (NSArray*)extendedAttributeNamesAtPath:(NSString *)path traverseLink:(BOOL)follow error:(NSError **)err { + int flags = follow? 0 : XATTR_NOFOLLOW; + + // get size of name list + ssize_t nameBuffLen = listxattr([path fileSystemRepresentation], NULL, 0, flags); + if (nameBuffLen == -1) { + if (err) *err = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo: + @{ + @"error": [NSString stringWithUTF8String:strerror(errno)], + @"function": @"listxattr", + @":path": path, + @":traverseLink": @(follow) + } + ]; + return nil; + } else if (nameBuffLen == 0) return @[]; + + // get name list + NSMutableData *nameBuff = [NSMutableData dataWithLength:nameBuffLen]; + listxattr([path fileSystemRepresentation], [nameBuff mutableBytes], nameBuffLen, flags); + + // convert to array + NSMutableArray * names = [NSMutableArray arrayWithCapacity:5]; + char *nextName, *endOfNames = [nameBuff mutableBytes] + nameBuffLen; + for(nextName = [nameBuff mutableBytes]; nextName < endOfNames; nextName += 1+strlen(nextName)) + [names addObject:[NSString stringWithUTF8String:nextName]]; + return names.copy; +} + ++ (BOOL)hasExtendedAttribute:(NSString *)name atPath:(NSString *)path traverseLink:(BOOL)follow error:(NSError **)err { + int flags = follow? 0 : XATTR_NOFOLLOW; + + // get size of name list + ssize_t nameBuffLen = listxattr([path fileSystemRepresentation], NULL, 0, flags); + if (nameBuffLen == -1) { + if (err) *err = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo: + @{ + @"error": [NSString stringWithUTF8String:strerror(errno)], + @"function": @"listxattr", + @":path": path, + @":traverseLink": @(follow) + } + ]; + return NO; + } else if (nameBuffLen == 0) return NO; + + // get name list + NSMutableData *nameBuff = [NSMutableData dataWithLength:nameBuffLen]; + listxattr([path fileSystemRepresentation], [nameBuff mutableBytes], nameBuffLen, flags); + + // find our name + char *nextName, *endOfNames = [nameBuff mutableBytes] + nameBuffLen; + for(nextName = [nameBuff mutableBytes]; nextName < endOfNames; nextName += 1+strlen(nextName)) + if (strcmp(nextName, [name UTF8String]) == 0) return YES; + return NO; +} + ++ (NSData *)extendedAttribute:(NSString *)name atPath:(NSString *)path traverseLink:(BOOL)follow error:(NSError **)err { + int flags = follow? 0 : XATTR_NOFOLLOW; + // get length + ssize_t attrLen = getxattr([path fileSystemRepresentation], [name UTF8String], NULL, 0, 0, flags); + if (attrLen == -1) { + if (err) *err = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo: + @{ + @"error": [NSString stringWithUTF8String:strerror(errno)], + @"function": @"getxattr", + @":name": name, + @":path": path, + @":traverseLink": @(follow) + } + ]; + return nil; + } + + // get attribute data + NSMutableData *attrData = [NSMutableData dataWithLength:attrLen]; + getxattr([path fileSystemRepresentation], [name UTF8String], [attrData mutableBytes], attrLen, 0, flags); + return attrData; +} + ++ (BOOL)setExtendedAttribute:(NSString *)name value:(NSData *)value atPath:(NSString *)path traverseLink:(BOOL)follow overwrite:(BOOL)overwrite error:(NSError **)err { + int flags = (follow? 0 : XATTR_NOFOLLOW) | (overwrite? 0 : XATTR_CREATE); + if (0 == setxattr([path fileSystemRepresentation], [name UTF8String], [value bytes], [value length], 0, flags)) return YES; + // error + if (err) *err = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo: + @{ + @"error": [NSString stringWithUTF8String:strerror(errno)], + @"function": @"setxattr", + @":name": name, + @":value.length": @(value.length), + @":path": path, + @":traverseLink": @(follow), + @":overwrite": @(overwrite) + } + ]; + return NO; +} + ++ (BOOL)removeExtendedAttribute:(NSString *)name atPath:(NSString *)path traverseLink:(BOOL)follow error:(NSError **)err { + int flags = (follow? 0 : XATTR_NOFOLLOW); + if (0 == removexattr([path fileSystemRepresentation], [name UTF8String], flags)) return YES; + // error + if (err) *err = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo: + @{ + @"error": [NSString stringWithUTF8String:strerror(errno)], + @"function": @"removexattr", + @":name": name, + @":path": path, + @":traverseLink": @(follow) + } + ]; + return NO; +} + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/SDImageAssetManager.h b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/SDImageAssetManager.h new file mode 100644 index 0000000..88dee48 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/SDImageAssetManager.h @@ -0,0 +1,23 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import +#import "SDWebImageCompat.h" + +/// A Image-Asset manager to work like UIKit/AppKit's image cache behavior +/// Apple parse the Asset Catalog compiled file(`Assets.car`) by CoreUI.framework, however it's a private framework and there are no other ways to directly get the data. So we just process the normal bundle files :) +@interface SDImageAssetManager : NSObject + +@property (nonatomic, strong, nonnull) NSMapTable *imageTable; + ++ (nonnull instancetype)sharedAssetManager; +- (nullable NSString *)getPathForName:(nonnull NSString *)name bundle:(nonnull NSBundle *)bundle preferredScale:(nonnull CGFloat *)scale; +- (nullable UIImage *)imageForName:(nonnull NSString *)name; +- (void)storeImage:(nonnull UIImage *)image forName:(nonnull NSString *)name; + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/SDImageAssetManager.m b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/SDImageAssetManager.m new file mode 100644 index 0000000..7bca347 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/SDImageAssetManager.m @@ -0,0 +1,164 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDImageAssetManager.h" +#import "SDInternalMacros.h" + +static NSArray *SDBundlePreferredScales() { + static NSArray *scales; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ +#if SD_WATCH + CGFloat screenScale = [WKInterfaceDevice currentDevice].screenScale; +#elif SD_UIKIT + CGFloat screenScale = [UIScreen mainScreen].scale; +#elif SD_MAC + NSScreen *mainScreen = nil; + if (@available(macOS 10.12, *)) { + mainScreen = [NSScreen mainScreen]; + } else { + mainScreen = [NSScreen screens].firstObject; + } + CGFloat screenScale = mainScreen.backingScaleFactor ?: 1.0f; +#endif + if (screenScale <= 1) { + scales = @[@1,@2,@3]; + } else if (screenScale <= 2) { + scales = @[@2,@3,@1]; + } else { + scales = @[@3,@2,@1]; + } + }); + return scales; +} + +@implementation SDImageAssetManager { + SD_LOCK_DECLARE(_lock); +} + ++ (instancetype)sharedAssetManager { + static dispatch_once_t onceToken; + static SDImageAssetManager *assetManager; + dispatch_once(&onceToken, ^{ + assetManager = [[SDImageAssetManager alloc] init]; + }); + return assetManager; +} + +- (instancetype)init { + self = [super init]; + if (self) { + NSPointerFunctionsOptions valueOptions; +#if SD_MAC + // Apple says that NSImage use a weak reference to value + valueOptions = NSPointerFunctionsWeakMemory; +#else + // Apple says that UIImage use a strong reference to value + valueOptions = NSPointerFunctionsStrongMemory; +#endif + _imageTable = [NSMapTable mapTableWithKeyOptions:NSPointerFunctionsCopyIn valueOptions:valueOptions]; + SD_LOCK_INIT(_lock); +#if SD_UIKIT + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didReceiveMemoryWarning:) name:UIApplicationDidReceiveMemoryWarningNotification object:nil]; +#endif + } + return self; +} + +- (void)dealloc { +#if SD_UIKIT + [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidReceiveMemoryWarningNotification object:nil]; +#endif +} + +- (void)didReceiveMemoryWarning:(NSNotification *)notification { + SD_LOCK(_lock); + [self.imageTable removeAllObjects]; + SD_UNLOCK(_lock); +} + +- (NSString *)getPathForName:(NSString *)name bundle:(NSBundle *)bundle preferredScale:(CGFloat *)scale { + NSParameterAssert(name); + NSParameterAssert(bundle); + NSString *path; + if (name.length == 0) { + return path; + } + if ([name hasSuffix:@"/"]) { + return path; + } + NSString *extension = name.pathExtension; + if (extension.length == 0) { + // If no extension, follow Apple's doc, check PNG format + extension = @"png"; + } + name = [name stringByDeletingPathExtension]; + + CGFloat providedScale = *scale; + NSArray *scales = SDBundlePreferredScales(); + + // Check if file name contains scale + for (size_t i = 0; i < scales.count; i++) { + NSNumber *scaleValue = scales[i]; + if ([name hasSuffix:[NSString stringWithFormat:@"@%@x", scaleValue]]) { + path = [bundle pathForResource:name ofType:extension]; + if (path) { + *scale = scaleValue.doubleValue; // override + return path; + } + } + } + + // Search with provided scale first + if (providedScale != 0) { + NSString *scaledName = [name stringByAppendingFormat:@"@%@x", @(providedScale)]; + path = [bundle pathForResource:scaledName ofType:extension]; + if (path) { + return path; + } + } + + // Search with preferred scale + for (size_t i = 0; i < scales.count; i++) { + NSNumber *scaleValue = scales[i]; + if (scaleValue.doubleValue == providedScale) { + // Ignore provided scale + continue; + } + NSString *scaledName = [name stringByAppendingFormat:@"@%@x", scaleValue]; + path = [bundle pathForResource:scaledName ofType:extension]; + if (path) { + *scale = scaleValue.doubleValue; // override + return path; + } + } + + // Search without scale + path = [bundle pathForResource:name ofType:extension]; + + return path; +} + +- (UIImage *)imageForName:(NSString *)name { + NSParameterAssert(name); + UIImage *image; + SD_LOCK(_lock); + image = [self.imageTable objectForKey:name]; + SD_UNLOCK(_lock); + return image; +} + +- (void)storeImage:(UIImage *)image forName:(NSString *)name { + NSParameterAssert(image); + NSParameterAssert(name); + SD_LOCK(_lock); + [self.imageTable setObject:image forKey:name]; + SD_UNLOCK(_lock); +} + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/SDImageCachesManagerOperation.h b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/SDImageCachesManagerOperation.h new file mode 100644 index 0000000..0debe6c --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/SDImageCachesManagerOperation.h @@ -0,0 +1,21 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import +#import "SDWebImageCompat.h" + +/// This is used for operation management, but not for operation queue execute +@interface SDImageCachesManagerOperation : NSOperation + +@property (nonatomic, assign, readonly) NSUInteger pendingCount; + +- (void)beginWithTotalCount:(NSUInteger)totalCount; +- (void)completeOne; +- (void)done; + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/SDImageCachesManagerOperation.m b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/SDImageCachesManagerOperation.m new file mode 100644 index 0000000..1313b68 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/SDImageCachesManagerOperation.m @@ -0,0 +1,83 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDImageCachesManagerOperation.h" +#import "SDInternalMacros.h" + +@implementation SDImageCachesManagerOperation { + SD_LOCK_DECLARE(_pendingCountLock); +} + +@synthesize executing = _executing; +@synthesize finished = _finished; +@synthesize cancelled = _cancelled; +@synthesize pendingCount = _pendingCount; + +- (instancetype)init { + if (self = [super init]) { + SD_LOCK_INIT(_pendingCountLock); + _pendingCount = 0; + } + return self; +} + +- (void)beginWithTotalCount:(NSUInteger)totalCount { + self.executing = YES; + self.finished = NO; + _pendingCount = totalCount; +} + +- (NSUInteger)pendingCount { + SD_LOCK(_pendingCountLock); + NSUInteger pendingCount = _pendingCount; + SD_UNLOCK(_pendingCountLock); + return pendingCount; +} + +- (void)completeOne { + SD_LOCK(_pendingCountLock); + _pendingCount = _pendingCount > 0 ? _pendingCount - 1 : 0; + SD_UNLOCK(_pendingCountLock); +} + +- (void)cancel { + self.cancelled = YES; + [self reset]; +} + +- (void)done { + self.finished = YES; + self.executing = NO; + [self reset]; +} + +- (void)reset { + SD_LOCK(_pendingCountLock); + _pendingCount = 0; + SD_UNLOCK(_pendingCountLock); +} + +- (void)setFinished:(BOOL)finished { + [self willChangeValueForKey:@"isFinished"]; + _finished = finished; + [self didChangeValueForKey:@"isFinished"]; +} + +- (void)setExecuting:(BOOL)executing { + [self willChangeValueForKey:@"isExecuting"]; + _executing = executing; + [self didChangeValueForKey:@"isExecuting"]; +} + +- (void)setCancelled:(BOOL)cancelled { + [self willChangeValueForKey:@"isCancelled"]; + _cancelled = cancelled; + [self didChangeValueForKey:@"isCancelled"]; +} + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/SDImageIOAnimatedCoderInternal.h b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/SDImageIOAnimatedCoderInternal.h new file mode 100644 index 0000000..f74be7e --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/SDImageIOAnimatedCoderInternal.h @@ -0,0 +1,36 @@ +/* +* This file is part of the SDWebImage package. +* (c) Olivier Poitrey +* +* For the full copyright and license information, please view the LICENSE +* file that was distributed with this source code. +*/ + +#import +#import "SDImageIOAnimatedCoder.h" + +// AVFileTypeHEIC/AVFileTypeHEIF is defined in AVFoundation via iOS 11, we use this without import AVFoundation +#define kSDUTTypeHEIC ((__bridge CFStringRef)@"public.heic") +#define kSDUTTypeHEIF ((__bridge CFStringRef)@"public.heif") +// HEIC Sequence (Animated Image) +#define kSDUTTypeHEICS ((__bridge CFStringRef)@"public.heics") +// kSDUTTypeWebP seems not defined in public UTI framework, Apple use the hardcode string, we define them :) +#define kSDUTTypeWebP ((__bridge CFStringRef)@"org.webmproject.webp") + +#define kSDUTTypeImage ((__bridge CFStringRef)@"public.image") +#define kSDUTTypeJPEG ((__bridge CFStringRef)@"public.jpeg") +#define kSDUTTypePNG ((__bridge CFStringRef)@"public.png") +#define kSDUTTypeTIFF ((__bridge CFStringRef)@"public.tiff") +#define kSDUTTypeSVG ((__bridge CFStringRef)@"public.svg-image") +#define kSDUTTypeGIF ((__bridge CFStringRef)@"com.compuserve.gif") +#define kSDUTTypePDF ((__bridge CFStringRef)@"com.adobe.pdf") + +@interface SDImageIOAnimatedCoder () + ++ (NSTimeInterval)frameDurationAtIndex:(NSUInteger)index source:(nonnull CGImageSourceRef)source; ++ (NSUInteger)imageLoopCountWithSource:(nonnull CGImageSourceRef)source; ++ (nullable UIImage *)createFrameAtIndex:(NSUInteger)index source:(nonnull CGImageSourceRef)source scale:(CGFloat)scale preserveAspectRatio:(BOOL)preserveAspectRatio thumbnailSize:(CGSize)thumbnailSize options:(nullable NSDictionary *)options; ++ (BOOL)canEncodeToFormat:(SDImageFormat)format; ++ (BOOL)canDecodeFromFormat:(SDImageFormat)format; + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/SDInternalMacros.h b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/SDInternalMacros.h new file mode 100644 index 0000000..dfff558 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/SDInternalMacros.h @@ -0,0 +1,122 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import +#import +#import +#import "SDmetamacros.h" + +#define SD_USE_OS_UNFAIR_LOCK TARGET_OS_MACCATALYST ||\ + (__IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_10_0) ||\ + (__MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_12) ||\ + (__TV_OS_VERSION_MIN_REQUIRED >= __TVOS_10_0) ||\ + (__WATCH_OS_VERSION_MIN_REQUIRED >= __WATCHOS_3_0) + +#ifndef SD_LOCK_DECLARE +#if SD_USE_OS_UNFAIR_LOCK +#define SD_LOCK_DECLARE(lock) os_unfair_lock lock +#else +#define SD_LOCK_DECLARE(lock) os_unfair_lock lock API_AVAILABLE(ios(10.0), tvos(10), watchos(3), macos(10.12)); \ +OSSpinLock lock##_deprecated; +#endif +#endif + +#ifndef SD_LOCK_DECLARE_STATIC +#if SD_USE_OS_UNFAIR_LOCK +#define SD_LOCK_DECLARE_STATIC(lock) static os_unfair_lock lock +#else +#define SD_LOCK_DECLARE_STATIC(lock) static os_unfair_lock lock API_AVAILABLE(ios(10.0), tvos(10), watchos(3), macos(10.12)); \ +static OSSpinLock lock##_deprecated; +#endif +#endif + +#ifndef SD_LOCK_INIT +#if SD_USE_OS_UNFAIR_LOCK +#define SD_LOCK_INIT(lock) lock = OS_UNFAIR_LOCK_INIT +#else +#define SD_LOCK_INIT(lock) if (@available(iOS 10, tvOS 10, watchOS 3, macOS 10.12, *)) lock = OS_UNFAIR_LOCK_INIT; \ +else lock##_deprecated = OS_SPINLOCK_INIT; +#endif +#endif + +#ifndef SD_LOCK +#if SD_USE_OS_UNFAIR_LOCK +#define SD_LOCK(lock) os_unfair_lock_lock(&lock) +#else +#define SD_LOCK(lock) if (@available(iOS 10, tvOS 10, watchOS 3, macOS 10.12, *)) os_unfair_lock_lock(&lock); \ +else OSSpinLockLock(&lock##_deprecated); +#endif +#endif + +#ifndef SD_UNLOCK +#if SD_USE_OS_UNFAIR_LOCK +#define SD_UNLOCK(lock) os_unfair_lock_unlock(&lock) +#else +#define SD_UNLOCK(lock) if (@available(iOS 10, tvOS 10, watchOS 3, macOS 10.12, *)) os_unfair_lock_unlock(&lock); \ +else OSSpinLockUnlock(&lock##_deprecated); +#endif +#endif + +#ifndef SD_OPTIONS_CONTAINS +#define SD_OPTIONS_CONTAINS(options, value) (((options) & (value)) == (value)) +#endif + +#ifndef SD_CSTRING +#define SD_CSTRING(str) #str +#endif + +#ifndef SD_NSSTRING +#define SD_NSSTRING(str) @(SD_CSTRING(str)) +#endif + +#ifndef SD_SEL_SPI +#define SD_SEL_SPI(name) NSSelectorFromString([NSString stringWithFormat:@"_%@", SD_NSSTRING(name)]) +#endif + +#ifndef weakify +#define weakify(...) \ +sd_keywordify \ +metamacro_foreach_cxt(sd_weakify_,, __weak, __VA_ARGS__) +#endif + +#ifndef strongify +#define strongify(...) \ +sd_keywordify \ +_Pragma("clang diagnostic push") \ +_Pragma("clang diagnostic ignored \"-Wshadow\"") \ +metamacro_foreach(sd_strongify_,, __VA_ARGS__) \ +_Pragma("clang diagnostic pop") +#endif + +#define sd_weakify_(INDEX, CONTEXT, VAR) \ +CONTEXT __typeof__(VAR) metamacro_concat(VAR, _weak_) = (VAR); + +#define sd_strongify_(INDEX, VAR) \ +__strong __typeof__(VAR) VAR = metamacro_concat(VAR, _weak_); + +#if DEBUG +#define sd_keywordify autoreleasepool {} +#else +#define sd_keywordify try {} @catch (...) {} +#endif + +#ifndef onExit +#define onExit \ +sd_keywordify \ +__strong sd_cleanupBlock_t metamacro_concat(sd_exitBlock_, __LINE__) __attribute__((cleanup(sd_executeCleanupBlock), unused)) = ^ +#endif + +typedef void (^sd_cleanupBlock_t)(void); + +#if defined(__cplusplus) +extern "C" { +#endif + void sd_executeCleanupBlock (__strong sd_cleanupBlock_t *block); +#if defined(__cplusplus) +} +#endif diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/SDInternalMacros.m b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/SDInternalMacros.m new file mode 100644 index 0000000..e4981af --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/SDInternalMacros.m @@ -0,0 +1,13 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDInternalMacros.h" + +void sd_executeCleanupBlock (__strong sd_cleanupBlock_t *block) { + (*block)(); +} diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/SDWeakProxy.h b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/SDWeakProxy.h new file mode 100644 index 0000000..d92c682 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/SDWeakProxy.h @@ -0,0 +1,20 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import +#import "SDWebImageCompat.h" + +/// A weak proxy which forward all the message to the target +@interface SDWeakProxy : NSProxy + +@property (nonatomic, weak, readonly, nullable) id target; + +- (nonnull instancetype)initWithTarget:(nonnull id)target; ++ (nonnull instancetype)proxyWithTarget:(nonnull id)target; + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/SDWeakProxy.m b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/SDWeakProxy.m new file mode 100644 index 0000000..19a4593 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/SDWeakProxy.m @@ -0,0 +1,79 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWeakProxy.h" + +@implementation SDWeakProxy + +- (instancetype)initWithTarget:(id)target { + _target = target; + return self; +} + ++ (instancetype)proxyWithTarget:(id)target { + return [[SDWeakProxy alloc] initWithTarget:target]; +} + +- (id)forwardingTargetForSelector:(SEL)selector { + return _target; +} + +- (void)forwardInvocation:(NSInvocation *)invocation { + void *null = NULL; + [invocation setReturnValue:&null]; +} + +- (NSMethodSignature *)methodSignatureForSelector:(SEL)selector { + return [NSObject instanceMethodSignatureForSelector:@selector(init)]; +} + +- (BOOL)respondsToSelector:(SEL)aSelector { + return [_target respondsToSelector:aSelector]; +} + +- (BOOL)isEqual:(id)object { + return [_target isEqual:object]; +} + +- (NSUInteger)hash { + return [_target hash]; +} + +- (Class)superclass { + return [_target superclass]; +} + +- (Class)class { + return [_target class]; +} + +- (BOOL)isKindOfClass:(Class)aClass { + return [_target isKindOfClass:aClass]; +} + +- (BOOL)isMemberOfClass:(Class)aClass { + return [_target isMemberOfClass:aClass]; +} + +- (BOOL)conformsToProtocol:(Protocol *)aProtocol { + return [_target conformsToProtocol:aProtocol]; +} + +- (BOOL)isProxy { + return YES; +} + +- (NSString *)description { + return [_target description]; +} + +- (NSString *)debugDescription { + return [_target debugDescription]; +} + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/SDWebImageTransitionInternal.h b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/SDWebImageTransitionInternal.h new file mode 100644 index 0000000..1b70649 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/SDWebImageTransitionInternal.h @@ -0,0 +1,19 @@ +/* +* This file is part of the SDWebImage package. +* (c) Olivier Poitrey +* +* For the full copyright and license information, please view the LICENSE +* file that was distributed with this source code. +*/ + +#import "SDWebImageCompat.h" + +#if SD_MAC + +#import + +/// Helper method for Core Animation transition +FOUNDATION_EXPORT CAMediaTimingFunction * _Nullable SDTimingFunctionFromAnimationOptions(SDWebImageAnimationOptions options); +FOUNDATION_EXPORT CATransition * _Nullable SDTransitionFromAnimationOptions(SDWebImageAnimationOptions options); + +#endif diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/SDmetamacros.h b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/SDmetamacros.h new file mode 100644 index 0000000..dd90d99 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/SDmetamacros.h @@ -0,0 +1,667 @@ +/** + * Macros for metaprogramming + * ExtendedC + * + * Copyright (C) 2012 Justin Spahr-Summers + * Released under the MIT license + */ + +#ifndef EXTC_METAMACROS_H +#define EXTC_METAMACROS_H + + +/** + * Executes one or more expressions (which may have a void type, such as a call + * to a function that returns no value) and always returns true. + */ +#define metamacro_exprify(...) \ + ((__VA_ARGS__), true) + +/** + * Returns a string representation of VALUE after full macro expansion. + */ +#define metamacro_stringify(VALUE) \ + metamacro_stringify_(VALUE) + +/** + * Returns A and B concatenated after full macro expansion. + */ +#define metamacro_concat(A, B) \ + metamacro_concat_(A, B) + +/** + * Returns the Nth variadic argument (starting from zero). At least + * N + 1 variadic arguments must be given. N must be between zero and twenty, + * inclusive. + */ +#define metamacro_at(N, ...) \ + metamacro_concat(metamacro_at, N)(__VA_ARGS__) + +/** + * Returns the number of arguments (up to twenty) provided to the macro. At + * least one argument must be provided. + * + * Inspired by P99: http://p99.gforge.inria.fr + */ +#define metamacro_argcount(...) \ + metamacro_at(20, __VA_ARGS__, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1) + +/** + * Identical to #metamacro_foreach_cxt, except that no CONTEXT argument is + * given. Only the index and current argument will thus be passed to MACRO. + */ +#define metamacro_foreach(MACRO, SEP, ...) \ + metamacro_foreach_cxt(metamacro_foreach_iter, SEP, MACRO, __VA_ARGS__) + +/** + * For each consecutive variadic argument (up to twenty), MACRO is passed the + * zero-based index of the current argument, CONTEXT, and then the argument + * itself. The results of adjoining invocations of MACRO are then separated by + * SEP. + * + * Inspired by P99: http://p99.gforge.inria.fr + */ +#define metamacro_foreach_cxt(MACRO, SEP, CONTEXT, ...) \ + metamacro_concat(metamacro_foreach_cxt, metamacro_argcount(__VA_ARGS__))(MACRO, SEP, CONTEXT, __VA_ARGS__) + +/** + * Identical to #metamacro_foreach_cxt. This can be used when the former would + * fail due to recursive macro expansion. + */ +#define metamacro_foreach_cxt_recursive(MACRO, SEP, CONTEXT, ...) \ + metamacro_concat(metamacro_foreach_cxt_recursive, metamacro_argcount(__VA_ARGS__))(MACRO, SEP, CONTEXT, __VA_ARGS__) + +/** + * In consecutive order, appends each variadic argument (up to twenty) onto + * BASE. The resulting concatenations are then separated by SEP. + * + * This is primarily useful to manipulate a list of macro invocations into instead + * invoking a different, possibly related macro. + */ +#define metamacro_foreach_concat(BASE, SEP, ...) \ + metamacro_foreach_cxt(metamacro_foreach_concat_iter, SEP, BASE, __VA_ARGS__) + +/** + * Iterates COUNT times, each time invoking MACRO with the current index + * (starting at zero) and CONTEXT. The results of adjoining invocations of MACRO + * are then separated by SEP. + * + * COUNT must be an integer between zero and twenty, inclusive. + */ +#define metamacro_for_cxt(COUNT, MACRO, SEP, CONTEXT) \ + metamacro_concat(metamacro_for_cxt, COUNT)(MACRO, SEP, CONTEXT) + +/** + * Returns the first argument given. At least one argument must be provided. + * + * This is useful when implementing a variadic macro, where you may have only + * one variadic argument, but no way to retrieve it (for example, because \c ... + * always needs to match at least one argument). + * + * @code + +#define varmacro(...) \ + metamacro_head(__VA_ARGS__) + + * @endcode + */ +#define metamacro_head(...) \ + metamacro_head_(__VA_ARGS__, 0) + +/** + * Returns every argument except the first. At least two arguments must be + * provided. + */ +#define metamacro_tail(...) \ + metamacro_tail_(__VA_ARGS__) + +/** + * Returns the first N (up to twenty) variadic arguments as a new argument list. + * At least N variadic arguments must be provided. + */ +#define metamacro_take(N, ...) \ + metamacro_concat(metamacro_take, N)(__VA_ARGS__) + +/** + * Removes the first N (up to twenty) variadic arguments from the given argument + * list. At least N variadic arguments must be provided. + */ +#define metamacro_drop(N, ...) \ + metamacro_concat(metamacro_drop, N)(__VA_ARGS__) + +/** + * Decrements VAL, which must be a number between zero and twenty, inclusive. + * + * This is primarily useful when dealing with indexes and counts in + * metaprogramming. + */ +#define metamacro_dec(VAL) \ + metamacro_at(VAL, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19) + +/** + * Increments VAL, which must be a number between zero and twenty, inclusive. + * + * This is primarily useful when dealing with indexes and counts in + * metaprogramming. + */ +#define metamacro_inc(VAL) \ + metamacro_at(VAL, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21) + +/** + * If A is equal to B, the next argument list is expanded; otherwise, the + * argument list after that is expanded. A and B must be numbers between zero + * and twenty, inclusive. Additionally, B must be greater than or equal to A. + * + * @code + +// expands to true +metamacro_if_eq(0, 0)(true)(false) + +// expands to false +metamacro_if_eq(0, 1)(true)(false) + + * @endcode + * + * This is primarily useful when dealing with indexes and counts in + * metaprogramming. + */ +#define metamacro_if_eq(A, B) \ + metamacro_concat(metamacro_if_eq, A)(B) + +/** + * Identical to #metamacro_if_eq. This can be used when the former would fail + * due to recursive macro expansion. + */ +#define metamacro_if_eq_recursive(A, B) \ + metamacro_concat(metamacro_if_eq_recursive, A)(B) + +/** + * Returns 1 if N is an even number, or 0 otherwise. N must be between zero and + * twenty, inclusive. + * + * For the purposes of this test, zero is considered even. + */ +#define metamacro_is_even(N) \ + metamacro_at(N, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1) + +/** + * Returns the logical NOT of B, which must be the number zero or one. + */ +#define metamacro_not(B) \ + metamacro_at(B, 1, 0) + +// IMPLEMENTATION DETAILS FOLLOW! +// Do not write code that depends on anything below this line. +#define metamacro_stringify_(VALUE) # VALUE +#define metamacro_concat_(A, B) A ## B +#define metamacro_foreach_iter(INDEX, MACRO, ARG) MACRO(INDEX, ARG) +#define metamacro_head_(FIRST, ...) FIRST +#define metamacro_tail_(FIRST, ...) __VA_ARGS__ +#define metamacro_consume_(...) +#define metamacro_expand_(...) __VA_ARGS__ + +// implemented from scratch so that metamacro_concat() doesn't end up nesting +#define metamacro_foreach_concat_iter(INDEX, BASE, ARG) metamacro_foreach_concat_iter_(BASE, ARG) +#define metamacro_foreach_concat_iter_(BASE, ARG) BASE ## ARG + +// metamacro_at expansions +#define metamacro_at0(...) metamacro_head(__VA_ARGS__) +#define metamacro_at1(_0, ...) metamacro_head(__VA_ARGS__) +#define metamacro_at2(_0, _1, ...) metamacro_head(__VA_ARGS__) +#define metamacro_at3(_0, _1, _2, ...) metamacro_head(__VA_ARGS__) +#define metamacro_at4(_0, _1, _2, _3, ...) metamacro_head(__VA_ARGS__) +#define metamacro_at5(_0, _1, _2, _3, _4, ...) metamacro_head(__VA_ARGS__) +#define metamacro_at6(_0, _1, _2, _3, _4, _5, ...) metamacro_head(__VA_ARGS__) +#define metamacro_at7(_0, _1, _2, _3, _4, _5, _6, ...) metamacro_head(__VA_ARGS__) +#define metamacro_at8(_0, _1, _2, _3, _4, _5, _6, _7, ...) metamacro_head(__VA_ARGS__) +#define metamacro_at9(_0, _1, _2, _3, _4, _5, _6, _7, _8, ...) metamacro_head(__VA_ARGS__) +#define metamacro_at10(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, ...) metamacro_head(__VA_ARGS__) +#define metamacro_at11(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, ...) metamacro_head(__VA_ARGS__) +#define metamacro_at12(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, ...) metamacro_head(__VA_ARGS__) +#define metamacro_at13(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, ...) metamacro_head(__VA_ARGS__) +#define metamacro_at14(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, ...) metamacro_head(__VA_ARGS__) +#define metamacro_at15(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, ...) metamacro_head(__VA_ARGS__) +#define metamacro_at16(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, ...) metamacro_head(__VA_ARGS__) +#define metamacro_at17(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, ...) metamacro_head(__VA_ARGS__) +#define metamacro_at18(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, ...) metamacro_head(__VA_ARGS__) +#define metamacro_at19(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, ...) metamacro_head(__VA_ARGS__) +#define metamacro_at20(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, ...) metamacro_head(__VA_ARGS__) + +// metamacro_foreach_cxt expansions +#define metamacro_foreach_cxt0(MACRO, SEP, CONTEXT) +#define metamacro_foreach_cxt1(MACRO, SEP, CONTEXT, _0) MACRO(0, CONTEXT, _0) + +#define metamacro_foreach_cxt2(MACRO, SEP, CONTEXT, _0, _1) \ + metamacro_foreach_cxt1(MACRO, SEP, CONTEXT, _0) \ + SEP \ + MACRO(1, CONTEXT, _1) + +#define metamacro_foreach_cxt3(MACRO, SEP, CONTEXT, _0, _1, _2) \ + metamacro_foreach_cxt2(MACRO, SEP, CONTEXT, _0, _1) \ + SEP \ + MACRO(2, CONTEXT, _2) + +#define metamacro_foreach_cxt4(MACRO, SEP, CONTEXT, _0, _1, _2, _3) \ + metamacro_foreach_cxt3(MACRO, SEP, CONTEXT, _0, _1, _2) \ + SEP \ + MACRO(3, CONTEXT, _3) + +#define metamacro_foreach_cxt5(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4) \ + metamacro_foreach_cxt4(MACRO, SEP, CONTEXT, _0, _1, _2, _3) \ + SEP \ + MACRO(4, CONTEXT, _4) + +#define metamacro_foreach_cxt6(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5) \ + metamacro_foreach_cxt5(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4) \ + SEP \ + MACRO(5, CONTEXT, _5) + +#define metamacro_foreach_cxt7(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6) \ + metamacro_foreach_cxt6(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5) \ + SEP \ + MACRO(6, CONTEXT, _6) + +#define metamacro_foreach_cxt8(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7) \ + metamacro_foreach_cxt7(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6) \ + SEP \ + MACRO(7, CONTEXT, _7) + +#define metamacro_foreach_cxt9(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8) \ + metamacro_foreach_cxt8(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7) \ + SEP \ + MACRO(8, CONTEXT, _8) + +#define metamacro_foreach_cxt10(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9) \ + metamacro_foreach_cxt9(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8) \ + SEP \ + MACRO(9, CONTEXT, _9) + +#define metamacro_foreach_cxt11(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) \ + metamacro_foreach_cxt10(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9) \ + SEP \ + MACRO(10, CONTEXT, _10) + +#define metamacro_foreach_cxt12(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11) \ + metamacro_foreach_cxt11(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) \ + SEP \ + MACRO(11, CONTEXT, _11) + +#define metamacro_foreach_cxt13(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) \ + metamacro_foreach_cxt12(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11) \ + SEP \ + MACRO(12, CONTEXT, _12) + +#define metamacro_foreach_cxt14(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) \ + metamacro_foreach_cxt13(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) \ + SEP \ + MACRO(13, CONTEXT, _13) + +#define metamacro_foreach_cxt15(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) \ + metamacro_foreach_cxt14(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) \ + SEP \ + MACRO(14, CONTEXT, _14) + +#define metamacro_foreach_cxt16(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) \ + metamacro_foreach_cxt15(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) \ + SEP \ + MACRO(15, CONTEXT, _15) + +#define metamacro_foreach_cxt17(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16) \ + metamacro_foreach_cxt16(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) \ + SEP \ + MACRO(16, CONTEXT, _16) + +#define metamacro_foreach_cxt18(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17) \ + metamacro_foreach_cxt17(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16) \ + SEP \ + MACRO(17, CONTEXT, _17) + +#define metamacro_foreach_cxt19(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18) \ + metamacro_foreach_cxt18(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17) \ + SEP \ + MACRO(18, CONTEXT, _18) + +#define metamacro_foreach_cxt20(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19) \ + metamacro_foreach_cxt19(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18) \ + SEP \ + MACRO(19, CONTEXT, _19) + +// metamacro_foreach_cxt_recursive expansions +#define metamacro_foreach_cxt_recursive0(MACRO, SEP, CONTEXT) +#define metamacro_foreach_cxt_recursive1(MACRO, SEP, CONTEXT, _0) MACRO(0, CONTEXT, _0) + +#define metamacro_foreach_cxt_recursive2(MACRO, SEP, CONTEXT, _0, _1) \ + metamacro_foreach_cxt_recursive1(MACRO, SEP, CONTEXT, _0) \ + SEP \ + MACRO(1, CONTEXT, _1) + +#define metamacro_foreach_cxt_recursive3(MACRO, SEP, CONTEXT, _0, _1, _2) \ + metamacro_foreach_cxt_recursive2(MACRO, SEP, CONTEXT, _0, _1) \ + SEP \ + MACRO(2, CONTEXT, _2) + +#define metamacro_foreach_cxt_recursive4(MACRO, SEP, CONTEXT, _0, _1, _2, _3) \ + metamacro_foreach_cxt_recursive3(MACRO, SEP, CONTEXT, _0, _1, _2) \ + SEP \ + MACRO(3, CONTEXT, _3) + +#define metamacro_foreach_cxt_recursive5(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4) \ + metamacro_foreach_cxt_recursive4(MACRO, SEP, CONTEXT, _0, _1, _2, _3) \ + SEP \ + MACRO(4, CONTEXT, _4) + +#define metamacro_foreach_cxt_recursive6(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5) \ + metamacro_foreach_cxt_recursive5(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4) \ + SEP \ + MACRO(5, CONTEXT, _5) + +#define metamacro_foreach_cxt_recursive7(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6) \ + metamacro_foreach_cxt_recursive6(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5) \ + SEP \ + MACRO(6, CONTEXT, _6) + +#define metamacro_foreach_cxt_recursive8(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7) \ + metamacro_foreach_cxt_recursive7(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6) \ + SEP \ + MACRO(7, CONTEXT, _7) + +#define metamacro_foreach_cxt_recursive9(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8) \ + metamacro_foreach_cxt_recursive8(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7) \ + SEP \ + MACRO(8, CONTEXT, _8) + +#define metamacro_foreach_cxt_recursive10(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9) \ + metamacro_foreach_cxt_recursive9(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8) \ + SEP \ + MACRO(9, CONTEXT, _9) + +#define metamacro_foreach_cxt_recursive11(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) \ + metamacro_foreach_cxt_recursive10(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9) \ + SEP \ + MACRO(10, CONTEXT, _10) + +#define metamacro_foreach_cxt_recursive12(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11) \ + metamacro_foreach_cxt_recursive11(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) \ + SEP \ + MACRO(11, CONTEXT, _11) + +#define metamacro_foreach_cxt_recursive13(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) \ + metamacro_foreach_cxt_recursive12(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11) \ + SEP \ + MACRO(12, CONTEXT, _12) + +#define metamacro_foreach_cxt_recursive14(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) \ + metamacro_foreach_cxt_recursive13(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12) \ + SEP \ + MACRO(13, CONTEXT, _13) + +#define metamacro_foreach_cxt_recursive15(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) \ + metamacro_foreach_cxt_recursive14(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13) \ + SEP \ + MACRO(14, CONTEXT, _14) + +#define metamacro_foreach_cxt_recursive16(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) \ + metamacro_foreach_cxt_recursive15(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14) \ + SEP \ + MACRO(15, CONTEXT, _15) + +#define metamacro_foreach_cxt_recursive17(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16) \ + metamacro_foreach_cxt_recursive16(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15) \ + SEP \ + MACRO(16, CONTEXT, _16) + +#define metamacro_foreach_cxt_recursive18(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17) \ + metamacro_foreach_cxt_recursive17(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16) \ + SEP \ + MACRO(17, CONTEXT, _17) + +#define metamacro_foreach_cxt_recursive19(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18) \ + metamacro_foreach_cxt_recursive18(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17) \ + SEP \ + MACRO(18, CONTEXT, _18) + +#define metamacro_foreach_cxt_recursive20(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19) \ + metamacro_foreach_cxt_recursive19(MACRO, SEP, CONTEXT, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18) \ + SEP \ + MACRO(19, CONTEXT, _19) + +// metamacro_for_cxt expansions +#define metamacro_for_cxt0(MACRO, SEP, CONTEXT) +#define metamacro_for_cxt1(MACRO, SEP, CONTEXT) MACRO(0, CONTEXT) + +#define metamacro_for_cxt2(MACRO, SEP, CONTEXT) \ + metamacro_for_cxt1(MACRO, SEP, CONTEXT) \ + SEP \ + MACRO(1, CONTEXT) + +#define metamacro_for_cxt3(MACRO, SEP, CONTEXT) \ + metamacro_for_cxt2(MACRO, SEP, CONTEXT) \ + SEP \ + MACRO(2, CONTEXT) + +#define metamacro_for_cxt4(MACRO, SEP, CONTEXT) \ + metamacro_for_cxt3(MACRO, SEP, CONTEXT) \ + SEP \ + MACRO(3, CONTEXT) + +#define metamacro_for_cxt5(MACRO, SEP, CONTEXT) \ + metamacro_for_cxt4(MACRO, SEP, CONTEXT) \ + SEP \ + MACRO(4, CONTEXT) + +#define metamacro_for_cxt6(MACRO, SEP, CONTEXT) \ + metamacro_for_cxt5(MACRO, SEP, CONTEXT) \ + SEP \ + MACRO(5, CONTEXT) + +#define metamacro_for_cxt7(MACRO, SEP, CONTEXT) \ + metamacro_for_cxt6(MACRO, SEP, CONTEXT) \ + SEP \ + MACRO(6, CONTEXT) + +#define metamacro_for_cxt8(MACRO, SEP, CONTEXT) \ + metamacro_for_cxt7(MACRO, SEP, CONTEXT) \ + SEP \ + MACRO(7, CONTEXT) + +#define metamacro_for_cxt9(MACRO, SEP, CONTEXT) \ + metamacro_for_cxt8(MACRO, SEP, CONTEXT) \ + SEP \ + MACRO(8, CONTEXT) + +#define metamacro_for_cxt10(MACRO, SEP, CONTEXT) \ + metamacro_for_cxt9(MACRO, SEP, CONTEXT) \ + SEP \ + MACRO(9, CONTEXT) + +#define metamacro_for_cxt11(MACRO, SEP, CONTEXT) \ + metamacro_for_cxt10(MACRO, SEP, CONTEXT) \ + SEP \ + MACRO(10, CONTEXT) + +#define metamacro_for_cxt12(MACRO, SEP, CONTEXT) \ + metamacro_for_cxt11(MACRO, SEP, CONTEXT) \ + SEP \ + MACRO(11, CONTEXT) + +#define metamacro_for_cxt13(MACRO, SEP, CONTEXT) \ + metamacro_for_cxt12(MACRO, SEP, CONTEXT) \ + SEP \ + MACRO(12, CONTEXT) + +#define metamacro_for_cxt14(MACRO, SEP, CONTEXT) \ + metamacro_for_cxt13(MACRO, SEP, CONTEXT) \ + SEP \ + MACRO(13, CONTEXT) + +#define metamacro_for_cxt15(MACRO, SEP, CONTEXT) \ + metamacro_for_cxt14(MACRO, SEP, CONTEXT) \ + SEP \ + MACRO(14, CONTEXT) + +#define metamacro_for_cxt16(MACRO, SEP, CONTEXT) \ + metamacro_for_cxt15(MACRO, SEP, CONTEXT) \ + SEP \ + MACRO(15, CONTEXT) + +#define metamacro_for_cxt17(MACRO, SEP, CONTEXT) \ + metamacro_for_cxt16(MACRO, SEP, CONTEXT) \ + SEP \ + MACRO(16, CONTEXT) + +#define metamacro_for_cxt18(MACRO, SEP, CONTEXT) \ + metamacro_for_cxt17(MACRO, SEP, CONTEXT) \ + SEP \ + MACRO(17, CONTEXT) + +#define metamacro_for_cxt19(MACRO, SEP, CONTEXT) \ + metamacro_for_cxt18(MACRO, SEP, CONTEXT) \ + SEP \ + MACRO(18, CONTEXT) + +#define metamacro_for_cxt20(MACRO, SEP, CONTEXT) \ + metamacro_for_cxt19(MACRO, SEP, CONTEXT) \ + SEP \ + MACRO(19, CONTEXT) + +// metamacro_if_eq expansions +#define metamacro_if_eq0(VALUE) \ + metamacro_concat(metamacro_if_eq0_, VALUE) + +#define metamacro_if_eq0_0(...) __VA_ARGS__ metamacro_consume_ +#define metamacro_if_eq0_1(...) metamacro_expand_ +#define metamacro_if_eq0_2(...) metamacro_expand_ +#define metamacro_if_eq0_3(...) metamacro_expand_ +#define metamacro_if_eq0_4(...) metamacro_expand_ +#define metamacro_if_eq0_5(...) metamacro_expand_ +#define metamacro_if_eq0_6(...) metamacro_expand_ +#define metamacro_if_eq0_7(...) metamacro_expand_ +#define metamacro_if_eq0_8(...) metamacro_expand_ +#define metamacro_if_eq0_9(...) metamacro_expand_ +#define metamacro_if_eq0_10(...) metamacro_expand_ +#define metamacro_if_eq0_11(...) metamacro_expand_ +#define metamacro_if_eq0_12(...) metamacro_expand_ +#define metamacro_if_eq0_13(...) metamacro_expand_ +#define metamacro_if_eq0_14(...) metamacro_expand_ +#define metamacro_if_eq0_15(...) metamacro_expand_ +#define metamacro_if_eq0_16(...) metamacro_expand_ +#define metamacro_if_eq0_17(...) metamacro_expand_ +#define metamacro_if_eq0_18(...) metamacro_expand_ +#define metamacro_if_eq0_19(...) metamacro_expand_ +#define metamacro_if_eq0_20(...) metamacro_expand_ + +#define metamacro_if_eq1(VALUE) metamacro_if_eq0(metamacro_dec(VALUE)) +#define metamacro_if_eq2(VALUE) metamacro_if_eq1(metamacro_dec(VALUE)) +#define metamacro_if_eq3(VALUE) metamacro_if_eq2(metamacro_dec(VALUE)) +#define metamacro_if_eq4(VALUE) metamacro_if_eq3(metamacro_dec(VALUE)) +#define metamacro_if_eq5(VALUE) metamacro_if_eq4(metamacro_dec(VALUE)) +#define metamacro_if_eq6(VALUE) metamacro_if_eq5(metamacro_dec(VALUE)) +#define metamacro_if_eq7(VALUE) metamacro_if_eq6(metamacro_dec(VALUE)) +#define metamacro_if_eq8(VALUE) metamacro_if_eq7(metamacro_dec(VALUE)) +#define metamacro_if_eq9(VALUE) metamacro_if_eq8(metamacro_dec(VALUE)) +#define metamacro_if_eq10(VALUE) metamacro_if_eq9(metamacro_dec(VALUE)) +#define metamacro_if_eq11(VALUE) metamacro_if_eq10(metamacro_dec(VALUE)) +#define metamacro_if_eq12(VALUE) metamacro_if_eq11(metamacro_dec(VALUE)) +#define metamacro_if_eq13(VALUE) metamacro_if_eq12(metamacro_dec(VALUE)) +#define metamacro_if_eq14(VALUE) metamacro_if_eq13(metamacro_dec(VALUE)) +#define metamacro_if_eq15(VALUE) metamacro_if_eq14(metamacro_dec(VALUE)) +#define metamacro_if_eq16(VALUE) metamacro_if_eq15(metamacro_dec(VALUE)) +#define metamacro_if_eq17(VALUE) metamacro_if_eq16(metamacro_dec(VALUE)) +#define metamacro_if_eq18(VALUE) metamacro_if_eq17(metamacro_dec(VALUE)) +#define metamacro_if_eq19(VALUE) metamacro_if_eq18(metamacro_dec(VALUE)) +#define metamacro_if_eq20(VALUE) metamacro_if_eq19(metamacro_dec(VALUE)) + +// metamacro_if_eq_recursive expansions +#define metamacro_if_eq_recursive0(VALUE) \ + metamacro_concat(metamacro_if_eq_recursive0_, VALUE) + +#define metamacro_if_eq_recursive0_0(...) __VA_ARGS__ metamacro_consume_ +#define metamacro_if_eq_recursive0_1(...) metamacro_expand_ +#define metamacro_if_eq_recursive0_2(...) metamacro_expand_ +#define metamacro_if_eq_recursive0_3(...) metamacro_expand_ +#define metamacro_if_eq_recursive0_4(...) metamacro_expand_ +#define metamacro_if_eq_recursive0_5(...) metamacro_expand_ +#define metamacro_if_eq_recursive0_6(...) metamacro_expand_ +#define metamacro_if_eq_recursive0_7(...) metamacro_expand_ +#define metamacro_if_eq_recursive0_8(...) metamacro_expand_ +#define metamacro_if_eq_recursive0_9(...) metamacro_expand_ +#define metamacro_if_eq_recursive0_10(...) metamacro_expand_ +#define metamacro_if_eq_recursive0_11(...) metamacro_expand_ +#define metamacro_if_eq_recursive0_12(...) metamacro_expand_ +#define metamacro_if_eq_recursive0_13(...) metamacro_expand_ +#define metamacro_if_eq_recursive0_14(...) metamacro_expand_ +#define metamacro_if_eq_recursive0_15(...) metamacro_expand_ +#define metamacro_if_eq_recursive0_16(...) metamacro_expand_ +#define metamacro_if_eq_recursive0_17(...) metamacro_expand_ +#define metamacro_if_eq_recursive0_18(...) metamacro_expand_ +#define metamacro_if_eq_recursive0_19(...) metamacro_expand_ +#define metamacro_if_eq_recursive0_20(...) metamacro_expand_ + +#define metamacro_if_eq_recursive1(VALUE) metamacro_if_eq_recursive0(metamacro_dec(VALUE)) +#define metamacro_if_eq_recursive2(VALUE) metamacro_if_eq_recursive1(metamacro_dec(VALUE)) +#define metamacro_if_eq_recursive3(VALUE) metamacro_if_eq_recursive2(metamacro_dec(VALUE)) +#define metamacro_if_eq_recursive4(VALUE) metamacro_if_eq_recursive3(metamacro_dec(VALUE)) +#define metamacro_if_eq_recursive5(VALUE) metamacro_if_eq_recursive4(metamacro_dec(VALUE)) +#define metamacro_if_eq_recursive6(VALUE) metamacro_if_eq_recursive5(metamacro_dec(VALUE)) +#define metamacro_if_eq_recursive7(VALUE) metamacro_if_eq_recursive6(metamacro_dec(VALUE)) +#define metamacro_if_eq_recursive8(VALUE) metamacro_if_eq_recursive7(metamacro_dec(VALUE)) +#define metamacro_if_eq_recursive9(VALUE) metamacro_if_eq_recursive8(metamacro_dec(VALUE)) +#define metamacro_if_eq_recursive10(VALUE) metamacro_if_eq_recursive9(metamacro_dec(VALUE)) +#define metamacro_if_eq_recursive11(VALUE) metamacro_if_eq_recursive10(metamacro_dec(VALUE)) +#define metamacro_if_eq_recursive12(VALUE) metamacro_if_eq_recursive11(metamacro_dec(VALUE)) +#define metamacro_if_eq_recursive13(VALUE) metamacro_if_eq_recursive12(metamacro_dec(VALUE)) +#define metamacro_if_eq_recursive14(VALUE) metamacro_if_eq_recursive13(metamacro_dec(VALUE)) +#define metamacro_if_eq_recursive15(VALUE) metamacro_if_eq_recursive14(metamacro_dec(VALUE)) +#define metamacro_if_eq_recursive16(VALUE) metamacro_if_eq_recursive15(metamacro_dec(VALUE)) +#define metamacro_if_eq_recursive17(VALUE) metamacro_if_eq_recursive16(metamacro_dec(VALUE)) +#define metamacro_if_eq_recursive18(VALUE) metamacro_if_eq_recursive17(metamacro_dec(VALUE)) +#define metamacro_if_eq_recursive19(VALUE) metamacro_if_eq_recursive18(metamacro_dec(VALUE)) +#define metamacro_if_eq_recursive20(VALUE) metamacro_if_eq_recursive19(metamacro_dec(VALUE)) + +// metamacro_take expansions +#define metamacro_take0(...) +#define metamacro_take1(...) metamacro_head(__VA_ARGS__) +#define metamacro_take2(...) metamacro_head(__VA_ARGS__), metamacro_take1(metamacro_tail(__VA_ARGS__)) +#define metamacro_take3(...) metamacro_head(__VA_ARGS__), metamacro_take2(metamacro_tail(__VA_ARGS__)) +#define metamacro_take4(...) metamacro_head(__VA_ARGS__), metamacro_take3(metamacro_tail(__VA_ARGS__)) +#define metamacro_take5(...) metamacro_head(__VA_ARGS__), metamacro_take4(metamacro_tail(__VA_ARGS__)) +#define metamacro_take6(...) metamacro_head(__VA_ARGS__), metamacro_take5(metamacro_tail(__VA_ARGS__)) +#define metamacro_take7(...) metamacro_head(__VA_ARGS__), metamacro_take6(metamacro_tail(__VA_ARGS__)) +#define metamacro_take8(...) metamacro_head(__VA_ARGS__), metamacro_take7(metamacro_tail(__VA_ARGS__)) +#define metamacro_take9(...) metamacro_head(__VA_ARGS__), metamacro_take8(metamacro_tail(__VA_ARGS__)) +#define metamacro_take10(...) metamacro_head(__VA_ARGS__), metamacro_take9(metamacro_tail(__VA_ARGS__)) +#define metamacro_take11(...) metamacro_head(__VA_ARGS__), metamacro_take10(metamacro_tail(__VA_ARGS__)) +#define metamacro_take12(...) metamacro_head(__VA_ARGS__), metamacro_take11(metamacro_tail(__VA_ARGS__)) +#define metamacro_take13(...) metamacro_head(__VA_ARGS__), metamacro_take12(metamacro_tail(__VA_ARGS__)) +#define metamacro_take14(...) metamacro_head(__VA_ARGS__), metamacro_take13(metamacro_tail(__VA_ARGS__)) +#define metamacro_take15(...) metamacro_head(__VA_ARGS__), metamacro_take14(metamacro_tail(__VA_ARGS__)) +#define metamacro_take16(...) metamacro_head(__VA_ARGS__), metamacro_take15(metamacro_tail(__VA_ARGS__)) +#define metamacro_take17(...) metamacro_head(__VA_ARGS__), metamacro_take16(metamacro_tail(__VA_ARGS__)) +#define metamacro_take18(...) metamacro_head(__VA_ARGS__), metamacro_take17(metamacro_tail(__VA_ARGS__)) +#define metamacro_take19(...) metamacro_head(__VA_ARGS__), metamacro_take18(metamacro_tail(__VA_ARGS__)) +#define metamacro_take20(...) metamacro_head(__VA_ARGS__), metamacro_take19(metamacro_tail(__VA_ARGS__)) + +// metamacro_drop expansions +#define metamacro_drop0(...) __VA_ARGS__ +#define metamacro_drop1(...) metamacro_tail(__VA_ARGS__) +#define metamacro_drop2(...) metamacro_drop1(metamacro_tail(__VA_ARGS__)) +#define metamacro_drop3(...) metamacro_drop2(metamacro_tail(__VA_ARGS__)) +#define metamacro_drop4(...) metamacro_drop3(metamacro_tail(__VA_ARGS__)) +#define metamacro_drop5(...) metamacro_drop4(metamacro_tail(__VA_ARGS__)) +#define metamacro_drop6(...) metamacro_drop5(metamacro_tail(__VA_ARGS__)) +#define metamacro_drop7(...) metamacro_drop6(metamacro_tail(__VA_ARGS__)) +#define metamacro_drop8(...) metamacro_drop7(metamacro_tail(__VA_ARGS__)) +#define metamacro_drop9(...) metamacro_drop8(metamacro_tail(__VA_ARGS__)) +#define metamacro_drop10(...) metamacro_drop9(metamacro_tail(__VA_ARGS__)) +#define metamacro_drop11(...) metamacro_drop10(metamacro_tail(__VA_ARGS__)) +#define metamacro_drop12(...) metamacro_drop11(metamacro_tail(__VA_ARGS__)) +#define metamacro_drop13(...) metamacro_drop12(metamacro_tail(__VA_ARGS__)) +#define metamacro_drop14(...) metamacro_drop13(metamacro_tail(__VA_ARGS__)) +#define metamacro_drop15(...) metamacro_drop14(metamacro_tail(__VA_ARGS__)) +#define metamacro_drop16(...) metamacro_drop15(metamacro_tail(__VA_ARGS__)) +#define metamacro_drop17(...) metamacro_drop16(metamacro_tail(__VA_ARGS__)) +#define metamacro_drop18(...) metamacro_drop17(metamacro_tail(__VA_ARGS__)) +#define metamacro_drop19(...) metamacro_drop18(metamacro_tail(__VA_ARGS__)) +#define metamacro_drop20(...) metamacro_drop19(metamacro_tail(__VA_ARGS__)) + +#endif diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/UIColor+SDHexString.h b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/UIColor+SDHexString.h new file mode 100644 index 0000000..cf67186 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/UIColor+SDHexString.h @@ -0,0 +1,18 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "SDWebImageCompat.h" + +@interface UIColor (SDHexString) + +/** + Convenience way to get hex string from color. The output should always be 32-bit RGBA hex string like `#00000000`. + */ +@property (nonatomic, copy, readonly, nonnull) NSString *sd_hexString; + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/UIColor+SDHexString.m b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/UIColor+SDHexString.m new file mode 100644 index 0000000..7b43c41 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/SDWebImage/Private/UIColor+SDHexString.m @@ -0,0 +1,42 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import "UIColor+SDHexString.h" + +@implementation UIColor (SDHexString) + +- (NSString *)sd_hexString { + CGFloat red, green, blue, alpha; +#if SD_UIKIT + if (![self getRed:&red green:&green blue:&blue alpha:&alpha]) { + [self getWhite:&red alpha:&alpha]; + green = red; + blue = red; + } +#else + @try { + [self getRed:&red green:&green blue:&blue alpha:&alpha]; + } + @catch (NSException *exception) { + [self getWhite:&red alpha:&alpha]; + green = red; + blue = red; + } +#endif + + red = roundf(red * 255.f); + green = roundf(green * 255.f); + blue = roundf(blue * 255.f); + alpha = roundf(alpha * 255.f); + + uint hex = ((uint)alpha << 24) | ((uint)red << 16) | ((uint)green << 8) | ((uint)blue); + + return [NSString stringWithFormat:@"#%08x", hex]; +} + +@end diff --git a/NetflixCloneApp/Pods/SDWebImage/WebImage/SDWebImage.h b/NetflixCloneApp/Pods/SDWebImage/WebImage/SDWebImage.h new file mode 100644 index 0000000..0e56800 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImage/WebImage/SDWebImage.h @@ -0,0 +1,89 @@ +/* + * This file is part of the SDWebImage package. + * (c) Olivier Poitrey + * (c) Florent Vilmart + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import + +//! Project version number for SDWebImage. +FOUNDATION_EXPORT double SDWebImageVersionNumber; + +//! Project version string for SDWebImage. +FOUNDATION_EXPORT const unsigned char SDWebImageVersionString[]; + +// In this header, you should import all the public headers of your framework using statements like #import + +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import + +// Mac +#if __has_include() +#import +#endif +#if __has_include() +#import +#endif +#if __has_include() +#import +#endif + +// MapKit +#if __has_include() +#import +#endif diff --git a/NetflixCloneApp/Pods/SDWebImageSwiftUI/LICENSE b/NetflixCloneApp/Pods/SDWebImageSwiftUI/LICENSE new file mode 100644 index 0000000..210c9a8 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImageSwiftUI/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2019 lizhuoli1126@126.com + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/NetflixCloneApp/Pods/SDWebImageSwiftUI/README.md b/NetflixCloneApp/Pods/SDWebImageSwiftUI/README.md new file mode 100644 index 0000000..ab1af66 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImageSwiftUI/README.md @@ -0,0 +1,545 @@ +# SDWebImageSwiftUI + +[![CI Status](https://travis-ci.org/SDWebImage/SDWebImageSwiftUI.svg?branch=master)](https://travis-ci.org/SDWebImage/SDWebImageSwiftUI) +[![Version](https://img.shields.io/cocoapods/v/SDWebImageSwiftUI.svg)](https://cocoapods.org/pods/SDWebImageSwiftUI) +[![License](https://img.shields.io/cocoapods/l/SDWebImageSwiftUI.svg)](https://cocoapods.org/pods/SDWebImageSwiftUI) +[![Platform](https://img.shields.io/cocoapods/p/SDWebImageSwiftUI.svg)](https://cocoapods.org/pods/SDWebImageSwiftUI) +[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-brightgreen.svg)](https://github.com/Carthage/Carthage) +[![SwiftPM compatible](https://img.shields.io/badge/SwiftPM-compatible-brightgreen.svg)](https://swift.org/package-manager/) +[![codecov](https://codecov.io/gh/SDWebImage/SDWebImageSwiftUI/branch/master/graph/badge.svg)](https://codecov.io/gh/SDWebImage/SDWebImageSwiftUI) + +## What's for + +SDWebImageSwiftUI is a SwiftUI image loading framework, which based on [SDWebImage](https://github.com/SDWebImage/SDWebImage). + +It brings all your favorite features from SDWebImage, like async image loading, memory/disk caching, animated image playback and performances. + +The framework provide the different View structs, which API match the SwiftUI framework guideline. If you're familiar with `Image`, you'll find it easy to use `WebImage` and `AnimatedImage`. + +## Features + +Since SDWebImageSwiftUI is built on top of SDWebImage, it provide both the out-of-box features as well as advanced powerful features you may want in real world Apps. Check our [Wiki](https://github.com/SDWebImage/SDWebImage/wiki/Advanced-Usage) when you need: + +- [x] Animated Image full-stack solution, with balance of CPU && RAM +- [x] Progressive image loading, with animation support +- [x] Reusable download, never request single URL twice +- [x] URL Request / Response Modifier, provide custom HTTP Header +- [x] Image Transformer, apply corner radius or CIFilter +- [x] Multiple caches system, query from different source +- [x] Multiple loaders system, load from different resource + +You can also get all benefits from the existing community around with SDWebImage. You can have massive image format support (GIF/APNG/WebP/HEIF/AVIF/SVG/PDF) via [Coder Plugins](https://github.com/SDWebImage/SDWebImage/wiki/Coder-Plugin-List), PhotoKit support via [SDWebImagePhotosPlugin](https://github.com/SDWebImage/SDWebImagePhotosPlugin), Firebase integration via [FirebaseUI](https://github.com/firebase/FirebaseUI-iOS), etc. + +Besides all these features, we do optimization for SwiftUI, like Binding, View Modifier, using the same design pattern to become a good SwiftUI citizen. + +## Version + +This framework is under heavily development, it's recommended to use [the latest release](https://github.com/SDWebImage/SDWebImageSwiftUI/releases) as much as possible (including SDWebImage dependency). + +This framework follows [Semantic Versioning](https://semver.org/). Each source-break API changes will bump to a major version. + +## Changelog + +This project use [keep a changelog](https://keepachangelog.com/en/1.0.0/) format to record the changes. Check the [CHANGELOG.md](https://github.com/SDWebImage/SDWebImageSwiftUI/blob/master/CHANGELOG.md) about the changes between versions. The changes will also be updated in Release page. + +## Contribution + +All issue reports, feature requests, contributions, and GitHub stars are welcomed. Hope for active feedback and promotion if you find this framework useful. + +## Requirements + ++ Xcode 12+ ++ iOS 13+ ++ macOS 10.15+ ++ tvOS 13+ ++ watchOS 6+ ++ Swift 5.2+ + +## SwiftUI 2.0 Compatibility + +iOS 14(macOS 11) introduce the SwiftUI 2.0, which keep the most API compatible, but changes many internal behaviors, which breaks the SDWebImageSwiftUI's function. + +From v2.0.0, we adopt SwiftUI 2.0 and iOS 14(macOS 11)'s behavior. You can use `WebImage` and `AnimatedImage` inside the new `LazyVStack`. + +```swift +var body: some View { + ScrollView { + LazyVStack { + ForEach(urls, id: \.self) { url in + AnimatedImage(url: url) + } + } + } +} +``` + +Note: However, many differences behavior between iOS 13/14's is hard to fixup. Due to maintain issue, in the future release, we will drop the iOS 13 supports and always match SwiftUI 2.0's behavior. + + +## Installation + +#### Swift Package Manager + +SDWebImageSwiftUI is available through [Swift Package Manager](https://swift.org/package-manager/). + ++ For App integration + +For App integration, you should using Xcode 12 or higher, to add this package to your App target. To do this, check [Adding Package Dependencies to Your App](https://developer.apple.com/documentation/xcode/adding_package_dependencies_to_your_app?language=objc) about the step by step tutorial using Xcode. + ++ For downstream framework + +For downstream framework author, you should create a `Package.swift` file into your git repo, then add the following line to mark your framework dependent our SDWebImageSwiftUI. + +```swift +let package = Package( + dependencies: [ + .package(url: "https://github.com/SDWebImage/SDWebImageSwiftUI.git", from: "2.0.0") + ], +) +``` + +#### CocoaPods + +SDWebImageSwiftUI is available through [CocoaPods](https://cocoapods.org). To install +it, simply add the following line to your Podfile: + +```ruby +pod 'SDWebImageSwiftUI' +``` + +#### Carthage + +SDWebImageSwiftUI is available through [Carthage](https://github.com/Carthage/Carthage). + +``` +github "SDWebImage/SDWebImageSwiftUI" +``` + +## Usage + +### Using `WebImage` to load network image + +- [x] Supports placeholder and detail options control for image loading as SDWebImage +- [x] Supports progressive image loading (like baseline) +- [x] Supports success/failure/progress changes event for custom handling +- [x] Supports indicator with activity/progress indicator and customization +- [x] Supports built-in animation and transition, powered by SwiftUI +- [x] Supports animated image as well! + +```swift +var body: some View { + WebImage(url: URL(string: "https://nokiatech.github.io/heif/content/images/ski_jump_1440x960.heic")) + // Supports options and context, like `.delayPlaceholder` to show placeholder only when error + .onSuccess { image, data, cacheType in + // Success + // Note: Data exist only when queried from disk cache or network. Use `.queryMemoryData` if you really need data + } + .resizable() // Resizable like SwiftUI.Image, you must use this modifier or the view will use the image bitmap size + .placeholder(Image(systemName: "photo")) // Placeholder Image + // Supports ViewBuilder as well + .placeholder { + Rectangle().foregroundColor(.gray) + } + .indicator(.activity) // Activity Indicator + .transition(.fade(duration: 0.5)) // Fade Transition with duration + .scaledToFit() + .frame(width: 300, height: 300, alignment: .center) +} +``` + +Note: This `WebImage` using `Image` for internal implementation, which is the best compatible for SwiftUI layout and animation system. But unlike SwiftUI's `Image` which does not support animated image or vector image, `WebImage` supports animated image as well (by defaults from v2.0.0). + +However, The `WebImage` animation provide simple common use case, so it's still recommend to use `AnimatedImage` for advanced controls like progressive animation rendering, or vector image rendering. + +```swift +@State var isAnimating: Bool = true +var body: some View { + WebImage(url: URL(string: "https://raw.githubusercontent.com/liyong03/YLGIFImage/master/YLGIFImageDemo/YLGIFImageDemo/joy.gif"), isAnimating: $isAnimating)) // Animation Control, supports dynamic changes + // The initial value of binding should be true + .customLoopCount(1) // Custom loop count + .playbackRate(2.0) // Playback speed rate + .playbackMode(.bounce) // Playback normally to the end, then reversely back to the start + // `WebImage` supports advanced control just like `AnimatedImage`, but without the progressive animation support +} +``` + +Note: For indicator, you can custom your own as well. For example, iOS 14/watchOS 7 introduce the new `ProgressView`, which can replace our built-in `ProgressIndicator/ActivityIndicator` (where watchOS does not provide). + +```swift +WebImage(url: url) +.indicator { + Indicator { _, _ in + ProgressView() + } +} +``` + +### Using `AnimatedImage` to play animation + +- [x] Supports network image as well as local data and bundle image +- [x] Supports animated image format as well as vector image format +- [x] Supports animated progressive image loading (like web browser) +- [x] Supports animation control using the SwiftUI Binding +- [x] Supports indicator and transition, powered by SDWebImage and Core Animation +- [x] Supports advanced control like loop count, playback rate, buffer size, runloop mode, etc +- [x] Supports coordinate with native UIKit/AppKit view + +```swift +var body: some View { + Group { + AnimatedImage(url: URL(string: "https://raw.githubusercontent.com/liyong03/YLGIFImage/master/YLGIFImageDemo/YLGIFImageDemo/joy.gif")) + // Supports options and context, like `.progressiveLoad` for progressive animation loading + .onFailure { error in + // Error + } + .resizable() // Resizable like SwiftUI.Image, you must use this modifier or the view will use the image bitmap size + .placeholder(UIImage(systemName: "photo")) // Placeholder Image + // Supports ViewBuilder as well + .placeholder { + Circle().foregroundColor(.gray) + } + .indicator(SDWebImageActivityIndicator.medium) // Activity Indicator + .transition(.fade) // Fade Transition + .scaledToFit() // Attention to call it on AnimatedImage, but not `some View` after View Modifier (Swift Protocol Extension method is static dispatched) + + // Data + AnimatedImage(data: try! Data(contentsOf: URL(fileURLWithPath: "/tmp/foo.webp"))) + .customLoopCount(1) // Custom loop count + .playbackRate(2.0) // Playback speed rate + + // Bundle (not Asset Catalog) + AnimatedImage(name: "animation1", isAnimating: $isAnimating)) // Animation control binding + .maxBufferSize(.max) + .onViewUpdate { view, context in // Advanced native view coordinate + // AppKit tooltip for mouse hover + view.toolTip = "Mouseover Tip" + // UIKit advanced content mode + view.contentMode = .topLeft + // Coordinator, used for Cocoa Binding or Delegate method + let coordinator = context.coordinator + } + } +} +``` + +Note: `AnimatedImage` supports both image url or image data for animated image format. Which use the SDWebImage's [Animated ImageView](https://github.com/SDWebImage/SDWebImage/wiki/Advanced-Usage#animated-image-50) for internal implementation. Pay attention that since this base on UIKit/AppKit representable, some advanced SwiftUI layout and animation system may not work as expected. You may need UIKit/AppKit and Core Animation to modify the native view. + +Note: `AnimatedImage` some methods like `.transition`, `.indicator` and `.aspectRatio` have the same naming as `SwiftUI.View` protocol methods. But the args receive the different type. This is because `AnimatedImage` supports to be used with UIKit/AppKit component and animation. If you find ambiguity, use full type declaration instead of the dot expression syntax. + +Note: some of methods on `AnimatedImage` will return `some View`, a new Modified Content. You'll lose the type related modifier method. For this case, you can either reorder the method call, or use Native View in `.onViewUpdate` for rescue. + +```swift +var body: some View { + AnimatedImage(name: "animation2") // Just for showcase, don't mix them at the same time + .indicator(SDWebImageProgressIndicator.default) // UIKit indicator component + .indicator(Indicator.progress) // SwiftUI indicator component + .transition(SDWebImageTransition.flipFromLeft) // UIKit animation transition + .transition(AnyTransition.flipFromLeft) // SwiftUI animation transition +} +``` + +### Which View to choose + +Why we have two different View types here, is because of current SwiftUI limit. But we're aimed to provide best solution for all use cases. + +If you don't need animated image, prefer to use `WebImage` firstly. Which behaves the seamless as built-in SwiftUI View. If SwiftUI works, it works. If SwiftUI doesn't work, it either :) + +If you need simple animated image, use `WebImage`. Which provide the basic animated image support. But it does not support progressive animation rendering, nor vector image, if you don't care about this. + +If you need powerful animated image, `AnimatedImage` is the one to choose. Remember it supports static image as well, you don't need to check the format, just use as it. Also, some powerful feature like UIKit/AppKit tint color, vector image, symbol image configuration, tvOS layered image, only available in `AnimatedImage` but not currently in SwfitUI. + +But, because `AnimatedImage` use `UIViewRepresentable` and driven by UIKit, currently there may be some small incompatible issues between UIKit and SwiftUI layout and animation system, or bugs related to SwiftUI itself. We try our best to match SwiftUI behavior, and provide the same API as `WebImage`, which make it easy to switch between these two types if needed. + +### Use `ImageManager` for your own View type + +The `ImageManager` is a class which conforms to Combine's [ObservableObject](https://developer.apple.com/documentation/combine/observableobject) protocol. Which is the core fetching data source of `WebImage` we provided. + +For advanced use case, like loading image into the complicated View graph which you don't want to use `WebImage`. You can directly bind your own View type with the Manager. + +It looks familiar like `SDWebImageManager`, but it's built for SwiftUI world, which provide the Source of Truth for loading images. You'd better use SwiftUI's `@ObservedObject` to bind each single manager instance for your View instance, which automatically update your View's body when image status changed. + +```swift +struct MyView : View { + @ObservedObject var imageManager: ImageManager + var body: some View { + // Your custom complicated view graph + Group { + if imageManager.image != nil { + Image(uiImage: imageManager.image!) + } else { + Rectangle().fill(Color.gray) + } + } + // Trigger image loading when appear + .onAppear { self.imageManager.load() } + // Cancel image loading when disappear + .onDisappear { self.imageManager.cancel() } + } +} + +struct MyView_Previews: PreviewProvider { + static var previews: some View { + MyView(imageManager: ImageManager(url: URL(string: "https://via.placeholder.com/200x200.jpg")) + } +} +``` + +### Customization and configuration setup + +This framework is based on SDWebImage, which supports advanced customization and configuration to meet different users' demand. + +You can register multiple coder plugins for external image format. You can register multiple caches (different paths and config), multiple loaders (URLSession and Photos URLs). You can control the cache expiration date, size, download priority, etc. All in our [wiki](https://github.com/SDWebImage/SDWebImage/wiki/). + +The best place to put these setup code for SwiftUI App, it's the `AppDelegate.swift`: + +```swift +func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { + // Add WebP/SVG/PDF support + SDImageCodersManager.shared.addCoder(SDImageWebPCoder.shared) + SDImageCodersManager.shared.addCoder(SDImageSVGCoder.shared) + SDImageCodersManager.shared.addCoder(SDImagePDFCoder.shared) + + // Add default HTTP header + SDWebImageDownloader.shared.setValue("image/webp,image/apng,image/*,*/*;q=0.8", forHTTPHeaderField: "Accept") + + // Add multiple caches + let cache = SDImageCache(namespace: "tiny") + cache.config.maxMemoryCost = 100 * 1024 * 1024 // 100MB memory + cache.config.maxDiskSize = 50 * 1024 * 1024 // 50MB disk + SDImageCachesManager.shared.addCache(cache) + SDWebImageManager.defaultImageCache = SDImageCachesManager.shared + + // Add multiple loaders with Photos Asset support + SDImageLoadersManager.shared.addLoader(SDImagePhotosLoader.shared) + SDWebImageManager.defaultImageLoader = SDImageLoadersManager.shared + return true +} +``` + +For more information, it's really recommended to check our demo, to learn detailed API usage. You can also have a check at the latest API documentation, for advanced usage. + +## Documentation + ++ [SDWebImageSwiftUI API documentation](https://sdwebimage.github.io/SDWebImageSwiftUI/) ++ [SDWebImage API documentation](https://sdwebimage.github.io/) + +## FAQ + +### Common Problems + +#### Using Image/WebImage/AnimatedImage in Button/NavigationLink + +SwiftUI's `Button` apply overlay to its content (except `Text`) by default, this is common mistake to write code like this, which cause strange behavior: + +```swift +// Wrong +Button(action: { + // Clicked +}) { + WebImage(url: url) +} +// NavigationLink create Button implicitly +NavigationView { + NavigationLink(destination: Text("Detail view here")) { + WebImage(url: url) + } +} +``` + +Instead, you must override the `.buttonStyle` to use the plain style, or the `.renderingMode` to use original mode. You can also use the `.onTapGesture` modifier for touch handling. See [How to disable the overlay color for images inside Button and NavigationLink](https://www.hackingwithswift.com/quick-start/swiftui/how-to-disable-the-overlay-color-for-images-inside-button-and-navigationlink) + +```swift +// Correct +Button(action: { + // Clicked +}) { + WebImage(url: url) +} +.buttonStyle(PlainButtonStyle()) +// Or +NavigationView { + NavigationLink(destination: Text("Detail view here")) { + WebImage(url: url) + .renderingMode(.original) + } +} +``` + +#### Using for backward deployment and weak linking SwiftUI + +SDWebImageSwiftUI supports to use when your App Target has a deployment target version less than iOS 13/macOS 10.15/tvOS 13/watchOS 6. Which will weak linking of SwiftUI(Combine) to allows writing code with available check at runtime. + +To use backward deployment, you have to do the follow things: + +##### Add weak linking framework + +Add `-weak_framework SwiftUI -weak_framework Combine` in your App Target's `Other Linker Flags` build setting. You can also do this using Xcode's `Optional Framework` checkbox, there have the same effect. + +You should notice that all the third party SwiftUI frameworks should have this build setting as well, not only just SDWebImageSwiftUI. Or when running on iOS 12 device, it will trigger the runtime dyld error on startup. + +##### Backward deployment on iOS 12.1- + +For deployment target version below iOS 12.2 (The first version which Swift 5 Runtime bundled in iOS system), you have to change the min deployment target version of SDWebImageSwiftUI. This may take some side effect on compiler's optimization and trigger massive warnings for some frameworks. + +However, for iOS 12.2+, you can still keep the min deployment target version to iOS 13, no extra warnings or performance slow down for iOS 13 client. + +Because Swift use the min deployment target version to detect whether to link the App bundled Swift runtime, or the System built-in one (`/usr/lib/swift/libswiftCore.dylib`). + ++ For CocoaPods user, you can change the min deployment target version in the Podfile via post installer: + +```ruby +post_install do |installer| + installer.pods_project.targets.each do |target| + target.build_configurations.each do |config| + config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0' # version you need + end + end +end +``` + ++ For Carthage user, you can use `carthage update --no-build` to download the dependency, then change the Xcode Project's deployment target version and build the binary framework. + ++ For SwiftPM user, you have to use the local dependency (with the Git submodule) to change the deployment target version. + +##### Backward deployment on iOS 12.2+ + ++ For Carthage user, the built binary framework will use [Library Evolution](https://swift.org/blog/abi-stability-and-more/) to support for backward deployment. + ++ For CocoaPods user, you can skip the platform version validation in Podfile with: + +```ruby +platform :ios, '13.0' # This does not effect your App Target's deployment target version, just a hint for CocoaPods +``` + ++ For SwiftPM user, SwiftPM does not support weak linking nor Library Evolution, so it can not deployment to iOS 12+ user without changing the min deployment target. + +##### Add available annotation + +Add **all the SwiftUI code** with the available annotation and runtime check, like this: + +```swift +// AppDelegate.swift +func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { + // ... + if #available(iOS 13, *) { + window.rootViewController = UIHostingController(rootView: ContentView()) + } else { + window.rootViewController = ViewController() + } + // ... +} + +// ViewController.swift +class ViewController: UIViewController { + var label: UILabel = UILabel() + override func viewDidLoad() { + super.viewDidLoad() + view.backgroundColor = .white + view.addSubview(label) + label.text = "Hello World iOS 12!" + label.sizeToFit() + label.center = view.center + } +} + +// ContentView.swift +@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *) +struct ContentView : View { + var body: some View { + Group { + Text("Hello World iOS 13!") + WebImage(url: URL(string: "https://i.loli.net/2019/09/24/rX2RkVWeGKIuJvc.jpg")) + } + } +} +``` + +## Demo + +To run the example using SwiftUI, following the steps: + +``` +cd Example +pod install +``` + +Then open the Xcode Workspace to run the demo application. + +Since SwiftUI is aimed to support all Apple platforms, our demo does this as well, one codebase including: + ++ iOS (iPhone/iPad/Mac Catalyst) ++ macOS ++ tvOS ++ watchOS + +Demo Tips: + +1. Use `Switch` (right-click on macOS/force press on watchOS) to switch between `WebImage` and `AnimatedImage`. +2. Use `Reload` (right-click on macOS/force press on watchOS) to clear cache. +3. Use `Swipe Left` (menu button on tvOS) to delete one image url from list. +4. Pinch gesture (Digital Crown on watchOS, play button on tvOS) to zoom-in detail page image. +5. Clear cache and go to detail page to see progressive loading. + +## Test + +SDWebImageSwiftUI has Unit Test to increase code quality. For SwiftUI, there are no official Unit Test solution provided by Apple. + +However, since SwiftUI is State-Based and Attributed-Implemented layout system, there are open source projects who provide the solution: + ++ [ViewInspector](https://github.com/nalexn/ViewInspector): Inspect View's runtime attribute value (like `.frame` modifier, `.image` value). We use this to test `AnimatedImage` and `WebImage`. It also allows the inspect to native UIView/NSView, which we use to test `ActivityIndicator` and `ProgressIndicator`. + +To run the test: + +1. Run `carthage build` on root directory to install the dependency. +2. Open `SDWebImageSwiftUI.xcodeproj`, wait for SwiftPM finishing downloading the test dependency. +3. Choose `SDWebImageSwiftUITests` scheme and start testing. + +We've already setup the CI pipeline, each PR will run the test case and upload the test report to [codecov](https://codecov.io/gh/SDWebImage/SDWebImageSwiftUI). + +## Screenshot + ++ iOS Demo + + + ++ macOS Demo + + + ++ tvOS Demo + + + ++ watchOS Demo + + + +## Extra Notes + +Besides all above things, this project can also ensure the following function available on Swift platform for SDWebImage itself. + ++ SwiftUI compatibility ++ Swift Package Manager integration ++ Swift source code compatibility and Swifty + +Which means, this project is one core use case and downstream dependency, which driven SDWebImage itself future development. + +## Author + +[DreamPiggy](https://github.com/dreampiggy) + +## Thanks + +- [SDWebImage](https://github.com/SDWebImage/SDWebImage) +- [libwebp](https://github.com/SDWebImage/libwebp-Xcode) +- [Kingfisher](https://github.com/onevcat/Kingfisher) +- [SwiftUIX](https://github.com/SwiftUIX/SwiftUIX) +- [Espera](https://github.com/JagCesar/Espera) +- [SwiftUI-Introspect](https://github.com/siteline/SwiftUI-Introspect) +- [ViewInspector](https://github.com/nalexn/ViewInspector) + +## License + +SDWebImageSwiftUI is available under the MIT license. See the LICENSE file for more info. + + diff --git a/NetflixCloneApp/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/AnimatedImage.swift b/NetflixCloneApp/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/AnimatedImage.swift new file mode 100644 index 0000000..d5df9c1 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/AnimatedImage.swift @@ -0,0 +1,858 @@ +/* + * This file is part of the SDWebImage package. + * (c) DreamPiggy + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +import SwiftUI +import SDWebImage + +#if os(iOS) || os(tvOS) || os(macOS) + +/// A coordinator object used for `AnimatedImage`native view bridge for UIKit/AppKit. +@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *) +public final class AnimatedImageCoordinator: NSObject { + + /// Any user-provided object for actual coordinator, such as delegate method, taget-action + public var object: Any? + + /// Any user-provided info stored into coordinator, such as status value used for coordinator + public var userInfo: [AnyHashable : Any]? +} + +/// Data Binding Object, only properties in this object can support changes from user with @State and refresh +@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *) +final class AnimatedImageModel : ObservableObject { + /// URL image + @Published var url: URL? + @Published var webOptions: SDWebImageOptions = [] + @Published var webContext: [SDWebImageContextOption : Any]? = nil + /// Name image + @Published var name: String? + @Published var bundle: Bundle? + /// Data image + @Published var data: Data? + @Published var scale: CGFloat = 1 +} + +/// Loading Binding Object, only properties in this object can support changes from user with @State and refresh +@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *) +final class AnimatedLoadingModel : ObservableObject, IndicatorReportable { + @Published var image: PlatformImage? // loaded image, note when progressive loading, this will published multiple times with different partial image + @Published var isLoading: Bool = false // whether network is loading or cache is querying, should only be used for indicator binding + @Published var progress: Double = 0 // network progress, should only be used for indicator binding + + /// Used for loading status recording to avoid recursive `updateView`. There are 3 types of loading (Name/Data/URL) + @Published var imageName: String? + @Published var imageData: Data? + @Published var imageURL: URL? +} + +/// Completion Handler Binding Object, supports dynamic @State changes +@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *) +final class AnimatedImageHandler: ObservableObject { + // Completion Handler + @Published var successBlock: ((PlatformImage, Data?, SDImageCacheType) -> Void)? + @Published var failureBlock: ((Error) -> Void)? + @Published var progressBlock: ((Int, Int) -> Void)? + // Coordinator Handler + @Published var viewCreateBlock: ((PlatformView, AnimatedImage.Context) -> Void)? + @Published var viewUpdateBlock: ((PlatformView, AnimatedImage.Context) -> Void)? +} + +/// Layout Binding Object, supports dynamic @State changes +@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *) +final class AnimatedImageLayout : ObservableObject { + var contentMode: ContentMode? + var aspectRatio: CGFloat? + var capInsets: EdgeInsets = EdgeInsets() + var resizingMode: Image.ResizingMode? + var renderingMode: Image.TemplateRenderingMode? + var interpolation: Image.Interpolation? + var antialiased: Bool = false +} + +/// Configuration Binding Object, supports dynamic @State changes +@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *) +final class AnimatedImageConfiguration: ObservableObject { + var incrementalLoad: Bool? + var maxBufferSize: UInt? + var customLoopCount: UInt? + var runLoopMode: RunLoop.Mode? + var pausable: Bool? + var purgeable: Bool? + var playbackRate: Double? + var playbackMode: SDAnimatedImagePlaybackMode? + // These configurations only useful for web image loading + var indicator: SDWebImageIndicator? + var transition: SDWebImageTransition? + var placeholder: PlatformImage? + var placeholderView: PlatformView? { + didSet { + oldValue?.removeFromSuperview() + } + } +} + +/// A Image View type to load image from url, data or bundle. Supports animated and static image format. +@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *) +public struct AnimatedImage : PlatformViewRepresentable { + @ObservedObject var imageModel = AnimatedImageModel() + @ObservedObject var imageLoading = AnimatedLoadingModel() + @ObservedObject var imageHandler = AnimatedImageHandler() + @ObservedObject var imageLayout = AnimatedImageLayout() + @ObservedObject var imageConfiguration = AnimatedImageConfiguration() + + static var viewDestroyBlock: ((PlatformView, Coordinator) -> Void)? + + /// A Binding to control the animation. You can bind external logic to control the animation status. + /// True to start animation, false to stop animation. + @Binding public var isAnimating: Bool + + /// Create an animated image with url, placeholder, custom options and context. + /// - Parameter url: The image url + /// - Parameter placeholder: The placeholder image to show during loading + /// - Parameter options: The options to use when downloading the image. See `SDWebImageOptions` for the possible values. + /// - Parameter context: A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold. + public init(url: URL?, options: SDWebImageOptions = [], context: [SDWebImageContextOption : Any]? = nil) { + self.init(url: url, options: options, context: context, isAnimating: .constant(true)) + } + + /// Create an animated image with url, placeholder, custom options and context, including animation control binding. + /// - Parameter url: The image url + /// - Parameter placeholder: The placeholder image to show during loading + /// - Parameter options: The options to use when downloading the image. See `SDWebImageOptions` for the possible values. + /// - Parameter context: A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold. + /// - Parameter isAnimating: The binding for animation control + public init(url: URL?, options: SDWebImageOptions = [], context: [SDWebImageContextOption : Any]? = nil, isAnimating: Binding) { + self._isAnimating = isAnimating + self.imageModel.url = url + self.imageModel.webOptions = options + self.imageModel.webContext = context + } + + /// Create an animated image with name and bundle. + /// - Note: Asset Catalog is not supported. + /// - Parameter name: The image name + /// - Parameter bundle: The bundle contains image + public init(name: String, bundle: Bundle? = nil) { + self.init(name: name, bundle: bundle, isAnimating: .constant(true)) + } + + /// Create an animated image with name and bundle, including animation control binding. + /// - Note: Asset Catalog is not supported. + /// - Parameter name: The image name + /// - Parameter bundle: The bundle contains image + /// - Parameter isAnimating: The binding for animation control + public init(name: String, bundle: Bundle? = nil, isAnimating: Binding) { + self._isAnimating = isAnimating + self.imageModel.name = name + self.imageModel.bundle = bundle + } + + /// Create an animated image with data and scale. + /// - Parameter data: The image data + /// - Parameter scale: The scale factor + public init(data: Data, scale: CGFloat = 1) { + self.init(data: data, scale: scale, isAnimating: .constant(true)) + } + + /// Create an animated image with data and scale, including animation control binding. + /// - Parameter data: The image data + /// - Parameter scale: The scale factor + /// - Parameter isAnimating: The binding for animation control + public init(data: Data, scale: CGFloat = 1, isAnimating: Binding) { + self._isAnimating = isAnimating + self.imageModel.data = data + self.imageModel.scale = scale + } + + #if os(macOS) + public typealias NSViewType = AnimatedImageViewWrapper + #elseif os(iOS) || os(tvOS) + public typealias UIViewType = AnimatedImageViewWrapper + #endif + + public typealias Coordinator = AnimatedImageCoordinator + + public func makeCoordinator() -> Coordinator { + AnimatedImageCoordinator() + } + + #if os(macOS) + public func makeNSView(context: NSViewRepresentableContext) -> AnimatedImageViewWrapper { + makeView(context: context) + } + + public func updateNSView(_ nsView: AnimatedImageViewWrapper, context: NSViewRepresentableContext) { + updateView(nsView, context: context) + } + + public static func dismantleNSView(_ nsView: AnimatedImageViewWrapper, coordinator: Coordinator) { + dismantleView(nsView, coordinator: coordinator) + } + #elseif os(iOS) || os(tvOS) + public func makeUIView(context: UIViewRepresentableContext) -> AnimatedImageViewWrapper { + makeView(context: context) + } + + public func updateUIView(_ uiView: AnimatedImageViewWrapper, context: UIViewRepresentableContext) { + updateView(uiView, context: context) + } + + public static func dismantleUIView(_ uiView: AnimatedImageViewWrapper, coordinator: Coordinator) { + dismantleView(uiView, coordinator: coordinator) + } + #endif + + func setupIndicator(_ view: AnimatedImageViewWrapper, context: Context) { + view.wrapped.sd_imageIndicator = imageConfiguration.indicator + view.wrapped.sd_imageTransition = imageConfiguration.transition + if let placeholderView = imageConfiguration.placeholderView { + placeholderView.removeFromSuperview() + placeholderView.isHidden = true + // Placeholder View should below the Indicator View + if let indicatorView = imageConfiguration.indicator?.indicatorView { + #if os(macOS) + view.wrapped.addSubview(placeholderView, positioned: .below, relativeTo: indicatorView) + #else + view.wrapped.insertSubview(placeholderView, belowSubview: indicatorView) + #endif + } else { + view.wrapped.addSubview(placeholderView) + } + placeholderView.bindFrameToSuperviewBounds() + } + } + + func loadImage(_ view: AnimatedImageViewWrapper, context: Context) { + self.imageLoading.isLoading = true + let options = imageModel.webOptions + if options.contains(.delayPlaceholder) { + self.imageConfiguration.placeholderView?.isHidden = true + } else { + self.imageConfiguration.placeholderView?.isHidden = false + } + var context = imageModel.webContext ?? [:] + context[.animatedImageClass] = SDAnimatedImage.self + view.wrapped.sd_internalSetImage(with: imageModel.url, placeholderImage: imageConfiguration.placeholder, options: options, context: context, setImageBlock: nil, progress: { (receivedSize, expectedSize, _) in + let progress: Double + if (expectedSize > 0) { + progress = Double(receivedSize) / Double(expectedSize) + } else { + progress = 0 + } + DispatchQueue.main.async { + self.imageLoading.progress = progress + } + self.imageHandler.progressBlock?(receivedSize, expectedSize) + }) { (image, data, error, cacheType, finished, _) in + if #available(iOS 14.0, macOS 11.0, watchOS 7.0, tvOS 14.0, *) { + // Do nothing. on iOS 14's SwiftUI, the @Published will always trigger another `updateUIView` call with new UIView instance. + } else { + // This is a hack because of iOS 13's SwiftUI bug, the @Published does not trigger another `updateUIView` call + // Here I have to use UIKit/AppKit API to triger the same effect (the window change implicitly cause re-render) + if let hostingView = view.findHostingView() { + if let _ = hostingView.window { + #if os(macOS) + hostingView.viewDidMoveToWindow() + #else + hostingView.didMoveToWindow() + #endif + } + } + } + self.imageLoading.image = image + self.imageLoading.isLoading = false + self.imageLoading.progress = 1 + if let image = image { + self.imageConfiguration.placeholderView?.isHidden = true + self.imageHandler.successBlock?(image, data, cacheType) + } else { + self.imageConfiguration.placeholderView?.isHidden = false + self.imageHandler.failureBlock?(error ?? NSError()) + } + } + } + + func makeView(context: Context) -> AnimatedImageViewWrapper { + let view = AnimatedImageViewWrapper() + if let viewCreateBlock = imageHandler.viewCreateBlock { + viewCreateBlock(view.wrapped, context) + } + return view + } + + func updateView(_ view: AnimatedImageViewWrapper, context: Context) { + // Refresh image, imageModel is the Source of Truth, switch the type + // Although we have Source of Truth, we can check the previous value, to avoid re-generate SDAnimatedImage, which is performance-cost. + if let name = imageModel.name, name != imageLoading.imageName { + #if os(macOS) + let image = SDAnimatedImage(named: name, in: imageModel.bundle) + #else + let image = SDAnimatedImage(named: name, in: imageModel.bundle, compatibleWith: nil) + #endif + imageLoading.imageName = name + view.wrapped.image = image + } else if let data = imageModel.data, data != imageLoading.imageData { + let image = SDAnimatedImage(data: data, scale: imageModel.scale) + imageLoading.imageData = data + view.wrapped.image = image + } else if let url = imageModel.url { + // Determine if image already been loaded and URL is match + var shouldLoad: Bool + if url != imageLoading.imageURL { + // Change the URL, need new loading + shouldLoad = true + imageLoading.imageURL = url + } else { + // Same URL, check if already loaded + if imageLoading.isLoading { + shouldLoad = false + } else if let image = imageLoading.image { + shouldLoad = false + view.wrapped.image = image + } else { + shouldLoad = true + } + } + if shouldLoad { + setupIndicator(view, context: context) + loadImage(view, context: context) + } + } + + #if os(macOS) + if self.isAnimating != view.wrapped.animates { + view.wrapped.animates = self.isAnimating + } + #else + if self.isAnimating != view.wrapped.isAnimating { + if self.isAnimating { + view.wrapped.startAnimating() + } else { + view.wrapped.stopAnimating() + } + } + #endif + + configureView(view, context: context) + layoutView(view, context: context) + if let viewUpdateBlock = imageHandler.viewUpdateBlock { + viewUpdateBlock(view.wrapped, context) + } + } + + static func dismantleView(_ view: AnimatedImageViewWrapper, coordinator: Coordinator) { + view.wrapped.sd_cancelCurrentImageLoad() + #if os(macOS) + view.wrapped.animates = false + #else + view.wrapped.stopAnimating() + #endif + if let viewDestroyBlock = viewDestroyBlock { + viewDestroyBlock(view.wrapped, coordinator) + } + } + + func layoutView(_ view: AnimatedImageViewWrapper, context: Context) { + // AspectRatio && ContentMode + #if os(macOS) + let contentMode: NSImageScaling + #elseif os(iOS) || os(tvOS) + let contentMode: UIView.ContentMode + #endif + if let _ = imageLayout.aspectRatio { + // If `aspectRatio` is not `nil`, always scale to fill and SwiftUI will layout the container with custom aspect ratio. + #if os(macOS) + contentMode = .scaleAxesIndependently + #elseif os(iOS) || os(tvOS) + contentMode = .scaleToFill + #endif + } else { + // If `aspectRatio` is `nil`, the resulting view maintains this view's aspect ratio. + switch imageLayout.contentMode { + case .fill: + #if os(macOS) + // Actually, NSImageView have no `.aspectFill` unlike UIImageView, only `CALayerContentsGravity.resizeAspectFill` have the same concept + // However, using `.scaleProportionallyUpOrDown`, SwiftUI still layout the HostingView correctly, so this is OK + contentMode = .scaleProportionallyUpOrDown + #elseif os(iOS) || os(tvOS) + contentMode = .scaleAspectFill + #endif + case .fit: + #if os(macOS) + contentMode = .scaleProportionallyUpOrDown + #elseif os(iOS) || os(tvOS) + contentMode = .scaleAspectFit + #endif + case .none: + // If `contentMode` is not set at all, using scale to fill as SwiftUI default value + #if os(macOS) + contentMode = .scaleAxesIndependently + #elseif os(iOS) || os(tvOS) + contentMode = .scaleToFill + #endif + } + } + + #if os(macOS) + view.wrapped.imageScaling = contentMode + #else + view.wrapped.contentMode = contentMode + #endif + + // Resizable + if let _ = imageLayout.resizingMode { + view.resizable = true + } + + // Animated Image does not support resizing mode and rendering mode + if let image = view.wrapped.image, !image.conforms(to: SDAnimatedImageProtocol.self) { + var image = image + // ResizingMode + if let resizingMode = imageLayout.resizingMode, imageLayout.capInsets != EdgeInsets() { + #if os(macOS) + let capInsets = NSEdgeInsets(top: imageLayout.capInsets.top, left: imageLayout.capInsets.leading, bottom: imageLayout.capInsets.bottom, right: imageLayout.capInsets.trailing) + #else + let capInsets = UIEdgeInsets(top: imageLayout.capInsets.top, left: imageLayout.capInsets.leading, bottom: imageLayout.capInsets.bottom, right: imageLayout.capInsets.trailing) + #endif + switch resizingMode { + case .stretch: + #if os(macOS) + image.resizingMode = .stretch + image.capInsets = capInsets + #else + image = image.resizableImage(withCapInsets: capInsets, resizingMode: .stretch) + #endif + view.wrapped.image = image + case .tile: + #if os(macOS) + image.resizingMode = .tile + image.capInsets = capInsets + #else + image = image.resizableImage(withCapInsets: capInsets, resizingMode: .tile) + #endif + view.wrapped.image = image + @unknown default: + // Future cases, not implements + break + } + } + + // RenderingMode + if let renderingMode = imageLayout.renderingMode { + switch renderingMode { + case .template: + #if os(macOS) + image.isTemplate = true + #else + image = image.withRenderingMode(.alwaysTemplate) + #endif + view.wrapped.image = image + case .original: + #if os(macOS) + image.isTemplate = false + #else + image = image.withRenderingMode(.alwaysOriginal) + #endif + view.wrapped.image = image + @unknown default: + // Future cases, not implements + break + } + } + } + + // Interpolation + if let interpolation = imageLayout.interpolation { + switch interpolation { + case .high: + view.interpolationQuality = .high + case .medium: + view.interpolationQuality = .medium + case .low: + view.interpolationQuality = .low + case .none: + view.interpolationQuality = .none + @unknown default: + // Future cases, not implements + break + } + } else { + view.interpolationQuality = .default + } + + // Antialiased + view.shouldAntialias = imageLayout.antialiased + + view.invalidateIntrinsicContentSize() + } + + func configureView(_ view: AnimatedImageViewWrapper, context: Context) { + // IncrementalLoad + if let incrementalLoad = imageConfiguration.incrementalLoad { + view.wrapped.shouldIncrementalLoad = incrementalLoad + } else { + view.wrapped.shouldIncrementalLoad = true + } + + // MaxBufferSize + if let maxBufferSize = imageConfiguration.maxBufferSize { + view.wrapped.maxBufferSize = maxBufferSize + } else { + // automatically + view.wrapped.maxBufferSize = 0 + } + + // CustomLoopCount + if let customLoopCount = imageConfiguration.customLoopCount { + view.wrapped.shouldCustomLoopCount = true + view.wrapped.animationRepeatCount = Int(customLoopCount) + } else { + // disable custom loop count + view.wrapped.shouldCustomLoopCount = false + } + + // RunLoop Mode + if let runLoopMode = imageConfiguration.runLoopMode { + view.wrapped.runLoopMode = runLoopMode + } else { + view.wrapped.runLoopMode = .common + } + + // Pausable + if let pausable = imageConfiguration.pausable { + view.wrapped.resetFrameIndexWhenStopped = !pausable + } else { + view.wrapped.resetFrameIndexWhenStopped = false + } + + // Clear Buffer + if let purgeable = imageConfiguration.purgeable { + view.wrapped.clearBufferWhenStopped = purgeable + } else { + view.wrapped.clearBufferWhenStopped = false + } + + // Playback Rate + if let playbackRate = imageConfiguration.playbackRate { + view.wrapped.playbackRate = playbackRate + } else { + view.wrapped.playbackRate = 1.0 + } + + // Playback Mode + if let playbackMode = imageConfiguration.playbackMode { + view.wrapped.playbackMode = playbackMode + } else { + view.wrapped.playbackMode = .normal + } + } +} + +// Layout +@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *) +extension AnimatedImage { + + /// Configurate this view's image with the specified cap insets and options. + /// - Warning: Animated Image does not implementes. + /// - Parameter capInsets: The values to use for the cap insets. + /// - Parameter resizingMode: The resizing mode + public func resizable( + capInsets: EdgeInsets = EdgeInsets(), + resizingMode: Image.ResizingMode = .stretch) -> AnimatedImage + { + self.imageLayout.capInsets = capInsets + self.imageLayout.resizingMode = resizingMode + return self + } + + /// Configurate this view's rendering mode. + /// - Warning: Animated Image does not implementes. + /// - Parameter renderingMode: The resizing mode + public func renderingMode(_ renderingMode: Image.TemplateRenderingMode?) -> AnimatedImage { + self.imageLayout.renderingMode = renderingMode + return self + } + + /// Configurate this view's image interpolation quality + /// - Parameter interpolation: The interpolation quality + public func interpolation(_ interpolation: Image.Interpolation) -> AnimatedImage { + self.imageLayout.interpolation = interpolation + return self + } + + /// Configurate this view's image antialiasing + /// - Parameter isAntialiased: Whether or not to allow antialiasing + public func antialiased(_ isAntialiased: Bool) -> AnimatedImage { + self.imageLayout.antialiased = isAntialiased + return self + } +} + +// Aspect Ratio +@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *) +extension AnimatedImage { + /// Constrains this view's dimensions to the specified aspect ratio. + /// - Parameters: + /// - aspectRatio: The ratio of width to height to use for the resulting + /// view. If `aspectRatio` is `nil`, the resulting view maintains this + /// view's aspect ratio. + /// - contentMode: A flag indicating whether this view should fit or + /// fill the parent context. + /// - Returns: A view that constrains this view's dimensions to + /// `aspectRatio`, using `contentMode` as its scaling algorithm. + public func aspectRatio(_ aspectRatio: CGFloat? = nil, contentMode: ContentMode) -> some View { + // The `SwifUI.View.aspectRatio(_:contentMode:)` says: + // If `aspectRatio` is `nil`, the resulting view maintains this view's aspect ratio + // But 1: there are no public API to declare what `this view's aspect ratio` is + // So, if we don't override this method, SwiftUI ignore the content mode on actual ImageView + // To workaround, we want to call the default `SwifUI.View.aspectRatio(_:contentMode:)` method + // But 2: there are no way to call a Protocol Extention default implementation in Swift 5.1 + // So, we directly call the implementation detail modifier instead + // Fired Radar: FB7413534 + self.imageLayout.aspectRatio = aspectRatio + self.imageLayout.contentMode = contentMode + return self.modifier(_AspectRatioLayout(aspectRatio: aspectRatio, contentMode: contentMode)) + } + + /// Constrains this view's dimensions to the aspect ratio of the given size. + /// - Parameters: + /// - aspectRatio: A size specifying the ratio of width to height to use + /// for the resulting view. + /// - contentMode: A flag indicating whether this view should fit or + /// fill the parent context. + /// - Returns: A view that constrains this view's dimensions to + /// `aspectRatio`, using `contentMode` as its scaling algorithm. + public func aspectRatio(_ aspectRatio: CGSize, contentMode: ContentMode) -> some View { + return self.aspectRatio(aspectRatio.width / aspectRatio.height, contentMode: contentMode) + } + + /// Scales this view to fit its parent. + /// - Returns: A view that scales this view to fit its parent, + /// maintaining this view's aspect ratio. + public func scaledToFit() -> some View { + return self.aspectRatio(nil, contentMode: .fit) + } + + /// Scales this view to fill its parent. + /// - Returns: A view that scales this view to fit its parent, + /// maintaining this view's aspect ratio. + public func scaledToFill() -> some View { + return self.aspectRatio(nil, contentMode: .fill) + } +} + +// AnimatedImage Modifier +@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *) +extension AnimatedImage { + + /// Total loop count for animated image rendering. Defaults to nil. + /// - Note: Pass nil to disable customization, use the image itself loop count (`animatedImageLoopCount`) instead + /// - Parameter loopCount: The animation loop count + public func customLoopCount(_ loopCount: UInt?) -> AnimatedImage { + self.imageConfiguration.customLoopCount = loopCount + return self + } + + /// Provide a max buffer size by bytes. This is used to adjust frame buffer count and can be useful when the decoding cost is expensive (such as Animated WebP software decoding). Default is nil. + /// + /// `0` or nil means automatically adjust by calculating current memory usage. + /// `1` means without any buffer cache, each of frames will be decoded and then be freed after rendering. (Lowest Memory and Highest CPU) + /// `UInt.max` means cache all the buffer. (Lowest CPU and Highest Memory) + /// - Parameter bufferSize: The max buffer size + public func maxBufferSize(_ bufferSize: UInt?) -> AnimatedImage { + self.imageConfiguration.maxBufferSize = bufferSize + return self + } + + /// Whehter or not to enable incremental image load for animated image. See `SDAnimatedImageView` for detailed explanation for this. + /// - Note: If you are confused about this description, open Chrome browser to view some large GIF images with low network speed to see the animation behavior. + /// Default is true. Set to false to only render the static poster for incremental animated image. + /// - Parameter incrementalLoad: Whether or not to incremental load + public func incrementalLoad(_ incrementalLoad: Bool) -> AnimatedImage { + self.imageConfiguration.incrementalLoad = incrementalLoad + return self + } + + /// The runLoopMode when animation is playing on. Defaults is `.common` + /// You can specify a runloop mode to let it rendering. + /// - Note: This is useful for some cases, for example, always specify NSDefaultRunLoopMode, if you want to pause the animation when user scroll (for Mac user, drag the mouse or touchpad) + /// - Parameter runLoopMode: The runLoopMode for animation + public func runLoopMode(_ runLoopMode: RunLoop.Mode) -> AnimatedImage { + self.imageConfiguration.runLoopMode = runLoopMode + return self + } + + /// Whether or not to pause the animation (keep current frame), instead of stop the animation (frame index reset to 0). When `isAnimating` binding value changed to false. Defaults is true. + /// - Note: For some of use case, you may want to reset the frame index to 0 when stop, but some other want to keep the current frame index. + /// - Parameter pausable: Whether or not to pause the animation instead of stop the animation. + public func pausable(_ pausable: Bool) -> AnimatedImage { + self.imageConfiguration.pausable = pausable + return self + } + + /// Whether or not to clear frame buffer cache when stopped. Defaults is false. + /// Note: This is useful when you want to limit the memory usage during frequently visibility changes (such as image view inside a list view, then push and pop) + /// - Parameter purgeable: Whether or not to clear frame buffer cache when stopped. + public func purgeable(_ purgeable: Bool) -> AnimatedImage { + self.imageConfiguration.purgeable = purgeable + return self + } + + /// Control the animation playback rate. Default is 1.0. + /// `1.0` means the normal speed. + /// `0.0` means stopping the animation. + /// `0.0-1.0` means the slow speed. + /// `> 1.0` means the fast speed. + /// `< 0.0` is not supported currently and stop animation. (may support reverse playback in the future) + /// - Parameter playbackRate: The animation playback rate. + public func playbackRate(_ playbackRate: Double) -> AnimatedImage { + self.imageConfiguration.playbackRate = playbackRate + return self + } + + /// Control the animation playback mode. Default is .normal + /// - Parameter playbackMode: The playback mode, including normal order, reverse order, bounce order and reversed bounce order. + public func playbackMode(_ playbackMode: SDAnimatedImagePlaybackMode) -> AnimatedImage { + self.imageConfiguration.playbackMode = playbackMode + return self + } +} + +// Completion Handler +@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *) +extension AnimatedImage { + + /// Provide the action when image load fails. + /// - Parameters: + /// - action: The action to perform. The first arg is the error during loading. If `action` is `nil`, the call has no effect. + /// - Returns: A view that triggers `action` when this image load fails. + public func onFailure(perform action: ((Error) -> Void)? = nil) -> AnimatedImage { + self.imageHandler.failureBlock = action + return self + } + + /// Provide the action when image load successes. + /// - Parameters: + /// - action: The action to perform. The first arg is the loaded image, the second arg is the loaded image data, the third arg is the cache type loaded from. If `action` is `nil`, the call has no effect. + /// - Returns: A view that triggers `action` when this image load successes. + public func onSuccess(perform action: ((PlatformImage, Data?, SDImageCacheType) -> Void)? = nil) -> AnimatedImage { + self.imageHandler.successBlock = action + return self + } + + /// Provide the action when image load progress changes. + /// - Parameters: + /// - action: The action to perform. The first arg is the received size, the second arg is the total size, all in bytes. If `action` is `nil`, the call has no effect. + /// - Returns: A view that triggers `action` when this image load successes. + public func onProgress(perform action: ((Int, Int) -> Void)? = nil) -> AnimatedImage { + self.imageHandler.progressBlock = action + return self + } +} + +// View Coordinator Handler +@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *) +extension AnimatedImage { + + /// Provide the action when view representable create the native view. + /// - Parameter action: The action to perform. The first arg is the native view. The seconds arg is the context. + /// - Returns: A view that triggers `action` when view representable create the native view. + public func onViewCreate(perform action: ((PlatformView, Context) -> Void)? = nil) -> AnimatedImage { + self.imageHandler.viewCreateBlock = action + return self + } + + /// Provide the action when view representable update the native view. + /// - Parameter action: The action to perform. The first arg is the native view. The seconds arg is the context. + /// - Returns: A view that triggers `action` when view representable update the native view. + public func onViewUpdate(perform action: ((PlatformView, Context) -> Void)? = nil) -> AnimatedImage { + self.imageHandler.viewUpdateBlock = action + return self + } + + /// Provide the action when view representable destroy the native view + /// - Parameter action: The action to perform. The first arg is the native view. The seconds arg is the coordinator (with userInfo). + /// - Returns: A view that triggers `action` when view representable destroy the native view. + public static func onViewDestroy(perform action: ((PlatformView, Coordinator) -> Void)? = nil) { + self.viewDestroyBlock = action + } +} + +// Web Image convenience, based on UIKit/AppKit API +@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *) +extension AnimatedImage { + + /// Associate a placeholder when loading image with url + /// - Parameter content: A view that describes the placeholder. + /// - note: The differences between this and placeholder image, it's that placeholder image replace the image for image view, but this modify the View Hierarchy to overlay the placeholder hosting view + public func placeholder(@ViewBuilder content: () -> T) -> AnimatedImage where T : View { + #if os(macOS) + let hostingView = NSHostingView(rootView: content()) + #else + let hostingView = _UIHostingView(rootView: content()) + #endif + self.imageConfiguration.placeholderView = hostingView + return self + } + + /// Associate a placeholder image when loading image with url + /// - Parameter content: A view that describes the placeholder. + public func placeholder(_ image: PlatformImage?) -> AnimatedImage { + self.imageConfiguration.placeholder = image + return self + } + + /// Associate a indicator when loading image with url + /// - Note: If you do not need indicator, specify nil. Defaults to nil + /// - Parameter indicator: indicator, see more in `SDWebImageIndicator` + public func indicator(_ indicator: SDWebImageIndicator?) -> AnimatedImage { + self.imageConfiguration.indicator = indicator + return self + } + + /// Associate a transition when loading image with url + /// - Note: If you specify nil, do not do transition. Defautls to nil. + /// - Parameter transition: transition, see more in `SDWebImageTransition` + public func transition(_ transition: SDWebImageTransition?) -> AnimatedImage { + self.imageConfiguration.transition = transition + return self + } +} + +// Indicator +@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *) +extension AnimatedImage { + + /// Associate a indicator when loading image with url + /// - Parameter indicator: The indicator type, see `Indicator` + public func indicator(_ indicator: Indicator) -> some View where T : View { + return self.modifier(IndicatorViewModifier(reporter: self.imageLoading, indicator: indicator)) + } + + /// Associate a indicator when loading image with url, convenient method with block + /// - Parameter content: A view that describes the indicator. + public func indicator(@ViewBuilder content: @escaping (_ isAnimating: Binding, _ progress: Binding) -> T) -> some View where T : View { + return indicator(Indicator(content: content)) + } +} + +#if DEBUG +@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *) +struct AnimatedImage_Previews : PreviewProvider { + static var previews: some View { + Group { + AnimatedImage(url: URL(string: "http://assets.sbnation.com/assets/2512203/dogflops.gif")) + .resizable() + .aspectRatio(contentMode: .fit) + .padding() + } + } +} +#endif + +#endif diff --git a/NetflixCloneApp/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/Image.swift b/NetflixCloneApp/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/Image.swift new file mode 100644 index 0000000..28ba969 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/Image.swift @@ -0,0 +1,78 @@ +/* +* This file is part of the SDWebImage package. +* (c) DreamPiggy +* +* For the full copyright and license information, please view the LICENSE +* file that was distributed with this source code. +*/ + +import Foundation +import SwiftUI + +@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *) +extension Image { + @inlinable init(platformImage: PlatformImage) { + #if os(macOS) + self.init(nsImage: platformImage) + #else + self.init(uiImage: platformImage) + #endif + } +} + +@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *) +extension PlatformImage { + static var empty = PlatformImage() +} + +#if os(iOS) || os(tvOS) || os(watchOS) +@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *) +extension PlatformImage.Orientation { + @inlinable var toSwiftUI: Image.Orientation { + switch self { + case .up: + return .up + case .upMirrored: + return .upMirrored + case .down: + return .down + case .downMirrored: + return .downMirrored + case .left: + return .left + case .leftMirrored: + return .leftMirrored + case .right: + return .right + case .rightMirrored: + return .rightMirrored + @unknown default: + return .up + } + } +} + +@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *) +extension Image.Orientation { + @inlinable var toPlatform: PlatformImage.Orientation { + switch self { + case .up: + return .up + case .upMirrored: + return .upMirrored + case .down: + return .down + case .downMirrored: + return .downMirrored + case .left: + return .left + case .leftMirrored: + return .leftMirrored + case .right: + return .right + case .rightMirrored: + return .rightMirrored + } + } +} +#endif diff --git a/NetflixCloneApp/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/ImageManager.swift b/NetflixCloneApp/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/ImageManager.swift new file mode 100644 index 0000000..f5aaaef --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/ImageManager.swift @@ -0,0 +1,144 @@ +/* + * This file is part of the SDWebImage package. + * (c) DreamPiggy + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +import SwiftUI +import SDWebImage + +/// A Image observable object for handle image load process. This drive the Source of Truth for image loading status. +/// You can use `@ObservedObject` to associate each instance of manager to your View type, which update your view's body from SwiftUI framework when image was loaded. +@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *) +public final class ImageManager : ObservableObject { + /// loaded image, note when progressive loading, this will published multiple times with different partial image + @Published public var image: PlatformImage? + /// loaded image data, may be nil if hit from memory cache. This will only published once even on incremental image loading + @Published public var imageData: Data? + /// loaded image cache type, .none means from network + @Published public var cacheType: SDImageCacheType = .none + /// loading error, you can grab the error code and reason listed in `SDWebImageErrorDomain`, to provide a user interface about the error reason + @Published public var error: Error? + /// whether network is loading or cache is querying, should only be used for indicator binding + @Published public var isLoading: Bool = false + /// network progress, should only be used for indicator binding + @Published public var progress: Double = 0 + /// true means during incremental loading + @Published public var isIncremental: Bool = false + + var manager: SDWebImageManager + weak var currentOperation: SDWebImageOperation? = nil + var isFirstLoad: Bool = true // false after first call `load()` + + var url: URL? + var options: SDWebImageOptions + var context: [SDWebImageContextOption : Any]? + var successBlock: ((PlatformImage, Data?, SDImageCacheType) -> Void)? + var failureBlock: ((Error) -> Void)? + var progressBlock: ((Int, Int) -> Void)? + + /// Create a image manager for loading the specify url, with custom options and context. + /// - Parameter url: The image url + /// - Parameter options: The options to use when downloading the image. See `SDWebImageOptions` for the possible values. + /// - Parameter context: A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold. + public init(url: URL?, options: SDWebImageOptions = [], context: [SDWebImageContextOption : Any]? = nil) { + self.url = url + self.options = options + self.context = context + if let manager = context?[.customManager] as? SDWebImageManager { + self.manager = manager + } else { + self.manager = .shared + } + } + + /// Start to load the url operation + public func load() { + isFirstLoad = false + if currentOperation != nil { + return + } + self.isLoading = true + currentOperation = manager.loadImage(with: url, options: options, context: context, progress: { [weak self] (receivedSize, expectedSize, _) in + guard let self = self else { + return + } + let progress: Double + if (expectedSize > 0) { + progress = Double(receivedSize) / Double(expectedSize) + } else { + progress = 0 + } + DispatchQueue.main.async { + self.progress = progress + } + self.progressBlock?(receivedSize, expectedSize) + }) { [weak self] (image, data, error, cacheType, finished, _) in + guard let self = self else { + return + } + if let error = error as? SDWebImageError, error.code == .cancelled { + // Ignore user cancelled + // There are race condition when quick scroll + // Indicator modifier disapper and trigger `WebImage.body` + // So previous View struct call `onDisappear` and cancel the currentOperation + return + } + self.image = image + self.error = error + self.isIncremental = !finished + if finished { + self.imageData = data + self.cacheType = cacheType + self.isLoading = false + self.progress = 1 + if let image = image { + self.successBlock?(image, data, cacheType) + } else { + self.failureBlock?(error ?? NSError()) + } + } + } + } + + /// Cancel the current url loading + public func cancel() { + if let operation = currentOperation { + operation.cancel() + currentOperation = nil + isLoading = false + } + } + +} + +// Completion Handler +@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *) +extension ImageManager { + /// Provide the action when image load fails. + /// - Parameters: + /// - action: The action to perform. The first arg is the error during loading. If `action` is `nil`, the call has no effect. + public func setOnFailure(perform action: ((Error) -> Void)? = nil) { + self.failureBlock = action + } + + /// Provide the action when image load successes. + /// - Parameters: + /// - action: The action to perform. The first arg is the loaded image, the second arg is the loaded image data, the third arg is the cache type loaded from. If `action` is `nil`, the call has no effect. + public func setOnSuccess(perform action: ((PlatformImage, Data?, SDImageCacheType) -> Void)? = nil) { + self.successBlock = action + } + + /// Provide the action when image load progress changes. + /// - Parameters: + /// - action: The action to perform. The first arg is the received size, the second arg is the total size, all in bytes. If `action` is `nil`, the call has no effect. + public func setOnProgress(perform action: ((Int, Int) -> Void)? = nil) { + self.progressBlock = action + } +} + +// Indicator Reportor +@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *) +extension ImageManager: IndicatorReportable {} diff --git a/NetflixCloneApp/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/ImagePlayer.swift b/NetflixCloneApp/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/ImagePlayer.swift new file mode 100644 index 0000000..9c1e41e --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/ImagePlayer.swift @@ -0,0 +1,110 @@ +/* + * This file is part of the SDWebImage package. + * (c) DreamPiggy + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +import SwiftUI +import SDWebImage + +/// A Image observable object for handle aniamted image playback. This is used to avoid `@State` update may capture the View struct type and cause memory leak. +@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *) +public final class ImagePlayer : ObservableObject { + var player: SDAnimatedImagePlayer? + + /// Max buffer size + public var maxBufferSize: UInt? + + /// Custom loop count + public var customLoopCount: UInt? + + /// Animation runloop mode + public var runLoopMode: RunLoop.Mode = .common + + /// Animation playback rate + public var playbackRate: Double = 1.0 + + /// Animation playback mode + public var playbackMode: SDAnimatedImagePlaybackMode = .normal + + deinit { + player?.stopPlaying() + currentFrame = nil + } + + /// Current playing frame image + @Published public var currentFrame: PlatformImage? + + /// Current playing frame index + @Published public var currentFrameIndex: UInt = 0 + + /// Current playing loop count + @Published public var currentLoopCount: UInt = 0 + + /// Whether current player is valid for playing. This will check the internal player exist or not + public var isValid: Bool { + player != nil + } + + /// Current playing status + public var isPlaying: Bool { + player?.isPlaying ?? false + } + + /// Start the animation + public func startPlaying() { + player?.startPlaying() + } + + /// Pause the animation + public func pausePlaying() { + player?.pausePlaying() + } + + /// Stop the animation + public func stopPlaying() { + player?.stopPlaying() + } + + /// Seek to frame and loop count + public func seekToFrame(at: UInt, loopCount: UInt) { + player?.seekToFrame(at: at, loopCount: loopCount) + } + + /// Clear the frame buffer + public func clearFrameBuffer() { + player?.clearFrameBuffer() + } + + /// Setup the player using Animated Image. + /// After setup, you can always check `isValid` status, or call `startPlaying` to play the animation. + /// - Parameter image: animated image + public func setupPlayer(animatedImage: SDAnimatedImageProvider) { + if isValid { + return + } + if let imagePlayer = SDAnimatedImagePlayer(provider: animatedImage) { + imagePlayer.animationFrameHandler = { [weak self] (index, frame) in + self?.currentFrameIndex = index + self?.currentFrame = frame + } + imagePlayer.animationLoopHandler = { [weak self] (loopCount) in + self?.currentLoopCount = loopCount + } + // Setup configuration + if let maxBufferSize = maxBufferSize { + imagePlayer.maxBufferSize = maxBufferSize + } + if let customLoopCount = customLoopCount { + imagePlayer.totalLoopCount = customLoopCount + } + imagePlayer.runLoopMode = runLoopMode + imagePlayer.playbackRate = playbackRate + imagePlayer.playbackMode = playbackMode + + self.player = imagePlayer + } + } +} diff --git a/NetflixCloneApp/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/ImageViewWrapper.swift b/NetflixCloneApp/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/ImageViewWrapper.swift new file mode 100644 index 0000000..80f936e --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/ImageViewWrapper.swift @@ -0,0 +1,133 @@ +/* +* This file is part of the SDWebImage package. +* (c) DreamPiggy +* +* For the full copyright and license information, please view the LICENSE +* file that was distributed with this source code. +*/ + +import Foundation +import SDWebImage + +#if os(iOS) || os(tvOS) || os(macOS) + +/// Use wrapper to solve tne `UIImageView`/`NSImageView` frame size become image size issue (SwiftUI's Bug) +@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *) +public class AnimatedImageViewWrapper : PlatformView { + var wrapped = SDAnimatedImageView() + var interpolationQuality = CGInterpolationQuality.default + var shouldAntialias = false + var resizable = false + + override public func draw(_ rect: CGRect) { + #if os(macOS) + guard let ctx = NSGraphicsContext.current?.cgContext else { + return + } + #else + guard let ctx = UIGraphicsGetCurrentContext() else { + return + } + #endif + ctx.interpolationQuality = interpolationQuality + ctx.setShouldAntialias(shouldAntialias) + } + + #if os(macOS) + public override func layout() { + super.layout() + wrapped.frame = self.bounds + } + #else + public override func layoutSubviews() { + super.layoutSubviews() + wrapped.frame = self.bounds + } + #endif + + public override var intrinsicContentSize: CGSize { + /// Match the behavior of SwiftUI.Image, only when image is resizable, use the super implementation to calculate size + if resizable { + return super.intrinsicContentSize + } else { + /// Not resizable, always use image size, like SwiftUI.Image + return wrapped.intrinsicContentSize + } + } + + public override init(frame frameRect: CGRect) { + super.init(frame: frameRect) + addSubview(wrapped) + } + + public required init?(coder: NSCoder) { + super.init(coder: coder) + addSubview(wrapped) + } +} + +/// Use wrapper to solve the `UIProgressView`/`NSProgressIndicator` frame origin NaN crash (SwiftUI's bug) +@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *) +public class ProgressIndicatorWrapper : PlatformView { + #if os(macOS) + var wrapped = NSProgressIndicator() + #else + var wrapped = UIProgressView(progressViewStyle: .default) + #endif + + #if os(macOS) + public override func layout() { + super.layout() + wrapped.setFrameOrigin(CGPoint(x: round(self.bounds.width - wrapped.frame.width) / 2, y: round(self.bounds.height - wrapped.frame.height) / 2)) + } + #else + public override func layoutSubviews() { + super.layoutSubviews() + wrapped.center = self.center + } + #endif + + public override init(frame frameRect: CGRect) { + super.init(frame: frameRect) + addSubview(wrapped) + } + + public required init?(coder: NSCoder) { + super.init(coder: coder) + addSubview(wrapped) + } +} + +@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *) +extension PlatformView { + /// Adds constraints to this `UIView` instances `superview` object to make sure this always has the same size as the superview. + /// Please note that this has no effect if its `superview` is `nil` – add this `UIView` instance as a subview before calling this. + func bindFrameToSuperviewBounds() { + guard let superview = self.superview else { + print("Error! `superview` was nil – call `addSubview(view: UIView)` before calling `bindFrameToSuperviewBounds()` to fix this.") + return + } + + self.translatesAutoresizingMaskIntoConstraints = false + self.topAnchor.constraint(equalTo: superview.topAnchor, constant: 0).isActive = true + self.bottomAnchor.constraint(equalTo: superview.bottomAnchor, constant: 0).isActive = true + self.leadingAnchor.constraint(equalTo: superview.leadingAnchor, constant: 0).isActive = true + self.trailingAnchor.constraint(equalTo: superview.trailingAnchor, constant: 0).isActive = true + } + + /// Finding the HostingView for UIKit/AppKit View. + /// - Parameter entry: The entry platform view + /// - Returns: The hosting view. + func findHostingView() -> PlatformView? { + var superview = self.superview + while let s = superview { + if NSStringFromClass(type(of: s)).contains("HostingView") { + return s + } + superview = s.superview + } + return nil + } +} + +#endif diff --git a/NetflixCloneApp/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/Indicator/ActivityIndicator.swift b/NetflixCloneApp/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/Indicator/ActivityIndicator.swift new file mode 100644 index 0000000..7103c77 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/Indicator/ActivityIndicator.swift @@ -0,0 +1,82 @@ +/* +* This file is part of the SDWebImage package. +* (c) DreamPiggy +* +* For the full copyright and license information, please view the LICENSE +* file that was distributed with this source code. +*/ + +import SwiftUI + +#if os(macOS) || os(iOS) || os(tvOS) +/// An activity indicator (system style) +@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *) +public struct ActivityIndicator: PlatformViewRepresentable { + @Binding var isAnimating: Bool + var style: Style + + /// Create the indicator with animation binding and style + /// - Parameters: + /// - isAnimating: The binding to control the animation + /// - style: The indicator style + public init(_ isAnimating: Binding, style: Style = .medium) { + self._isAnimating = isAnimating + self.style = style + } + + #if os(macOS) + public typealias NSViewType = NSProgressIndicator + #elseif os(iOS) || os(tvOS) + public typealias UIViewType = UIActivityIndicatorView + #endif + + #if os(iOS) || os(tvOS) + public func makeUIView(context: UIViewRepresentableContext) -> UIActivityIndicatorView { + let activityStyle: UIActivityIndicatorView.Style + switch style { + case .medium: + activityStyle = .medium + case .large: + activityStyle = .large + } + let indicator = UIActivityIndicatorView(style: activityStyle) + indicator.hidesWhenStopped = true + return indicator + } + + public func updateUIView(_ uiView: UIActivityIndicatorView, context: UIViewRepresentableContext) { + isAnimating ? uiView.startAnimating() : uiView.stopAnimating() + } + #endif + + #if os(macOS) + public func makeNSView(context: NSViewRepresentableContext) -> NSProgressIndicator { + let controlSize: NSControl.ControlSize + switch style { + case .medium: + controlSize = .small + case .large: + controlSize = .regular + } + let indicator = NSProgressIndicator() + indicator.style = .spinning + indicator.controlSize = controlSize + indicator.isDisplayedWhenStopped = false + return indicator + } + + public func updateNSView(_ nsView: NSProgressIndicator, context: NSViewRepresentableContext) { + isAnimating ? nsView.startAnimation(nil) : nsView.stopAnimation(nil) + } + + #endif +} + +@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *) +extension ActivityIndicator { + public enum Style { + case medium + case large + } +} +#endif diff --git a/NetflixCloneApp/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/Indicator/Indicator.swift b/NetflixCloneApp/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/Indicator/Indicator.swift new file mode 100644 index 0000000..20d3aa7 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/Indicator/Indicator.swift @@ -0,0 +1,94 @@ +/* +* This file is part of the SDWebImage package. +* (c) DreamPiggy +* +* For the full copyright and license information, please view the LICENSE +* file that was distributed with this source code. +*/ + +import Foundation +import SwiftUI + +/// A type to build the indicator +@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *) +public struct Indicator where T : View { + var content: (Binding, Binding) -> T + + /// Create a indicator with builder + /// - Parameter builder: A builder to build indicator + /// - Parameter isAnimating: A Binding to control the animation. If image is during loading, the value is true, else (like start loading) the value is false. + /// - Parameter progress: A Binding to control the progress during loading. Value between [0.0, 1.0]. If no progress can be reported, the value is 0. + /// Associate a indicator when loading image with url + public init(@ViewBuilder content: @escaping (_ isAnimating: Binding, _ progress: Binding) -> T) { + self.content = content + } +} + +/// A protocol to report indicator progress +@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *) +public protocol IndicatorReportable : ObservableObject { + /// whether indicator is loading or not + var isLoading: Bool { get set } + /// indicator progress, should only be used for indicator binding, value between [0.0, 1.0] + var progress: Double { get set } +} + +/// A implementation detail View Modifier with indicator +/// SwiftUI View Modifier construced by using a internal View type which modify the `body` +/// It use type system to represent the view hierarchy, and Swift `some View` syntax to hide the type detail for users +@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *) +public struct IndicatorViewModifier : ViewModifier where T : View, V : IndicatorReportable { + + /// The progress reporter + @ObservedObject public var reporter: V + + /// The indicator + public var indicator: Indicator + + public func body(content: Content) -> some View { + ZStack { + content + if reporter.isLoading { + indicator.content($reporter.isLoading, $reporter.progress) + } + } + } +} + +#if os(macOS) || os(iOS) || os(tvOS) +@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *) +extension Indicator where T == ActivityIndicator { + /// Activity Indicator + public static var activity: Indicator { + Indicator { isAnimating, _ in + ActivityIndicator(isAnimating) + } + } + + /// Activity Indicator with style + /// - Parameter style: style + public static func activity(style: ActivityIndicator.Style) -> Indicator { + Indicator { isAnimating, _ in + ActivityIndicator(isAnimating, style: style) + } + } +} + +@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *) +extension Indicator where T == ProgressIndicator { + /// Progress Indicator + public static var progress: Indicator { + Indicator { isAnimating, progress in + ProgressIndicator(isAnimating, progress: progress) + } + } + + /// Progress Indicator with style + /// - Parameter style: style + public static func progress(style: ProgressIndicator.Style) -> Indicator { + Indicator { isAnimating, progress in + ProgressIndicator(isAnimating, progress: progress, style: style) + } + } +} +#endif diff --git a/NetflixCloneApp/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/Indicator/ProgressIndicator.swift b/NetflixCloneApp/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/Indicator/ProgressIndicator.swift new file mode 100644 index 0000000..1256ee8 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/Indicator/ProgressIndicator.swift @@ -0,0 +1,114 @@ +/* +* This file is part of the SDWebImage package. +* (c) DreamPiggy +* +* For the full copyright and license information, please view the LICENSE +* file that was distributed with this source code. +*/ + +import SwiftUI + +#if os(macOS) || os(iOS) || os(tvOS) +/// A progress bar indicator (system style) +@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *) +public struct ProgressIndicator: PlatformViewRepresentable { + @Binding var isAnimating: Bool + @Binding var progress: Double + var style: Style + + /// Create indicator with animation binding, progress binding and the style + /// - Parameters: + /// - isAnimating: The binding to control the animation + /// - progress: The binding to update the progress + /// - style: The indicator style + public init(_ isAnimating: Binding, progress: Binding, style: Style = .default) { + self._isAnimating = isAnimating + self._progress = progress + self.style = style + } + + #if os(macOS) + public typealias NSViewType = ProgressIndicatorWrapper + #elseif os(iOS) || os(tvOS) + public typealias UIViewType = ProgressIndicatorWrapper + #endif + + #if os(iOS) || os(tvOS) + public func makeUIView(context: UIViewRepresentableContext) -> ProgressIndicatorWrapper { + let progressStyle: UIProgressView.Style + switch style { + #if os(iOS) + case .bar: + progressStyle = .bar + #endif + case .default: + progressStyle = .default + } + let uiView = ProgressIndicatorWrapper() + let view = uiView.wrapped + view.progressViewStyle = progressStyle + return uiView + } + + public func updateUIView(_ uiView: ProgressIndicatorWrapper, context: UIViewRepresentableContext) { + let view = uiView.wrapped + if isAnimating { + view.setProgress(Float(progress), animated: true) + } else { + if progress == 0 { + view.isHidden = false + view.progress = 0 + } else { + view.isHidden = true + view.progress = 1 + } + } + } + #endif + + #if os(macOS) + public func makeNSView(context: NSViewRepresentableContext) -> ProgressIndicatorWrapper { + let nsView = ProgressIndicatorWrapper() + let view = nsView.wrapped + view.style = .bar + view.isDisplayedWhenStopped = false + view.controlSize = .small + view.frame = CGRect(x: 0, y: 0, width: 160, height: 0) // Width from `UIProgressView` default width + view.sizeToFit() + view.autoresizingMask = [.maxXMargin, .minXMargin, .maxYMargin, .minYMargin] + return nsView + } + + public func updateNSView(_ nsView: ProgressIndicatorWrapper, context: NSViewRepresentableContext) { + let view = nsView.wrapped + if isAnimating { + view.isIndeterminate = false + view.doubleValue = Double(progress) * 100 + view.startAnimation(nil) + } else { + if progress == 0 { + view.isHidden = false + view.isIndeterminate = true + view.doubleValue = 0 + view.stopAnimation(nil) + } else { + view.isHidden = true + view.isIndeterminate = false + view.doubleValue = 100 + view.stopAnimation(nil) + } + } + } + #endif +} + +@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *) +extension ProgressIndicator { + public enum Style { + case `default` + #if os(iOS) + case bar + #endif + } +} +#endif diff --git a/NetflixCloneApp/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/SDWebImageSwiftUI.swift b/NetflixCloneApp/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/SDWebImageSwiftUI.swift new file mode 100644 index 0000000..9c0e71a --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/SDWebImageSwiftUI.swift @@ -0,0 +1,64 @@ +/* + * This file is part of the SDWebImage package. + * (c) DreamPiggy + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +import Foundation +import SwiftUI +@_exported import SDWebImage // Automatically import SDWebImage + +#if os(macOS) +@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *) +public typealias PlatformImage = NSImage +#else +@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *) +public typealias PlatformImage = UIImage +#endif + +#if os(macOS) +@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *) +public typealias PlatformView = NSView +#endif +#if os(iOS) || os(tvOS) +@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *) +public typealias PlatformView = UIView +#endif +#if os(watchOS) +@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *) +public typealias PlatformView = WKInterfaceObject +#endif + +#if os(macOS) +@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *) +public typealias PlatformViewRepresentable = NSViewRepresentable +#endif +#if os(iOS) || os(tvOS) +@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *) +public typealias PlatformViewRepresentable = UIViewRepresentable +#endif +#if os(watchOS) +@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *) +public typealias PlatformViewRepresentable = WKInterfaceObjectRepresentable +#endif + +#if os(macOS) +@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *) +extension NSViewRepresentable { + typealias PlatformViewType = NSViewType +} +#endif +#if os(iOS) || os(tvOS) +@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *) +extension UIViewRepresentable { + typealias PlatformViewType = UIViewType +} +#endif +#if os(watchOS) +@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *) +extension WKInterfaceObjectRepresentable { + typealias PlatformViewType = WKInterfaceObjectType +} +#endif diff --git a/NetflixCloneApp/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/SwiftUICompatibility.swift b/NetflixCloneApp/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/SwiftUICompatibility.swift new file mode 100644 index 0000000..6a3b987 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/SwiftUICompatibility.swift @@ -0,0 +1,84 @@ +/* + * This file is part of the SDWebImage package. + * (c) DreamPiggy + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +import Foundation +import SwiftUI + +#if os(iOS) || os(tvOS) || os(macOS) + +@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *) +struct PlatformAppear: PlatformViewRepresentable { + let appearAction: () -> Void + let disappearAction: () -> Void + + #if os(iOS) || os(tvOS) + func makeUIView(context: Context) -> some UIView { + let view = PlatformAppearView() + view.appearAction = appearAction + view.disappearAction = disappearAction + return view + } + + func updateUIView(_ uiView: UIViewType, context: Context) {} + #endif + #if os(macOS) + func makeNSView(context: Context) -> some NSView { + let view = PlatformAppearView() + view.appearAction = appearAction + view.disappearAction = disappearAction + return view + } + + func updateNSView(_ nsView: NSViewType, context: Context) {} + #endif +} + +@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *) +class PlatformAppearView: PlatformView { + var appearAction: () -> Void = {} + var disappearAction: () -> Void = {} + + #if os(iOS) || os(tvOS) + override func willMove(toWindow newWindow: UIWindow?) { + if newWindow != nil { + appearAction() + } else { + disappearAction() + } + } + #endif + + #if os(macOS) + override func viewWillMove(toWindow newWindow: NSWindow?) { + if newWindow != nil { + appearAction() + } else { + disappearAction() + } + } + #endif +} + +#endif + +@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *) +extension View { + /// Used UIKit/AppKit behavior to detect the SwiftUI view's visibility. + /// This hack is because of SwiftUI 1.0/2.0 buggy behavior. The built-in `onAppear` and `onDisappear` is so massive on some cases. Where UIKit/AppKit is solid. + /// - Parameters: + /// - appear: The action when view appears + /// - disappear: The action when view disappears + /// - Returns: Some view + func onPlatformAppear(appear: @escaping () -> Void = {}, disappear: @escaping () -> Void = {}) -> some View { + #if os(iOS) || os(tvOS) || os(macOS) + return self.background(PlatformAppear(appearAction: appear, disappearAction: disappear)) + #else + return self.onAppear(perform: appear).onDisappear(perform: disappear) + #endif + } +} diff --git a/NetflixCloneApp/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/Transition/Transition.swift b/NetflixCloneApp/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/Transition/Transition.swift new file mode 100644 index 0000000..c4a908f --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/Transition/Transition.swift @@ -0,0 +1,93 @@ +/* +* This file is part of the SDWebImage package. +* (c) DreamPiggy +* +* For the full copyright and license information, please view the LICENSE +* file that was distributed with this source code. +*/ + +import SwiftUI + +@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *) +extension AnyTransition { + + /// Fade-in transition + public static var fade: AnyTransition { + let insertion = AnyTransition.opacity + let removal = AnyTransition.identity + return AnyTransition.asymmetric(insertion: insertion, removal: removal) + } + + /// Fade-in transition with duration + /// - Parameter duration: transition duration, use ease-in-out + /// - Returns: A transition with duration + public static func fade(duration: Double) -> AnyTransition { + let insertion = AnyTransition.opacity.animation(.easeInOut(duration: duration)) + let removal = AnyTransition.identity + return AnyTransition.asymmetric(insertion: insertion, removal: removal) + } + + /// Flip from left transition + public static var flipFromLeft: AnyTransition { + let insertion = AnyTransition.move(edge: .leading) + let removal = AnyTransition.identity + return AnyTransition.asymmetric(insertion: insertion, removal: removal) + } + + /// Flip from left transition with duration + /// - Parameter duration: transition duration, use ease-in-out + /// - Returns: A transition with duration + public static func flipFromLeft(duration: Double) -> AnyTransition { + let insertion = AnyTransition.move(edge: .leading).animation(.easeInOut(duration: duration)) + let removal = AnyTransition.identity + return AnyTransition.asymmetric(insertion: insertion, removal: removal) + } + + /// Flip from right transition + public static var flipFromRight: AnyTransition { + let insertion = AnyTransition.move(edge: .trailing) + let removal = AnyTransition.identity + return AnyTransition.asymmetric(insertion: insertion, removal: removal) + } + + /// Flip from right transition with duration + /// - Parameter duration: transition duration, use ease-in-out + /// - Returns: A transition with duration + public static func flipFromRight(duration: Double) -> AnyTransition { + let insertion = AnyTransition.move(edge: .trailing).animation(.easeInOut(duration: duration)) + let removal = AnyTransition.identity + return AnyTransition.asymmetric(insertion: insertion, removal: removal) + } + + /// Flip from top transition + public static var flipFromTop: AnyTransition { + let insertion = AnyTransition.move(edge: .top) + let removal = AnyTransition.identity + return AnyTransition.asymmetric(insertion: insertion, removal: removal) + } + + /// Flip from top transition with duration + /// - Parameter duration: transition duration, use ease-in-out + /// - Returns: A transition with duration + public static func flipFromTop(duration: Double) -> AnyTransition { + let insertion = AnyTransition.move(edge: .top).animation(.easeInOut(duration: duration)) + let removal = AnyTransition.identity + return AnyTransition.asymmetric(insertion: insertion, removal: removal) + } + + /// Flip from bottom transition + public static var flipFromBottom: AnyTransition { + let insertion = AnyTransition.move(edge: .bottom) + let removal = AnyTransition.identity + return AnyTransition.asymmetric(insertion: insertion, removal: removal) + } + + /// Flip from bottom transition with duration + /// - Parameter duration: transition duration, use ease-in-out + /// - Returns: A transition with duration + public static func flipFromBottom(duration: Double) -> AnyTransition { + let insertion = AnyTransition.move(edge: .bottom).animation(.easeInOut(duration: duration)) + let removal = AnyTransition.identity + return AnyTransition.asymmetric(insertion: insertion, removal: removal) + } +} diff --git a/NetflixCloneApp/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/WebImage.swift b/NetflixCloneApp/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/WebImage.swift new file mode 100644 index 0000000..6e0c3f3 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Classes/WebImage.swift @@ -0,0 +1,397 @@ +/* + * This file is part of the SDWebImage package. + * (c) DreamPiggy + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +import SwiftUI +import SDWebImage + +/// A Image View type to load image from url. Supports static/animated image format. +@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *) +public struct WebImage : View { + var configurations: [(Image) -> Image] = [] + + var placeholder: AnyView? + var retryOnAppear: Bool = true + var cancelOnDisappear: Bool = true + var pausable: Bool = true + var purgeable: Bool = false + + @ObservedObject var imageManager: ImageManager + + /// A Binding to control the animation. You can bind external logic to control the animation status. + /// True to start animation, false to stop animation. + @Binding public var isAnimating: Bool + + @ObservedObject var imagePlayer: ImagePlayer + + /// Create a web image with url, placeholder, custom options and context. + /// - Parameter url: The image url + /// - Parameter options: The options to use when downloading the image. See `SDWebImageOptions` for the possible values. + /// - Parameter context: A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold. + public init(url: URL?, options: SDWebImageOptions = [], context: [SDWebImageContextOption : Any]? = nil) { + self.init(url: url, options: options, context: context, isAnimating: .constant(true)) + } + + /// Create a web image with url, placeholder, custom options and context. Optional can support animated image using Binding. + /// - Parameter url: The image url + /// - Parameter options: The options to use when downloading the image. See `SDWebImageOptions` for the possible values. + /// - Parameter context: A context contains different options to perform specify changes or processes, see `SDWebImageContextOption`. This hold the extra objects which `options` enum can not hold. + /// - Parameter isAnimating: The binding for animation control. The binding value should be `true` when initialized to setup the correct animated image class. If not, you must provide the `.animatedImageClass` explicitly. When the animation started, this binding can been used to start / stop the animation. + public init(url: URL?, options: SDWebImageOptions = [], context: [SDWebImageContextOption : Any]? = nil, isAnimating: Binding) { + self._isAnimating = isAnimating + var context = context ?? [:] + // provide animated image class if the initialized `isAnimating` is true, user can still custom the image class if they want + if isAnimating.wrappedValue { + if context[.animatedImageClass] == nil { + context[.animatedImageClass] = SDAnimatedImage.self + } + } + self.imageManager = ImageManager(url: url, options: options, context: context) + self.imagePlayer = ImagePlayer() + } + + public var body: some View { + // This solve the case when WebImage created with new URL, but `onAppear` not been called, for example, some transaction indeterminate state, SwiftUI :) + if imageManager.isFirstLoad { + imageManager.load() + } + return Group { + if let image = imageManager.image { + if isAnimating && !imageManager.isIncremental { + setupPlayer() + .onPlatformAppear(appear: { + self.imagePlayer.startPlaying() + }, disappear: { + if self.pausable { + self.imagePlayer.pausePlaying() + } else { + self.imagePlayer.stopPlaying() + } + if self.purgeable { + self.imagePlayer.clearFrameBuffer() + } + }) + } else { + if let currentFrame = imagePlayer.currentFrame { + configure(image: currentFrame) + } else { + configure(image: image) + } + } + } else { + setupPlaceholder() + .onPlatformAppear(appear: { + // Load remote image when first appear + if self.imageManager.isFirstLoad { + self.imageManager.load() + return + } + guard self.retryOnAppear else { return } + // When using prorgessive loading, the new partial image will cause onAppear. Filter this case + if self.imageManager.image == nil && !self.imageManager.isIncremental { + self.imageManager.load() + } + }, disappear: { + guard self.cancelOnDisappear else { return } + // When using prorgessive loading, the previous partial image will cause onDisappear. Filter this case + if self.imageManager.image == nil && !self.imageManager.isIncremental { + self.imageManager.cancel() + } + }) + } + } + } + + /// Configure the platform image into the SwiftUI rendering image + func configure(image: PlatformImage) -> some View { + // Actual rendering SwiftUI image + let result: Image + // NSImage works well with SwiftUI, include Vector and EXIF images. + #if os(macOS) + result = Image(nsImage: image) + #else + // Fix the SwiftUI.Image rendering issue, like when use EXIF UIImage, the `.aspectRatio` does not works. SwiftUI's Bug :). See #101 + // Always prefers `Image(decorative:scale:)` but not `Image(uiImage:scale:) to avoid bug on `TabbarItem`. See #175 + var cgImage: CGImage? + // Case 1: Vector Image, draw bitmap image + if image.sd_isVector { + // ensure CGImage is nil + if image.cgImage == nil { + // draw vector into bitmap with the screen scale (behavior like AppKit) + #if os(iOS) || os(tvOS) + let scale = UIScreen.main.scale + #else + let scale = WKInterfaceDevice.current().screenScale + #endif + UIGraphicsBeginImageContextWithOptions(image.size, false, scale) + image.draw(at: .zero) + cgImage = UIGraphicsGetImageFromCurrentImageContext()?.cgImage + UIGraphicsEndImageContext() + } else { + cgImage = image.cgImage + } + } else { + // Case 2: EXIF Image and Bitmap Image, prefers CGImage + cgImage = image.cgImage + } + // If we have CGImage, use CGImage based API, else use UIImage based API + if let cgImage = cgImage { + let scale = image.scale + let orientation = image.imageOrientation.toSwiftUI + result = Image(decorative: cgImage, scale: scale, orientation: orientation) + } else { + result = Image(uiImage: image) + } + #endif + + // Should not use `EmptyView`, which does not respect to the container's frame modifier + // Using a empty image instead for better compatible + return configurations.reduce(result) { (previous, configuration) in + configuration(previous) + } + } + + /// Animated Image Support + func setupPlayer() -> some View { + if let currentFrame = imagePlayer.currentFrame { + return configure(image: currentFrame) + } else { + if let animatedImage = imageManager.image as? SDAnimatedImageProvider { + self.imagePlayer.setupPlayer(animatedImage: animatedImage) + self.imagePlayer.startPlaying() + } + return configure(image: imageManager.image!) + } + } + + /// Placeholder View Support + func setupPlaceholder() -> some View { + // Don't use `Group` because it will trigger `.onAppear` and `.onDisappear` when condition view removed, treat placeholder as an entire component + if let placeholder = placeholder { + // If use `.delayPlaceholder`, the placeholder is applied after loading failed, hide during loading :) + if imageManager.options.contains(.delayPlaceholder) && imageManager.isLoading { + return AnyView(configure(image: .empty)) + } else { + return placeholder + } + } else { + return AnyView(configure(image: .empty)) + } + } +} + +// Layout +@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *) +extension WebImage { + func configure(_ block: @escaping (Image) -> Image) -> WebImage { + var result = self + result.configurations.append(block) + return result + } + + /// Configurate this view's image with the specified cap insets and options. + /// - Parameter capInsets: The values to use for the cap insets. + /// - Parameter resizingMode: The resizing mode + public func resizable( + capInsets: EdgeInsets = EdgeInsets(), + resizingMode: Image.ResizingMode = .stretch) -> WebImage + { + configure { $0.resizable(capInsets: capInsets, resizingMode: resizingMode) } + } + + /// Configurate this view's rendering mode. + /// - Parameter renderingMode: The resizing mode + public func renderingMode(_ renderingMode: Image.TemplateRenderingMode?) -> WebImage { + configure { $0.renderingMode(renderingMode) } + } + + /// Configurate this view's image interpolation quality + /// - Parameter interpolation: The interpolation quality + public func interpolation(_ interpolation: Image.Interpolation) -> WebImage { + configure { $0.interpolation(interpolation) } + } + + /// Configurate this view's image antialiasing + /// - Parameter isAntialiased: Whether or not to allow antialiasing + public func antialiased(_ isAntialiased: Bool) -> WebImage { + configure { $0.antialiased(isAntialiased) } + } +} + +// Completion Handler +@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *) +extension WebImage { + + /// Provide the action when image load fails. + /// - Parameters: + /// - action: The action to perform. The first arg is the error during loading. If `action` is `nil`, the call has no effect. + /// - Returns: A view that triggers `action` when this image load fails. + public func onFailure(perform action: ((Error) -> Void)? = nil) -> WebImage { + self.imageManager.failureBlock = action + return self + } + + /// Provide the action when image load successes. + /// - Parameters: + /// - action: The action to perform. The first arg is the loaded image, the second arg is the loaded image data, the third arg is the cache type loaded from. If `action` is `nil`, the call has no effect. + /// - Returns: A view that triggers `action` when this image load successes. + public func onSuccess(perform action: ((PlatformImage, Data?, SDImageCacheType) -> Void)? = nil) -> WebImage { + self.imageManager.successBlock = action + return self + } + + /// Provide the action when image load progress changes. + /// - Parameters: + /// - action: The action to perform. The first arg is the received size, the second arg is the total size, all in bytes. If `action` is `nil`, the call has no effect. + /// - Returns: A view that triggers `action` when this image load successes. + public func onProgress(perform action: ((Int, Int) -> Void)? = nil) -> WebImage { + self.imageManager.progressBlock = action + return self + } +} + +// WebImage Modifier +@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *) +extension WebImage { + + /// Associate a placeholder when loading image with url + /// - note: The differences between Placeholder and Indicator, is that placeholder does not supports animation, and return type is different + /// - Parameter content: A view that describes the placeholder. + public func placeholder(@ViewBuilder content: () -> T) -> WebImage where T : View { + var result = self + result.placeholder = AnyView(content()) + return result + } + + /// Associate a placeholder image when loading image with url + /// - note: This placeholder image will apply the same size and resizable from WebImage for convenience. If you don't want this, use the ViewBuilder one above instead + /// - Parameter image: A Image view that describes the placeholder. + public func placeholder(_ image: Image) -> WebImage { + return placeholder { + configurations.reduce(image) { (previous, configuration) in + configuration(previous) + } + } + } + + /// Control the behavior to retry the failed loading when view become appears again + /// - Parameter flag: Whether or not to retry the failed loading + public func retryOnAppear(_ flag: Bool) -> WebImage { + var result = self + result.retryOnAppear = flag + return result + } + + /// Control the behavior to cancel the pending loading when view become disappear again + /// - Parameter flag: Whether or not to cancel the pending loading + public func cancelOnDisappear(_ flag: Bool) -> WebImage { + var result = self + result.cancelOnDisappear = flag + return result + } +} + +// Indicator +@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *) +extension WebImage { + + /// Associate a indicator when loading image with url + /// - Parameter indicator: The indicator type, see `Indicator` + public func indicator(_ indicator: Indicator) -> some View where T : View { + return self.modifier(IndicatorViewModifier(reporter: imageManager, indicator: indicator)) + } + + /// Associate a indicator when loading image with url, convenient method with block + /// - Parameter content: A view that describes the indicator. + public func indicator(@ViewBuilder content: @escaping (_ isAnimating: Binding, _ progress: Binding) -> T) -> some View where T : View { + return indicator(Indicator(content: content)) + } +} + +// Animated Image +@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *) +extension WebImage { + + /// Total loop count for animated image rendering. Defaults to nil. + /// - Note: Pass nil to disable customization, use the image itself loop count (`animatedImageLoopCount`) instead + /// - Parameter loopCount: The animation loop count + public func customLoopCount(_ loopCount: UInt?) -> WebImage { + self.imagePlayer.customLoopCount = loopCount + return self + } + + /// Provide a max buffer size by bytes. This is used to adjust frame buffer count and can be useful when the decoding cost is expensive (such as Animated WebP software decoding). Default is nil. + /// + /// `0` or nil means automatically adjust by calculating current memory usage. + /// `1` means without any buffer cache, each of frames will be decoded and then be freed after rendering. (Lowest Memory and Highest CPU) + /// `UInt.max` means cache all the buffer. (Lowest CPU and Highest Memory) + /// - Parameter bufferSize: The max buffer size + public func maxBufferSize(_ bufferSize: UInt?) -> WebImage { + self.imagePlayer.maxBufferSize = bufferSize + return self + } + + /// The runLoopMode when animation is playing on. Defaults is `.common` + /// You can specify a runloop mode to let it rendering. + /// - Note: This is useful for some cases, for example, always specify NSDefaultRunLoopMode, if you want to pause the animation when user scroll (for Mac user, drag the mouse or touchpad) + /// - Parameter runLoopMode: The runLoopMode for animation + public func runLoopMode(_ runLoopMode: RunLoop.Mode) -> WebImage { + self.imagePlayer.runLoopMode = runLoopMode + return self + } + + /// Whether or not to pause the animation (keep current frame), instead of stop the animation (frame index reset to 0). When `isAnimating` binding value changed to false. Defaults is true. + /// - Note: For some of use case, you may want to reset the frame index to 0 when stop, but some other want to keep the current frame index. + /// - Parameter pausable: Whether or not to pause the animation instead of stop the animation. + public func pausable(_ pausable: Bool) -> WebImage { + var result = self + result.pausable = pausable + return result + } + + /// Whether or not to clear frame buffer cache when stopped. Defaults is false. + /// Note: This is useful when you want to limit the memory usage during frequently visibility changes (such as image view inside a list view, then push and pop) + /// - Parameter purgeable: Whether or not to clear frame buffer cache when stopped. + public func purgeable(_ purgeable: Bool) -> WebImage { + var result = self + result.purgeable = purgeable + return result + } + + /// Control the animation playback rate. Default is 1.0. + /// `1.0` means the normal speed. + /// `0.0` means stopping the animation. + /// `0.0-1.0` means the slow speed. + /// `> 1.0` means the fast speed. + /// `< 0.0` is not supported currently and stop animation. (may support reverse playback in the future) + /// - Parameter playbackRate: The animation playback rate. + public func playbackRate(_ playbackRate: Double) -> WebImage { + self.imagePlayer.playbackRate = playbackRate + return self + } + + /// Control the animation playback mode. Default is .normal + /// - Parameter playbackMode: The playback mode, including normal order, reverse order, bounce order and reversed bounce order. + public func playbackMode(_ playbackMode: SDAnimatedImagePlaybackMode) -> WebImage { + self.imagePlayer.playbackMode = playbackMode + return self + } +} + +#if DEBUG +@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *) +struct WebImage_Previews : PreviewProvider { + static var previews: some View { + Group { + WebImage(url: URL(string: "https://raw.githubusercontent.com/SDWebImage/SDWebImage/master/SDWebImage_logo.png")) + .resizable() + .aspectRatio(contentMode: .fit) + .padding() + } + } +} +#endif diff --git a/NetflixCloneApp/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Module/SDWebImageSwiftUI.h b/NetflixCloneApp/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Module/SDWebImageSwiftUI.h new file mode 100644 index 0000000..8d49a06 --- /dev/null +++ b/NetflixCloneApp/Pods/SDWebImageSwiftUI/SDWebImageSwiftUI/Module/SDWebImageSwiftUI.h @@ -0,0 +1,15 @@ +/* + * This file is part of the SDWebImage package. + * (c) DreamPiggy + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +#import + +//! Project version number for SDWebImageSwiftUI. +FOUNDATION_EXPORT double SDWebImageSwiftUIVersionNumber; + +//! Project version string for SDWebImageSwiftUI. +FOUNDATION_EXPORT const unsigned char SDWebImageSwiftUIVersionString[]; diff --git a/NetflixCloneApp/Pods/Target Support Files/Pods-NetflixCloneApp/Pods-NetflixCloneApp-acknowledgements.markdown b/NetflixCloneApp/Pods/Target Support Files/Pods-NetflixCloneApp/Pods-NetflixCloneApp-acknowledgements.markdown index f30a0d1..db6bdde 100644 --- a/NetflixCloneApp/Pods/Target Support Files/Pods-NetflixCloneApp/Pods-NetflixCloneApp-acknowledgements.markdown +++ b/NetflixCloneApp/Pods/Target Support Files/Pods-NetflixCloneApp/Pods-NetflixCloneApp-acknowledgements.markdown @@ -1,6 +1,53 @@ # Acknowledgements This application makes use of the following third party libraries: +## SDWebImage + +Copyright (c) 2009-2020 Olivier Poitrey rs@dailymotion.com + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + + + +## SDWebImageSwiftUI + +Copyright (c) 2019 lizhuoli1126@126.com + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + + ## TMDBSwift Copyright (c) 2016 George Kye diff --git a/NetflixCloneApp/Pods/Target Support Files/Pods-NetflixCloneApp/Pods-NetflixCloneApp-acknowledgements.plist b/NetflixCloneApp/Pods/Target Support Files/Pods-NetflixCloneApp/Pods-NetflixCloneApp-acknowledgements.plist index 5491b7a..f8cb0e7 100644 --- a/NetflixCloneApp/Pods/Target Support Files/Pods-NetflixCloneApp/Pods-NetflixCloneApp-acknowledgements.plist +++ b/NetflixCloneApp/Pods/Target Support Files/Pods-NetflixCloneApp/Pods-NetflixCloneApp-acknowledgements.plist @@ -12,6 +12,65 @@ Type PSGroupSpecifier + + FooterText + Copyright (c) 2009-2020 Olivier Poitrey rs@dailymotion.com + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + + + License + MIT + Title + SDWebImage + Type + PSGroupSpecifier + + + FooterText + Copyright (c) 2019 lizhuoli1126@126.com <lizhuoli1126@126.com> + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + + License + MIT + Title + SDWebImageSwiftUI + Type + PSGroupSpecifier + FooterText Copyright (c) 2016 George Kye <gkye@live.ca> diff --git a/NetflixCloneApp/Pods/Target Support Files/Pods-NetflixCloneApp/Pods-NetflixCloneApp-frameworks-Debug-input-files.xcfilelist b/NetflixCloneApp/Pods/Target Support Files/Pods-NetflixCloneApp/Pods-NetflixCloneApp-frameworks-Debug-input-files.xcfilelist index a029f11..1cf8c25 100644 --- a/NetflixCloneApp/Pods/Target Support Files/Pods-NetflixCloneApp/Pods-NetflixCloneApp-frameworks-Debug-input-files.xcfilelist +++ b/NetflixCloneApp/Pods/Target Support Files/Pods-NetflixCloneApp/Pods-NetflixCloneApp-frameworks-Debug-input-files.xcfilelist @@ -1,2 +1,4 @@ ${PODS_ROOT}/Target Support Files/Pods-NetflixCloneApp/Pods-NetflixCloneApp-frameworks.sh +${BUILT_PRODUCTS_DIR}/SDWebImage/SDWebImage.framework +${BUILT_PRODUCTS_DIR}/SDWebImageSwiftUI/SDWebImageSwiftUI.framework ${BUILT_PRODUCTS_DIR}/TMDBSwift/TMDBSwift.framework \ No newline at end of file diff --git a/NetflixCloneApp/Pods/Target Support Files/Pods-NetflixCloneApp/Pods-NetflixCloneApp-frameworks-Debug-output-files.xcfilelist b/NetflixCloneApp/Pods/Target Support Files/Pods-NetflixCloneApp/Pods-NetflixCloneApp-frameworks-Debug-output-files.xcfilelist index 0c6d52d..cd9a3a9 100644 --- a/NetflixCloneApp/Pods/Target Support Files/Pods-NetflixCloneApp/Pods-NetflixCloneApp-frameworks-Debug-output-files.xcfilelist +++ b/NetflixCloneApp/Pods/Target Support Files/Pods-NetflixCloneApp/Pods-NetflixCloneApp-frameworks-Debug-output-files.xcfilelist @@ -1 +1,3 @@ +${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDWebImage.framework +${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDWebImageSwiftUI.framework ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/TMDBSwift.framework \ No newline at end of file diff --git a/NetflixCloneApp/Pods/Target Support Files/Pods-NetflixCloneApp/Pods-NetflixCloneApp-frameworks-Release-input-files.xcfilelist b/NetflixCloneApp/Pods/Target Support Files/Pods-NetflixCloneApp/Pods-NetflixCloneApp-frameworks-Release-input-files.xcfilelist index a029f11..1cf8c25 100644 --- a/NetflixCloneApp/Pods/Target Support Files/Pods-NetflixCloneApp/Pods-NetflixCloneApp-frameworks-Release-input-files.xcfilelist +++ b/NetflixCloneApp/Pods/Target Support Files/Pods-NetflixCloneApp/Pods-NetflixCloneApp-frameworks-Release-input-files.xcfilelist @@ -1,2 +1,4 @@ ${PODS_ROOT}/Target Support Files/Pods-NetflixCloneApp/Pods-NetflixCloneApp-frameworks.sh +${BUILT_PRODUCTS_DIR}/SDWebImage/SDWebImage.framework +${BUILT_PRODUCTS_DIR}/SDWebImageSwiftUI/SDWebImageSwiftUI.framework ${BUILT_PRODUCTS_DIR}/TMDBSwift/TMDBSwift.framework \ No newline at end of file diff --git a/NetflixCloneApp/Pods/Target Support Files/Pods-NetflixCloneApp/Pods-NetflixCloneApp-frameworks-Release-output-files.xcfilelist b/NetflixCloneApp/Pods/Target Support Files/Pods-NetflixCloneApp/Pods-NetflixCloneApp-frameworks-Release-output-files.xcfilelist index 0c6d52d..cd9a3a9 100644 --- a/NetflixCloneApp/Pods/Target Support Files/Pods-NetflixCloneApp/Pods-NetflixCloneApp-frameworks-Release-output-files.xcfilelist +++ b/NetflixCloneApp/Pods/Target Support Files/Pods-NetflixCloneApp/Pods-NetflixCloneApp-frameworks-Release-output-files.xcfilelist @@ -1 +1,3 @@ +${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDWebImage.framework +${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDWebImageSwiftUI.framework ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/TMDBSwift.framework \ No newline at end of file diff --git a/NetflixCloneApp/Pods/Target Support Files/Pods-NetflixCloneApp/Pods-NetflixCloneApp-frameworks.sh b/NetflixCloneApp/Pods/Target Support Files/Pods-NetflixCloneApp/Pods-NetflixCloneApp-frameworks.sh index e9a8af7..4d5c9c2 100755 --- a/NetflixCloneApp/Pods/Target Support Files/Pods-NetflixCloneApp/Pods-NetflixCloneApp-frameworks.sh +++ b/NetflixCloneApp/Pods/Target Support Files/Pods-NetflixCloneApp/Pods-NetflixCloneApp-frameworks.sh @@ -176,9 +176,13 @@ code_sign_if_enabled() { } if [[ "$CONFIGURATION" == "Debug" ]]; then + install_framework "${BUILT_PRODUCTS_DIR}/SDWebImage/SDWebImage.framework" + install_framework "${BUILT_PRODUCTS_DIR}/SDWebImageSwiftUI/SDWebImageSwiftUI.framework" install_framework "${BUILT_PRODUCTS_DIR}/TMDBSwift/TMDBSwift.framework" fi if [[ "$CONFIGURATION" == "Release" ]]; then + install_framework "${BUILT_PRODUCTS_DIR}/SDWebImage/SDWebImage.framework" + install_framework "${BUILT_PRODUCTS_DIR}/SDWebImageSwiftUI/SDWebImageSwiftUI.framework" install_framework "${BUILT_PRODUCTS_DIR}/TMDBSwift/TMDBSwift.framework" fi if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then diff --git a/NetflixCloneApp/Pods/Target Support Files/Pods-NetflixCloneApp/Pods-NetflixCloneApp.debug.xcconfig b/NetflixCloneApp/Pods/Target Support Files/Pods-NetflixCloneApp/Pods-NetflixCloneApp.debug.xcconfig index 7a17cee..bbfea34 100644 --- a/NetflixCloneApp/Pods/Target Support Files/Pods-NetflixCloneApp/Pods-NetflixCloneApp.debug.xcconfig +++ b/NetflixCloneApp/Pods/Target Support Files/Pods-NetflixCloneApp/Pods-NetflixCloneApp.debug.xcconfig @@ -1,11 +1,11 @@ ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO -FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/TMDBSwift" +FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/SDWebImage" "${PODS_CONFIGURATION_BUILD_DIR}/SDWebImageSwiftUI" "${PODS_CONFIGURATION_BUILD_DIR}/TMDBSwift" GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 -HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/TMDBSwift/TMDBSwift.framework/Headers" +HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/SDWebImage/SDWebImage.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/SDWebImageSwiftUI/SDWebImageSwiftUI.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/TMDBSwift/TMDBSwift.framework/Headers" LD_RUNPATH_SEARCH_PATHS = $(inherited) /usr/lib/swift '@executable_path/Frameworks' '@loader_path/Frameworks' LIBRARY_SEARCH_PATHS = $(inherited) "${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" /usr/lib/swift -OTHER_LDFLAGS = $(inherited) -framework "TMDBSwift" +OTHER_LDFLAGS = $(inherited) -framework "ImageIO" -framework "SDWebImage" -framework "SDWebImageSwiftUI" -framework "TMDBSwift" -weak_framework "Combine" -weak_framework "SwiftUI" OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS PODS_BUILD_DIR = ${BUILD_DIR} PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) diff --git a/NetflixCloneApp/Pods/Target Support Files/Pods-NetflixCloneApp/Pods-NetflixCloneApp.release.xcconfig b/NetflixCloneApp/Pods/Target Support Files/Pods-NetflixCloneApp/Pods-NetflixCloneApp.release.xcconfig index 7a17cee..bbfea34 100644 --- a/NetflixCloneApp/Pods/Target Support Files/Pods-NetflixCloneApp/Pods-NetflixCloneApp.release.xcconfig +++ b/NetflixCloneApp/Pods/Target Support Files/Pods-NetflixCloneApp/Pods-NetflixCloneApp.release.xcconfig @@ -1,11 +1,11 @@ ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO -FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/TMDBSwift" +FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/SDWebImage" "${PODS_CONFIGURATION_BUILD_DIR}/SDWebImageSwiftUI" "${PODS_CONFIGURATION_BUILD_DIR}/TMDBSwift" GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 -HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/TMDBSwift/TMDBSwift.framework/Headers" +HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/SDWebImage/SDWebImage.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/SDWebImageSwiftUI/SDWebImageSwiftUI.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/TMDBSwift/TMDBSwift.framework/Headers" LD_RUNPATH_SEARCH_PATHS = $(inherited) /usr/lib/swift '@executable_path/Frameworks' '@loader_path/Frameworks' LIBRARY_SEARCH_PATHS = $(inherited) "${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" /usr/lib/swift -OTHER_LDFLAGS = $(inherited) -framework "TMDBSwift" +OTHER_LDFLAGS = $(inherited) -framework "ImageIO" -framework "SDWebImage" -framework "SDWebImageSwiftUI" -framework "TMDBSwift" -weak_framework "Combine" -weak_framework "SwiftUI" OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS PODS_BUILD_DIR = ${BUILD_DIR} PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) diff --git a/NetflixCloneApp/Pods/Target Support Files/SDWebImage/SDWebImage-Info.plist b/NetflixCloneApp/Pods/Target Support Files/SDWebImage/SDWebImage-Info.plist new file mode 100644 index 0000000..c55d274 --- /dev/null +++ b/NetflixCloneApp/Pods/Target Support Files/SDWebImage/SDWebImage-Info.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + ${PRODUCT_BUNDLE_IDENTIFIER} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + FMWK + CFBundleShortVersionString + 5.13.2 + CFBundleSignature + ???? + CFBundleVersion + ${CURRENT_PROJECT_VERSION} + NSPrincipalClass + + + diff --git a/NetflixCloneApp/Pods/Target Support Files/SDWebImage/SDWebImage-dummy.m b/NetflixCloneApp/Pods/Target Support Files/SDWebImage/SDWebImage-dummy.m new file mode 100644 index 0000000..86d2b5f --- /dev/null +++ b/NetflixCloneApp/Pods/Target Support Files/SDWebImage/SDWebImage-dummy.m @@ -0,0 +1,5 @@ +#import +@interface PodsDummy_SDWebImage : NSObject +@end +@implementation PodsDummy_SDWebImage +@end diff --git a/NetflixCloneApp/Pods/Target Support Files/SDWebImage/SDWebImage-prefix.pch b/NetflixCloneApp/Pods/Target Support Files/SDWebImage/SDWebImage-prefix.pch new file mode 100644 index 0000000..beb2a24 --- /dev/null +++ b/NetflixCloneApp/Pods/Target Support Files/SDWebImage/SDWebImage-prefix.pch @@ -0,0 +1,12 @@ +#ifdef __OBJC__ +#import +#else +#ifndef FOUNDATION_EXPORT +#if defined(__cplusplus) +#define FOUNDATION_EXPORT extern "C" +#else +#define FOUNDATION_EXPORT extern +#endif +#endif +#endif + diff --git a/NetflixCloneApp/Pods/Target Support Files/SDWebImage/SDWebImage-umbrella.h b/NetflixCloneApp/Pods/Target Support Files/SDWebImage/SDWebImage-umbrella.h new file mode 100644 index 0000000..716e183 --- /dev/null +++ b/NetflixCloneApp/Pods/Target Support Files/SDWebImage/SDWebImage-umbrella.h @@ -0,0 +1,75 @@ +#ifdef __OBJC__ +#import +#else +#ifndef FOUNDATION_EXPORT +#if defined(__cplusplus) +#define FOUNDATION_EXPORT extern "C" +#else +#define FOUNDATION_EXPORT extern +#endif +#endif +#endif + +#import "NSButton+WebCache.h" +#import "NSData+ImageContentType.h" +#import "NSImage+Compatibility.h" +#import "SDAnimatedImage.h" +#import "SDAnimatedImagePlayer.h" +#import "SDAnimatedImageRep.h" +#import "SDAnimatedImageView+WebCache.h" +#import "SDAnimatedImageView.h" +#import "SDDiskCache.h" +#import "SDGraphicsImageRenderer.h" +#import "SDImageAPNGCoder.h" +#import "SDImageAWebPCoder.h" +#import "SDImageCache.h" +#import "SDImageCacheConfig.h" +#import "SDImageCacheDefine.h" +#import "SDImageCachesManager.h" +#import "SDImageCoder.h" +#import "SDImageCoderHelper.h" +#import "SDImageCodersManager.h" +#import "SDImageFrame.h" +#import "SDImageGIFCoder.h" +#import "SDImageGraphics.h" +#import "SDImageHEICCoder.h" +#import "SDImageIOAnimatedCoder.h" +#import "SDImageIOCoder.h" +#import "SDImageLoader.h" +#import "SDImageLoadersManager.h" +#import "SDImageTransformer.h" +#import "SDMemoryCache.h" +#import "SDWebImageCacheKeyFilter.h" +#import "SDWebImageCacheSerializer.h" +#import "SDWebImageCompat.h" +#import "SDWebImageDefine.h" +#import "SDWebImageDownloader.h" +#import "SDWebImageDownloaderConfig.h" +#import "SDWebImageDownloaderDecryptor.h" +#import "SDWebImageDownloaderOperation.h" +#import "SDWebImageDownloaderRequestModifier.h" +#import "SDWebImageDownloaderResponseModifier.h" +#import "SDWebImageError.h" +#import "SDWebImageIndicator.h" +#import "SDWebImageManager.h" +#import "SDWebImageOperation.h" +#import "SDWebImageOptionsProcessor.h" +#import "SDWebImagePrefetcher.h" +#import "SDWebImageTransition.h" +#import "UIButton+WebCache.h" +#import "UIImage+ExtendedCacheData.h" +#import "UIImage+ForceDecode.h" +#import "UIImage+GIF.h" +#import "UIImage+MemoryCacheCost.h" +#import "UIImage+Metadata.h" +#import "UIImage+MultiFormat.h" +#import "UIImage+Transform.h" +#import "UIImageView+HighlightedWebCache.h" +#import "UIImageView+WebCache.h" +#import "UIView+WebCache.h" +#import "UIView+WebCacheOperation.h" +#import "SDWebImage.h" + +FOUNDATION_EXPORT double SDWebImageVersionNumber; +FOUNDATION_EXPORT const unsigned char SDWebImageVersionString[]; + diff --git a/NetflixCloneApp/Pods/Target Support Files/SDWebImage/SDWebImage.debug.xcconfig b/NetflixCloneApp/Pods/Target Support Files/SDWebImage/SDWebImage.debug.xcconfig new file mode 100644 index 0000000..7653e01 --- /dev/null +++ b/NetflixCloneApp/Pods/Target Support Files/SDWebImage/SDWebImage.debug.xcconfig @@ -0,0 +1,14 @@ +CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO +CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/SDWebImage +DERIVE_MACCATALYST_PRODUCT_BUNDLE_IDENTIFIER = NO +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +OTHER_LDFLAGS = $(inherited) -framework "ImageIO" +PODS_BUILD_DIR = ${BUILD_DIR} +PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) +PODS_ROOT = ${SRCROOT} +PODS_TARGET_SRCROOT = ${PODS_ROOT}/SDWebImage +PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates +PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} +SKIP_INSTALL = YES +SUPPORTS_MACCATALYST = YES +USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES diff --git a/NetflixCloneApp/Pods/Target Support Files/SDWebImage/SDWebImage.modulemap b/NetflixCloneApp/Pods/Target Support Files/SDWebImage/SDWebImage.modulemap new file mode 100644 index 0000000..91545be --- /dev/null +++ b/NetflixCloneApp/Pods/Target Support Files/SDWebImage/SDWebImage.modulemap @@ -0,0 +1,6 @@ +framework module SDWebImage { + umbrella header "SDWebImage-umbrella.h" + + export * + module * { export * } +} diff --git a/NetflixCloneApp/Pods/Target Support Files/SDWebImage/SDWebImage.release.xcconfig b/NetflixCloneApp/Pods/Target Support Files/SDWebImage/SDWebImage.release.xcconfig new file mode 100644 index 0000000..7653e01 --- /dev/null +++ b/NetflixCloneApp/Pods/Target Support Files/SDWebImage/SDWebImage.release.xcconfig @@ -0,0 +1,14 @@ +CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO +CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/SDWebImage +DERIVE_MACCATALYST_PRODUCT_BUNDLE_IDENTIFIER = NO +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +OTHER_LDFLAGS = $(inherited) -framework "ImageIO" +PODS_BUILD_DIR = ${BUILD_DIR} +PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) +PODS_ROOT = ${SRCROOT} +PODS_TARGET_SRCROOT = ${PODS_ROOT}/SDWebImage +PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates +PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} +SKIP_INSTALL = YES +SUPPORTS_MACCATALYST = YES +USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES diff --git a/NetflixCloneApp/Pods/Target Support Files/SDWebImageSwiftUI/SDWebImageSwiftUI-Info.plist b/NetflixCloneApp/Pods/Target Support Files/SDWebImageSwiftUI/SDWebImageSwiftUI-Info.plist new file mode 100644 index 0000000..09cb0fc --- /dev/null +++ b/NetflixCloneApp/Pods/Target Support Files/SDWebImageSwiftUI/SDWebImageSwiftUI-Info.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + ${PRODUCT_BUNDLE_IDENTIFIER} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + FMWK + CFBundleShortVersionString + 2.0.2 + CFBundleSignature + ???? + CFBundleVersion + ${CURRENT_PROJECT_VERSION} + NSPrincipalClass + + + diff --git a/NetflixCloneApp/Pods/Target Support Files/SDWebImageSwiftUI/SDWebImageSwiftUI-dummy.m b/NetflixCloneApp/Pods/Target Support Files/SDWebImageSwiftUI/SDWebImageSwiftUI-dummy.m new file mode 100644 index 0000000..1e8ca8d --- /dev/null +++ b/NetflixCloneApp/Pods/Target Support Files/SDWebImageSwiftUI/SDWebImageSwiftUI-dummy.m @@ -0,0 +1,5 @@ +#import +@interface PodsDummy_SDWebImageSwiftUI : NSObject +@end +@implementation PodsDummy_SDWebImageSwiftUI +@end diff --git a/NetflixCloneApp/Pods/Target Support Files/SDWebImageSwiftUI/SDWebImageSwiftUI-prefix.pch b/NetflixCloneApp/Pods/Target Support Files/SDWebImageSwiftUI/SDWebImageSwiftUI-prefix.pch new file mode 100644 index 0000000..beb2a24 --- /dev/null +++ b/NetflixCloneApp/Pods/Target Support Files/SDWebImageSwiftUI/SDWebImageSwiftUI-prefix.pch @@ -0,0 +1,12 @@ +#ifdef __OBJC__ +#import +#else +#ifndef FOUNDATION_EXPORT +#if defined(__cplusplus) +#define FOUNDATION_EXPORT extern "C" +#else +#define FOUNDATION_EXPORT extern +#endif +#endif +#endif + diff --git a/NetflixCloneApp/Pods/Target Support Files/SDWebImageSwiftUI/SDWebImageSwiftUI-umbrella.h b/NetflixCloneApp/Pods/Target Support Files/SDWebImageSwiftUI/SDWebImageSwiftUI-umbrella.h new file mode 100644 index 0000000..36ce60b --- /dev/null +++ b/NetflixCloneApp/Pods/Target Support Files/SDWebImageSwiftUI/SDWebImageSwiftUI-umbrella.h @@ -0,0 +1,17 @@ +#ifdef __OBJC__ +#import +#else +#ifndef FOUNDATION_EXPORT +#if defined(__cplusplus) +#define FOUNDATION_EXPORT extern "C" +#else +#define FOUNDATION_EXPORT extern +#endif +#endif +#endif + +#import "SDWebImageSwiftUI.h" + +FOUNDATION_EXPORT double SDWebImageSwiftUIVersionNumber; +FOUNDATION_EXPORT const unsigned char SDWebImageSwiftUIVersionString[]; + diff --git a/NetflixCloneApp/Pods/Target Support Files/SDWebImageSwiftUI/SDWebImageSwiftUI.debug.xcconfig b/NetflixCloneApp/Pods/Target Support Files/SDWebImageSwiftUI/SDWebImageSwiftUI.debug.xcconfig new file mode 100644 index 0000000..911961e --- /dev/null +++ b/NetflixCloneApp/Pods/Target Support Files/SDWebImageSwiftUI/SDWebImageSwiftUI.debug.xcconfig @@ -0,0 +1,18 @@ +BUILD_LIBRARY_FOR_DISTRIBUTION = YES +CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO +CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/SDWebImageSwiftUI +DERIVE_MACCATALYST_PRODUCT_BUNDLE_IDENTIFIER = NO +FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/SDWebImage" +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +LIBRARY_SEARCH_PATHS = $(inherited) "${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" /usr/lib/swift +OTHER_LDFLAGS = $(inherited) -framework "ImageIO" -framework "SDWebImage" -weak_framework "Combine" -weak_framework "SwiftUI" +OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS +PODS_BUILD_DIR = ${BUILD_DIR} +PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) +PODS_ROOT = ${SRCROOT} +PODS_TARGET_SRCROOT = ${PODS_ROOT}/SDWebImageSwiftUI +PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates +PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} +SKIP_INSTALL = YES +SUPPORTS_MACCATALYST = YES +USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES diff --git a/NetflixCloneApp/Pods/Target Support Files/SDWebImageSwiftUI/SDWebImageSwiftUI.modulemap b/NetflixCloneApp/Pods/Target Support Files/SDWebImageSwiftUI/SDWebImageSwiftUI.modulemap new file mode 100644 index 0000000..2d09cfc --- /dev/null +++ b/NetflixCloneApp/Pods/Target Support Files/SDWebImageSwiftUI/SDWebImageSwiftUI.modulemap @@ -0,0 +1,6 @@ +framework module SDWebImageSwiftUI { + umbrella header "SDWebImageSwiftUI-umbrella.h" + + export * + module * { export * } +} diff --git a/NetflixCloneApp/Pods/Target Support Files/SDWebImageSwiftUI/SDWebImageSwiftUI.release.xcconfig b/NetflixCloneApp/Pods/Target Support Files/SDWebImageSwiftUI/SDWebImageSwiftUI.release.xcconfig new file mode 100644 index 0000000..911961e --- /dev/null +++ b/NetflixCloneApp/Pods/Target Support Files/SDWebImageSwiftUI/SDWebImageSwiftUI.release.xcconfig @@ -0,0 +1,18 @@ +BUILD_LIBRARY_FOR_DISTRIBUTION = YES +CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO +CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/SDWebImageSwiftUI +DERIVE_MACCATALYST_PRODUCT_BUNDLE_IDENTIFIER = NO +FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/SDWebImage" +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +LIBRARY_SEARCH_PATHS = $(inherited) "${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" /usr/lib/swift +OTHER_LDFLAGS = $(inherited) -framework "ImageIO" -framework "SDWebImage" -weak_framework "Combine" -weak_framework "SwiftUI" +OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS +PODS_BUILD_DIR = ${BUILD_DIR} +PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) +PODS_ROOT = ${SRCROOT} +PODS_TARGET_SRCROOT = ${PODS_ROOT}/SDWebImageSwiftUI +PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates +PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} +SKIP_INSTALL = YES +SUPPORTS_MACCATALYST = YES +USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES diff --git a/README.md b/README.md index 1829433..9ae9bb2 100644 --- a/README.md +++ b/README.md @@ -22,11 +22,11 @@ ## RoadMap -|Week|내용|새로 알게된 내용| +|Week|내용|참고| |---|:---:|:---:| |week 1|프로젝트 시작 |-︎| |week 2|메인 뷰 및 API 호출|Combime을 통해 API 호출| -|week 3||| +|week 3|DetailView 개발 및 데이터 전달|| |week 4||| |week 5||| |week 6||| @@ -58,3 +58,7 @@ 🔀[merge]: 다른브렌치를 merge 할 때 사용합니다.
✅ [test]: 테스트 코드를 작성할 때 사용합니다.
+## 문제 및 해결 전략 + + +