Skip to content

Commit 7c4dfcb

Browse files
committed
Add SwiftPM and support for watchOS
1 parent 2136385 commit 7c4dfcb

File tree

10 files changed

+284
-65
lines changed

10 files changed

+284
-65
lines changed

.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cartfile

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
github "SDWebImage/SDWebImage" ~> 5.0
2-
github "SVGKit/SVGKit" >= 2.1
1+
github "SDWebImage/SDWebImage" ~> 5.0

Cartfile.resolved

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
github "CocoaLumberjack/CocoaLumberjack" "3.5.2"
2-
github "SDWebImage/SDWebImage" "5.0.0"
3-
github "SVGKit/SVGKit" "2.1.0"
1+
github "SDWebImage/SDWebImage" "5.3.1"

Package.resolved

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"object": {
3+
"pins": [
4+
{
5+
"package": "SDWebImage",
6+
"repositoryURL": "https://github.com/SDWebImage/SDWebImage.git",
7+
"state": {
8+
"branch": null,
9+
"revision": "7adc385b7d9aa758fb5073bcea478f31293c4e40",
10+
"version": "5.3.1"
11+
}
12+
}
13+
]
14+
},
15+
"version": 1
16+
}

Package.swift

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// swift-tools-version:5.1
2+
// The swift-tools-version declares the minimum version of Swift required to build this package.
3+
4+
import PackageDescription
5+
6+
let package = Package(
7+
name: "SDWebImageSVGCoder",
8+
platforms: [
9+
.macOS(.v10_15), .iOS(.v13), .tvOS(.v13), .watchOS(.v6)
10+
],
11+
products: [
12+
// Products define the executables and libraries produced by a package, and make them visible to other packages.
13+
.library(
14+
name: "SDWebImageSVGCoder",
15+
targets: ["SDWebImageSVGCoder"]),
16+
],
17+
dependencies: [
18+
// Dependencies declare other packages that this package depends on.
19+
// .package(url: /* package url */, from: "1.0.0"),
20+
.package(url: "https://github.com/SDWebImage/SDWebImage.git", from: "5.1.0")
21+
],
22+
targets: [
23+
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
24+
// Targets can depend on other targets in this package, and on products in packages which this package depends on.
25+
.target(
26+
name: "SDWebImageSVGCoder",
27+
dependencies: ["SDWebImage"],
28+
path: ".",
29+
sources: ["SDWebImageSVGCoder/Classes"],
30+
publicHeadersPath: "SDWebImageSVGCoder/Classes"
31+
)
32+
]
33+
)

SDWebImageSVGCoder.xcodeproj/project.pbxproj

+155-56
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "1120"
4+
version = "1.3">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES">
8+
<BuildActionEntries>
9+
<BuildActionEntry
10+
buildForTesting = "YES"
11+
buildForRunning = "YES"
12+
buildForProfiling = "YES"
13+
buildForArchiving = "YES"
14+
buildForAnalyzing = "YES">
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "32407BEE23799A5900F9AFA4"
18+
BuildableName = "SDWebImageSVGCoder.framework"
19+
BlueprintName = "SDWebImageSVGCoder watchOS"
20+
ReferencedContainer = "container:SDWebImageSVGCoder.xcodeproj">
21+
</BuildableReference>
22+
</BuildActionEntry>
23+
</BuildActionEntries>
24+
</BuildAction>
25+
<TestAction
26+
buildConfiguration = "Debug"
27+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+
shouldUseLaunchSchemeArgsEnv = "YES">
30+
<Testables>
31+
</Testables>
32+
</TestAction>
33+
<LaunchAction
34+
buildConfiguration = "Debug"
35+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
36+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
37+
launchStyle = "0"
38+
useCustomWorkingDirectory = "NO"
39+
ignoresPersistentStateOnLaunch = "NO"
40+
debugDocumentVersioning = "YES"
41+
debugServiceExtension = "internal"
42+
allowLocationSimulation = "YES">
43+
</LaunchAction>
44+
<ProfileAction
45+
buildConfiguration = "Release"
46+
shouldUseLaunchSchemeArgsEnv = "YES"
47+
savedToolIdentifier = ""
48+
useCustomWorkingDirectory = "NO"
49+
debugDocumentVersioning = "YES">
50+
<MacroExpansion>
51+
<BuildableReference
52+
BuildableIdentifier = "primary"
53+
BlueprintIdentifier = "32407BEE23799A5900F9AFA4"
54+
BuildableName = "SDWebImageSVGCoder.framework"
55+
BlueprintName = "SDWebImageSVGCoder watchOS"
56+
ReferencedContainer = "container:SDWebImageSVGCoder.xcodeproj">
57+
</BuildableReference>
58+
</MacroExpansion>
59+
</ProfileAction>
60+
<AnalyzeAction
61+
buildConfiguration = "Debug">
62+
</AnalyzeAction>
63+
<ArchiveAction
64+
buildConfiguration = "Release"
65+
revealArchiveInOrganizer = "YES">
66+
</ArchiveAction>
67+
</Scheme>

SDWebImageSVGCoder/Classes/SDImageSVGCoder.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// Created by DreamPiggy on 2018/9/27.
66
//
77

8-
#import <SDWebImage/SDWebImage.h>
8+
@import SDWebImage;
99

1010
NS_ASSUME_NONNULL_BEGIN
1111

SDWebImageSVGCoder/Classes/SDImageSVGCoder.m

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
static void (*CGSVGDocumentRelease)(CGSVGDocumentRef);
1919
static void (*CGSVGDocumentWriteToData)(CGSVGDocumentRef document, CFDataRef data, CFDictionaryRef options);
2020

21-
#if SD_UIKIT
21+
#if SD_UIKIT || SD_WATCH
2222

2323
@interface UIImage (PrivateSVGSupport)
2424

@@ -92,7 +92,7 @@ - (UIImage *)decodedImageWithData:(NSData *)data options:(SDImageCoderOptions *)
9292
if (!imageRep) {
9393
return nil;
9494
}
95-
NSImage *image = [[NSImage alloc] initWithSize:imageSize];
95+
NSImage *image = [[NSImage alloc] initWithSize:imageRep.size];
9696
[image addRepresentation:imageRep];
9797
#else
9898
CGDataProviderRef provider = CGDataProviderCreateWithCFData((__bridge CFDataRef)data);

SDWebImageSVGCoder/Classes/SDWebImageSVGCoderDefine.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// Created by DreamPiggy on 2018/10/11.
66
//
77

8-
#import <SDWebImage/SDWebImage.h>
8+
@import SDWebImage;
99

1010
/**
1111
A CGSize raw value which specify the desired SVG image size during image loading. Because vector image like SVG format, may not contains a fixed size, or you want to get a larger size bitmap representation UIImage. (NSValue)

0 commit comments

Comments
 (0)