Add the Xcode project to support Carthage. Fix the build issue on macOS/tvOS/watchOS

This commit is contained in:
DreamPiggy 2019-08-09 15:58:21 +08:00
parent e7914c0808
commit 248515a2d6
11 changed files with 982 additions and 33 deletions

3
.gitignore vendored
View File

@ -23,8 +23,7 @@ DerivedData
.bundle
# Add this line if you want to avoid checking in source code from Carthage dependencies.
# Carthage/Checkouts
Carthage/Checkouts
Carthage/Build
# We recommend against adding the Pods directory to your .gitignore. However

1
Cartfile Normal file
View File

@ -0,0 +1 @@
github "SDWebImage/SDWebImage" ~> 5.1

1
Cartfile.resolved Normal file
View File

@ -0,0 +1 @@
github "SDWebImage/SDWebImage" "5.1.0"

View File

@ -0,0 +1,834 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 50;
objects = {
/* Begin PBXBuildFile section */
32C43DE622FD54CD00BE87F5 /* SDWebImageSwiftUI.h in Headers */ = {isa = PBXBuildFile; fileRef = 32C43DE422FD54CD00BE87F5 /* SDWebImageSwiftUI.h */; settings = {ATTRIBUTES = (Public, ); }; };
32C43DEA22FD577300BE87F5 /* SDWebImage.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 32C43DE922FD577300BE87F5 /* SDWebImage.framework */; };
32C43DEB22FD577300BE87F5 /* SDWebImage.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 32C43DE922FD577300BE87F5 /* SDWebImage.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
32C43E1622FD583700BE87F5 /* ImageManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32C43DDC22FD54C600BE87F5 /* ImageManager.swift */; };
32C43E1722FD583700BE87F5 /* WebImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32C43DDE22FD54C600BE87F5 /* WebImage.swift */; };
32C43E1822FD583700BE87F5 /* AnimatedImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32C43DDF22FD54C600BE87F5 /* AnimatedImage.swift */; };
32C43E1922FD583700BE87F5 /* ImageManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32C43DDC22FD54C600BE87F5 /* ImageManager.swift */; };
32C43E1A22FD583700BE87F5 /* WebImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32C43DDE22FD54C600BE87F5 /* WebImage.swift */; };
32C43E1B22FD583700BE87F5 /* AnimatedImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32C43DDF22FD54C600BE87F5 /* AnimatedImage.swift */; };
32C43E1C22FD583800BE87F5 /* ImageManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32C43DDC22FD54C600BE87F5 /* ImageManager.swift */; };
32C43E1D22FD583800BE87F5 /* WebImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32C43DDE22FD54C600BE87F5 /* WebImage.swift */; };
32C43E1E22FD583800BE87F5 /* AnimatedImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32C43DDF22FD54C600BE87F5 /* AnimatedImage.swift */; };
32C43E1F22FD583800BE87F5 /* ImageManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32C43DDC22FD54C600BE87F5 /* ImageManager.swift */; };
32C43E2022FD583800BE87F5 /* WebImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32C43DDE22FD54C600BE87F5 /* WebImage.swift */; };
32C43E2122FD583800BE87F5 /* AnimatedImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32C43DDF22FD54C600BE87F5 /* AnimatedImage.swift */; };
32C43E2222FD583A00BE87F5 /* SDWebImageSwiftUI.h in Headers */ = {isa = PBXBuildFile; fileRef = 32C43DE422FD54CD00BE87F5 /* SDWebImageSwiftUI.h */; settings = {ATTRIBUTES = (Public, ); }; };
32C43E2322FD583B00BE87F5 /* SDWebImageSwiftUI.h in Headers */ = {isa = PBXBuildFile; fileRef = 32C43DE422FD54CD00BE87F5 /* SDWebImageSwiftUI.h */; settings = {ATTRIBUTES = (Public, ); }; };
32C43E2422FD583C00BE87F5 /* SDWebImageSwiftUI.h in Headers */ = {isa = PBXBuildFile; fileRef = 32C43DE422FD54CD00BE87F5 /* SDWebImageSwiftUI.h */; settings = {ATTRIBUTES = (Public, ); }; };
32C43E2622FD585300BE87F5 /* SDWebImage.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 32C43E2522FD585300BE87F5 /* SDWebImage.framework */; };
32C43E2722FD585300BE87F5 /* SDWebImage.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 32C43E2522FD585300BE87F5 /* SDWebImage.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
32C43E2A22FD586200BE87F5 /* SDWebImage.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 32C43E2922FD586200BE87F5 /* SDWebImage.framework */; };
32C43E2B22FD586200BE87F5 /* SDWebImage.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 32C43E2922FD586200BE87F5 /* SDWebImage.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
32C43E2E22FD586E00BE87F5 /* SDWebImage.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 32C43E2D22FD586E00BE87F5 /* SDWebImage.framework */; };
32C43E2F22FD586E00BE87F5 /* SDWebImage.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 32C43E2D22FD586E00BE87F5 /* SDWebImage.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
32C43E3222FD5DE100BE87F5 /* SDWebImageSwiftUI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32C43E3122FD5DE100BE87F5 /* SDWebImageSwiftUI.swift */; };
32C43E3322FD5DF400BE87F5 /* SDWebImageSwiftUI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32C43E3122FD5DE100BE87F5 /* SDWebImageSwiftUI.swift */; };
32C43E3422FD5DF400BE87F5 /* SDWebImageSwiftUI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32C43E3122FD5DE100BE87F5 /* SDWebImageSwiftUI.swift */; };
32C43E3522FD5DF400BE87F5 /* SDWebImageSwiftUI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32C43E3122FD5DE100BE87F5 /* SDWebImageSwiftUI.swift */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
32C43DEC22FD577300BE87F5 /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
32C43DEB22FD577300BE87F5 /* SDWebImage.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
};
32C43E2822FD585300BE87F5 /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
32C43E2722FD585300BE87F5 /* SDWebImage.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
};
32C43E2C22FD586200BE87F5 /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
32C43E2B22FD586200BE87F5 /* SDWebImage.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
};
32C43E3022FD586E00BE87F5 /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
32C43E2F22FD586E00BE87F5 /* SDWebImage.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
32C43DCC22FD540D00BE87F5 /* SDWebImageSwiftUI.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SDWebImageSwiftUI.framework; sourceTree = BUILT_PRODUCTS_DIR; };
32C43DDC22FD54C600BE87F5 /* ImageManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ImageManager.swift; sourceTree = "<group>"; };
32C43DDE22FD54C600BE87F5 /* WebImage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WebImage.swift; sourceTree = "<group>"; };
32C43DDF22FD54C600BE87F5 /* AnimatedImage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AnimatedImage.swift; sourceTree = "<group>"; };
32C43DE422FD54CD00BE87F5 /* SDWebImageSwiftUI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDWebImageSwiftUI.h; path = SDWebImageSwiftUI/Module/SDWebImageSwiftUI.h; sourceTree = "<group>"; };
32C43DE522FD54CD00BE87F5 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = SDWebImageSwiftUI/Module/Info.plist; sourceTree = "<group>"; };
32C43DE922FD577300BE87F5 /* SDWebImage.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDWebImage.framework; path = Carthage/Build/iOS/SDWebImage.framework; sourceTree = "<group>"; };
32C43DF422FD57FD00BE87F5 /* SDWebImageSwiftUI.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SDWebImageSwiftUI.framework; sourceTree = BUILT_PRODUCTS_DIR; };
32C43E0122FD581400BE87F5 /* SDWebImageSwiftUI.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SDWebImageSwiftUI.framework; sourceTree = BUILT_PRODUCTS_DIR; };
32C43E0E22FD581C00BE87F5 /* SDWebImageSwiftUI.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SDWebImageSwiftUI.framework; sourceTree = BUILT_PRODUCTS_DIR; };
32C43E2522FD585300BE87F5 /* SDWebImage.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDWebImage.framework; path = Carthage/Build/Mac/SDWebImage.framework; sourceTree = "<group>"; };
32C43E2922FD586200BE87F5 /* SDWebImage.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDWebImage.framework; path = Carthage/Build/tvOS/SDWebImage.framework; sourceTree = "<group>"; };
32C43E2D22FD586E00BE87F5 /* SDWebImage.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDWebImage.framework; path = Carthage/Build/watchOS/SDWebImage.framework; sourceTree = "<group>"; };
32C43E3122FD5DE100BE87F5 /* SDWebImageSwiftUI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SDWebImageSwiftUI.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
32C43DC922FD540D00BE87F5 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
32C43DEA22FD577300BE87F5 /* SDWebImage.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
32C43DF122FD57FD00BE87F5 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
32C43E2622FD585300BE87F5 /* SDWebImage.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
32C43DFE22FD581400BE87F5 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
32C43E2A22FD586200BE87F5 /* SDWebImage.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
32C43E0B22FD581C00BE87F5 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
32C43E2E22FD586E00BE87F5 /* SDWebImage.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
32C43DC222FD540D00BE87F5 = {
isa = PBXGroup;
children = (
32C43DCE22FD540D00BE87F5 /* SDWebImageSwiftUI */,
32C43DE522FD54CD00BE87F5 /* Info.plist */,
32C43DE422FD54CD00BE87F5 /* SDWebImageSwiftUI.h */,
32C43DCD22FD540D00BE87F5 /* Products */,
32C43DE822FD577300BE87F5 /* Frameworks */,
);
sourceTree = "<group>";
};
32C43DCD22FD540D00BE87F5 /* Products */ = {
isa = PBXGroup;
children = (
32C43DCC22FD540D00BE87F5 /* SDWebImageSwiftUI.framework */,
32C43DF422FD57FD00BE87F5 /* SDWebImageSwiftUI.framework */,
32C43E0122FD581400BE87F5 /* SDWebImageSwiftUI.framework */,
32C43E0E22FD581C00BE87F5 /* SDWebImageSwiftUI.framework */,
);
name = Products;
sourceTree = "<group>";
};
32C43DCE22FD540D00BE87F5 /* SDWebImageSwiftUI */ = {
isa = PBXGroup;
children = (
32C43DDB22FD54C600BE87F5 /* Classes */,
);
path = SDWebImageSwiftUI;
sourceTree = "<group>";
};
32C43DDB22FD54C600BE87F5 /* Classes */ = {
isa = PBXGroup;
children = (
32C43DDC22FD54C600BE87F5 /* ImageManager.swift */,
32C43DDE22FD54C600BE87F5 /* WebImage.swift */,
32C43DDF22FD54C600BE87F5 /* AnimatedImage.swift */,
32C43E3122FD5DE100BE87F5 /* SDWebImageSwiftUI.swift */,
);
path = Classes;
sourceTree = "<group>";
};
32C43DE822FD577300BE87F5 /* Frameworks */ = {
isa = PBXGroup;
children = (
32C43E2D22FD586E00BE87F5 /* SDWebImage.framework */,
32C43E2922FD586200BE87F5 /* SDWebImage.framework */,
32C43E2522FD585300BE87F5 /* SDWebImage.framework */,
32C43DE922FD577300BE87F5 /* SDWebImage.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
32C43DC722FD540D00BE87F5 /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
32C43DE622FD54CD00BE87F5 /* SDWebImageSwiftUI.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
32C43DEF22FD57FD00BE87F5 /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
32C43E2222FD583A00BE87F5 /* SDWebImageSwiftUI.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
32C43DFC22FD581400BE87F5 /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
32C43E2322FD583B00BE87F5 /* SDWebImageSwiftUI.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
32C43E0922FD581C00BE87F5 /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
32C43E2422FD583C00BE87F5 /* SDWebImageSwiftUI.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXHeadersBuildPhase section */
/* Begin PBXNativeTarget section */
32C43DCB22FD540D00BE87F5 /* SDWebImageSwiftUI */ = {
isa = PBXNativeTarget;
buildConfigurationList = 32C43DD422FD540D00BE87F5 /* Build configuration list for PBXNativeTarget "SDWebImageSwiftUI" */;
buildPhases = (
32C43DC722FD540D00BE87F5 /* Headers */,
32C43DC822FD540D00BE87F5 /* Sources */,
32C43DC922FD540D00BE87F5 /* Frameworks */,
32C43DCA22FD540D00BE87F5 /* Resources */,
32C43DEC22FD577300BE87F5 /* Embed Frameworks */,
);
buildRules = (
);
dependencies = (
);
name = SDWebImageSwiftUI;
productName = SDWebImageSwiftUI;
productReference = 32C43DCC22FD540D00BE87F5 /* SDWebImageSwiftUI.framework */;
productType = "com.apple.product-type.framework";
};
32C43DF322FD57FD00BE87F5 /* SDWebImageSwiftUI macOS */ = {
isa = PBXNativeTarget;
buildConfigurationList = 32C43DF922FD57FD00BE87F5 /* Build configuration list for PBXNativeTarget "SDWebImageSwiftUI macOS" */;
buildPhases = (
32C43DEF22FD57FD00BE87F5 /* Headers */,
32C43DF022FD57FD00BE87F5 /* Sources */,
32C43DF122FD57FD00BE87F5 /* Frameworks */,
32C43DF222FD57FD00BE87F5 /* Resources */,
32C43E2822FD585300BE87F5 /* Embed Frameworks */,
);
buildRules = (
);
dependencies = (
);
name = "SDWebImageSwiftUI macOS";
productName = "SDWebImageSwiftUI macOS";
productReference = 32C43DF422FD57FD00BE87F5 /* SDWebImageSwiftUI.framework */;
productType = "com.apple.product-type.framework";
};
32C43E0022FD581400BE87F5 /* SDWebImageSwiftUI tvOS */ = {
isa = PBXNativeTarget;
buildConfigurationList = 32C43E0622FD581400BE87F5 /* Build configuration list for PBXNativeTarget "SDWebImageSwiftUI tvOS" */;
buildPhases = (
32C43DFC22FD581400BE87F5 /* Headers */,
32C43DFD22FD581400BE87F5 /* Sources */,
32C43DFE22FD581400BE87F5 /* Frameworks */,
32C43DFF22FD581400BE87F5 /* Resources */,
32C43E2C22FD586200BE87F5 /* Embed Frameworks */,
);
buildRules = (
);
dependencies = (
);
name = "SDWebImageSwiftUI tvOS";
productName = "SDWebImageSwiftUI tvOS";
productReference = 32C43E0122FD581400BE87F5 /* SDWebImageSwiftUI.framework */;
productType = "com.apple.product-type.framework";
};
32C43E0D22FD581C00BE87F5 /* SDWebImageSwiftUI watchOS */ = {
isa = PBXNativeTarget;
buildConfigurationList = 32C43E1322FD581C00BE87F5 /* Build configuration list for PBXNativeTarget "SDWebImageSwiftUI watchOS" */;
buildPhases = (
32C43E0922FD581C00BE87F5 /* Headers */,
32C43E0A22FD581C00BE87F5 /* Sources */,
32C43E0B22FD581C00BE87F5 /* Frameworks */,
32C43E0C22FD581C00BE87F5 /* Resources */,
32C43E3022FD586E00BE87F5 /* Embed Frameworks */,
);
buildRules = (
);
dependencies = (
);
name = "SDWebImageSwiftUI watchOS";
productName = "SDWebImageSwiftUI watchOS";
productReference = 32C43E0E22FD581C00BE87F5 /* SDWebImageSwiftUI.framework */;
productType = "com.apple.product-type.framework";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
32C43DC322FD540D00BE87F5 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1100;
ORGANIZATIONNAME = lizhuoli;
TargetAttributes = {
32C43DCB22FD540D00BE87F5 = {
CreatedOnToolsVersion = 11.0;
};
32C43DF322FD57FD00BE87F5 = {
CreatedOnToolsVersion = 11.0;
};
32C43E0022FD581400BE87F5 = {
CreatedOnToolsVersion = 11.0;
};
32C43E0D22FD581C00BE87F5 = {
CreatedOnToolsVersion = 11.0;
};
};
};
buildConfigurationList = 32C43DC622FD540D00BE87F5 /* Build configuration list for PBXProject "SDWebImageSwiftUI" */;
compatibilityVersion = "Xcode 9.3";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 32C43DC222FD540D00BE87F5;
productRefGroup = 32C43DCD22FD540D00BE87F5 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
32C43DCB22FD540D00BE87F5 /* SDWebImageSwiftUI */,
32C43DF322FD57FD00BE87F5 /* SDWebImageSwiftUI macOS */,
32C43E0022FD581400BE87F5 /* SDWebImageSwiftUI tvOS */,
32C43E0D22FD581C00BE87F5 /* SDWebImageSwiftUI watchOS */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
32C43DCA22FD540D00BE87F5 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
32C43DF222FD57FD00BE87F5 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
32C43DFF22FD581400BE87F5 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
32C43E0C22FD581C00BE87F5 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
32C43DC822FD540D00BE87F5 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
32C43E1722FD583700BE87F5 /* WebImage.swift in Sources */,
32C43E3222FD5DE100BE87F5 /* SDWebImageSwiftUI.swift in Sources */,
32C43E1622FD583700BE87F5 /* ImageManager.swift in Sources */,
32C43E1822FD583700BE87F5 /* AnimatedImage.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
32C43DF022FD57FD00BE87F5 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
32C43E1A22FD583700BE87F5 /* WebImage.swift in Sources */,
32C43E3322FD5DF400BE87F5 /* SDWebImageSwiftUI.swift in Sources */,
32C43E1922FD583700BE87F5 /* ImageManager.swift in Sources */,
32C43E1B22FD583700BE87F5 /* AnimatedImage.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
32C43DFD22FD581400BE87F5 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
32C43E1D22FD583800BE87F5 /* WebImage.swift in Sources */,
32C43E3422FD5DF400BE87F5 /* SDWebImageSwiftUI.swift in Sources */,
32C43E1C22FD583800BE87F5 /* ImageManager.swift in Sources */,
32C43E1E22FD583800BE87F5 /* AnimatedImage.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
32C43E0A22FD581C00BE87F5 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
32C43E2022FD583800BE87F5 /* WebImage.swift in Sources */,
32C43E3522FD5DF400BE87F5 /* SDWebImageSwiftUI.swift in Sources */,
32C43E1F22FD583800BE87F5 /* ImageManager.swift in Sources */,
32C43E2122FD583800BE87F5 /* AnimatedImage.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin XCBuildConfiguration section */
32C43DD222FD540D00BE87F5 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
MACOSX_DEPLOYMENT_TARGET = 10.15;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
TVOS_DEPLOYMENT_TARGET = 13.0;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
WATCHOS_DEPLOYMENT_TARGET = 6.0;
};
name = Debug;
};
32C43DD322FD540D00BE87F5 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
MACOSX_DEPLOYMENT_TARGET = 10.15;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
TVOS_DEPLOYMENT_TARGET = 13.0;
VALIDATE_PRODUCT = YES;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
WATCHOS_DEPLOYMENT_TARGET = 6.0;
};
name = Release;
};
32C43DD522FD540D00BE87F5 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Automatic;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Carthage/Build/iOS",
);
INFOPLIST_FILE = "$(SRCROOT)/SDWebImageSwiftUI/Module/Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.dreampiggy.SDWebImageSwiftUI;
PRODUCT_NAME = SDWebImageSwiftUI;
SKIP_INSTALL = YES;
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
32C43DD622FD540D00BE87F5 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Automatic;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Carthage/Build/iOS",
);
INFOPLIST_FILE = "$(SRCROOT)/SDWebImageSwiftUI/Module/Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.dreampiggy.SDWebImageSwiftUI;
PRODUCT_NAME = SDWebImageSwiftUI;
SKIP_INSTALL = YES;
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
};
32C43DFA22FD57FD00BE87F5 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Carthage/Build/Mac",
);
INFOPLIST_FILE = "$(SRCROOT)/SDWebImageSwiftUI/Module/Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
"@loader_path/Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.15;
PRODUCT_BUNDLE_IDENTIFIER = "com.dreampiggy.SDWebImageSwiftUI-macOS";
PRODUCT_NAME = SDWebImageSwiftUI;
SDKROOT = macosx;
SKIP_INSTALL = YES;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
32C43DFB22FD57FD00BE87F5 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Carthage/Build/Mac",
);
INFOPLIST_FILE = "$(SRCROOT)/SDWebImageSwiftUI/Module/Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
"@loader_path/Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.15;
PRODUCT_BUNDLE_IDENTIFIER = "com.dreampiggy.SDWebImageSwiftUI-macOS";
PRODUCT_NAME = SDWebImageSwiftUI;
SDKROOT = macosx;
SKIP_INSTALL = YES;
SWIFT_VERSION = 5.0;
};
name = Release;
};
32C43E0722FD581400BE87F5 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Automatic;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Carthage/Build/tvOS",
);
INFOPLIST_FILE = "$(SRCROOT)/SDWebImageSwiftUI/Module/Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = "com.dreampiggy.SDWebImageSwiftUI-tvOS";
PRODUCT_NAME = SDWebImageSwiftUI;
SDKROOT = appletvos;
SKIP_INSTALL = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 3;
};
name = Debug;
};
32C43E0822FD581400BE87F5 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Automatic;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Carthage/Build/tvOS",
);
INFOPLIST_FILE = "$(SRCROOT)/SDWebImageSwiftUI/Module/Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = "com.dreampiggy.SDWebImageSwiftUI-tvOS";
PRODUCT_NAME = SDWebImageSwiftUI;
SDKROOT = appletvos;
SKIP_INSTALL = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 3;
};
name = Release;
};
32C43E1422FD581C00BE87F5 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
APPLICATION_EXTENSION_API_ONLY = YES;
CODE_SIGN_STYLE = Automatic;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Carthage/Build/watchOS",
);
INFOPLIST_FILE = "$(SRCROOT)/SDWebImageSwiftUI/Module/Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = "com.dreampiggy.SDWebImageSwiftUI-watchOS";
PRODUCT_NAME = SDWebImageSwiftUI;
SDKROOT = watchos;
SKIP_INSTALL = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 4;
};
name = Debug;
};
32C43E1522FD581C00BE87F5 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
APPLICATION_EXTENSION_API_ONLY = YES;
CODE_SIGN_STYLE = Automatic;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Carthage/Build/watchOS",
);
INFOPLIST_FILE = "$(SRCROOT)/SDWebImageSwiftUI/Module/Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = "com.dreampiggy.SDWebImageSwiftUI-watchOS";
PRODUCT_NAME = SDWebImageSwiftUI;
SDKROOT = watchos;
SKIP_INSTALL = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 4;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
32C43DC622FD540D00BE87F5 /* Build configuration list for PBXProject "SDWebImageSwiftUI" */ = {
isa = XCConfigurationList;
buildConfigurations = (
32C43DD222FD540D00BE87F5 /* Debug */,
32C43DD322FD540D00BE87F5 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
32C43DD422FD540D00BE87F5 /* Build configuration list for PBXNativeTarget "SDWebImageSwiftUI" */ = {
isa = XCConfigurationList;
buildConfigurations = (
32C43DD522FD540D00BE87F5 /* Debug */,
32C43DD622FD540D00BE87F5 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
32C43DF922FD57FD00BE87F5 /* Build configuration list for PBXNativeTarget "SDWebImageSwiftUI macOS" */ = {
isa = XCConfigurationList;
buildConfigurations = (
32C43DFA22FD57FD00BE87F5 /* Debug */,
32C43DFB22FD57FD00BE87F5 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
32C43E0622FD581400BE87F5 /* Build configuration list for PBXNativeTarget "SDWebImageSwiftUI tvOS" */ = {
isa = XCConfigurationList;
buildConfigurations = (
32C43E0722FD581400BE87F5 /* Debug */,
32C43E0822FD581400BE87F5 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
32C43E1322FD581C00BE87F5 /* Build configuration list for PBXNativeTarget "SDWebImageSwiftUI watchOS" */ = {
isa = XCConfigurationList;
buildConfigurations = (
32C43E1422FD581C00BE87F5 /* Debug */,
32C43E1522FD581C00BE87F5 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 32C43DC322FD540D00BE87F5 /* Project object */;
}

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:SDWebImageSwiftUI.xcodeproj">
</FileRef>
</Workspace>

View File

@ -1,21 +1,70 @@
//
// Image+WebCache.swift
// SDWebImageSwiftUIDemo
// AnimatedImage.swift
// SDWebImageSwiftUI
//
// Created by lizhuoli on 2019/7/26.
// Created by lizhuoli on 2019/8/9.
// Copyright © 2019 lizhuoli. All rights reserved.
//
import SwiftUI
import SDWebImage
public struct AnimatedImage: UIViewRepresentable {
#if !os(watchOS)
public struct AnimatedImage: ViewRepresentable {
var url: URL?
var name: String?
var bundle: Bundle?
var data: Data?
var scale: Length = 0
#if os(macOS)
public typealias NSViewType = SDAnimatedImageView
#else
public typealias UIViewType = SDAnimatedImageView
#endif
#if os(macOS)
public func makeNSView(context: NSViewRepresentableContext<AnimatedImage>) -> SDAnimatedImageView {
makeView(context: context)
}
public func updateNSView(_ nsView: SDAnimatedImageView, context: NSViewRepresentableContext<AnimatedImage>) {
updateView(nsView, context: context)
}
#else
public func makeUIView(context: UIViewRepresentableContext<AnimatedImage>) -> SDAnimatedImageView {
makeView(context: context)
}
public func updateUIView(_ uiView: SDAnimatedImageView, context: UIViewRepresentableContext<AnimatedImage>) {
updateView(uiView, context: context)
}
#endif
func makeView(context: ViewRepresentableContext<AnimatedImage>) -> SDAnimatedImageView {
SDAnimatedImageView()
}
func updateView(_ view: SDAnimatedImageView, context: ViewRepresentableContext<AnimatedImage>) {
if let url = url {
view.sd_setImage(with: url)
return
}
if let name = name {
#if os(macOS)
view.image = SDAnimatedImage(named: name, in: bundle)
#else
view.image = SDAnimatedImage(named: name, in: bundle, compatibleWith: nil)
#endif
return
}
if let data = data {
view.image = SDAnimatedImage(data: data, scale: scale)
return
}
}
public init(url: URL, placeholder: Image? = nil, options: SDWebImageOptions = [], context: [SDWebImageContextOption : Any]? = nil) {
self.url = url
}
@ -29,23 +78,6 @@ public struct AnimatedImage: UIViewRepresentable {
self.data = data
self.scale = scale
}
public func makeUIView(context: UIViewRepresentableContext<AnimatedImage>) -> SDAnimatedImageView {
SDAnimatedImageView()
}
public func updateUIView(_ uiView: SDAnimatedImageView, context: UIViewRepresentableContext<AnimatedImage>) {
if let url = url {
uiView.sd_setImage(with: url)
return
}
if let name = name {
uiView.image = SDAnimatedImage(named: name, in: bundle, compatibleWith: nil)
return
}
if let data = data {
uiView.image = SDAnimatedImage(data: data, scale: scale)
return
}
}
}
#endif

View File

@ -1,8 +1,9 @@
//
// ImageManager.swift
// Pods-SDWebImageSwiftUIDemo
// SDWebImageSwiftUI
//
// Created by lizhuoli on 2019/8/7.
// Created by lizhuoli on 2019/8/9.
// Copyright © 2019 lizhuoli. All rights reserved.
//
import SwiftUI
@ -16,7 +17,7 @@ class ImageManager : BindableObject {
private var manager = SDWebImageManager.shared
private weak var currentOperation: SDWebImageOperation? = nil
var image: UIImage? {
var image: Image? {
willSet {
willChange.send(self)
}
@ -37,7 +38,13 @@ class ImageManager : BindableObject {
func load() {
currentOperation = manager.loadImage(with: url, options: options, context: context, progress: nil) { (image, data, error, cacheType, _, _) in
self.image = image
if let image = image {
#if os(macOS)
self.image = Image(nsImage: image)
#else
self.image = Image(uiImage: image)
#endif
}
}
}

View File

@ -0,0 +1,22 @@
//
// SDWebImageSwiftUI.swift
// SDWebImageSwiftUI
//
// Created by lizhuoli on 2019/8/9.
// Copyright © 2019 lizhuoli. All rights reserved.
//
import Foundation
import SwiftUI
#if !os(watchOS)
#if os(macOS)
typealias ViewRepresentable = NSViewRepresentable
typealias ViewRepresentableContext = NSViewRepresentableContext
#else
typealias ViewRepresentable = UIViewRepresentable
typealias ViewRepresentableContext = UIViewRepresentableContext
#endif
#endif

View File

@ -1,8 +1,8 @@
//
// WebImage.swift
// SDWebImageSwiftUIDemo
// SDWebImageSwiftUI
//
// Created by lizhuoli on 2019/7/26.
// Created by lizhuoli on 2019/8/9.
// Copyright © 2019 lizhuoli. All rights reserved.
//
@ -27,7 +27,7 @@ public struct WebImage : View {
public var body: some View {
if let image = imageManager.image {
return Image(uiImage: image)
return image
.resizable()
.onAppear {}
.onDisappear {}
@ -37,7 +37,12 @@ public struct WebImage : View {
.onAppear { self.imageManager.load() }
.onDisappear { self.imageManager.cancel() }
} else {
return Image(uiImage: UIImage())
#if os(macOS)
let emptyImage = Image(nsImage: NSImage())
#else
let emptyImage = Image(uiImage: UIImage())
#endif
return emptyImage
.resizable()
.onAppear { self.imageManager.load() }
.onDisappear { self.imageManager.cancel() }

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
</dict>
</plist>

View File

@ -0,0 +1,19 @@
//
// SDWebImageSwiftUI.h
// SDWebImageSwiftUI
//
// Created by lizhuoli on 2019/8/9.
// Copyright © 2019 lizhuoli. All rights reserved.
//
#import <Foundation/Foundation.h>
//! Project version number for SDWebImageSwiftUI.
FOUNDATION_EXPORT double SDWebImageSwiftUIVersionNumber;
//! Project version string for SDWebImageSwiftUI.
FOUNDATION_EXPORT const unsigned char SDWebImageSwiftUIVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <SDWebImageSwiftUI/PublicHeader.h>