Skip to content

Commit d1c79f7

Browse files
committed
Add support for SwiftPM
1 parent f4e9186 commit d1c79f7

7 files changed

+57
-5
lines changed

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,7 @@ Carthage/Build
3434
# `pod install` in .travis.yml
3535
#
3636
Example/Pods
37+
38+
# SwiftPM
39+
.swiftpm
40+
.build

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": "master",
9+
"revision": "09f06159a3284f6981d5495728e5c3cb3dfb82fa",
10+
"version": null
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.0
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: "SDWebImagePhotosPlugin",
8+
platforms: [
9+
.macOS(.v10_13), .iOS(.v8), .tvOS(.v10)
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: "SDWebImagePhotosPlugin",
15+
targets: ["SDWebImagePhotosPlugin"]),
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: "SDWebImagePhotosPlugin",
27+
dependencies: ["SDWebImage"],
28+
path: ".",
29+
sources: ["SDWebImagePhotosPlugin/Classes"],
30+
publicHeadersPath: "SDWebImagePhotosPlugin/Classes"
31+
)
32+
]
33+
)

SDWebImagePhotosPlugin/Classes/PHImageRequestOptions+SDWebImagePhotosPlugin.m

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
#import "PHImageRequestOptions+SDWebImagePhotosPlugin.h"
1010
#import "SDWebImagePhotosDefine.h"
11-
#import <SDWebImage/SDWebImage.h>
1211
#import <objc/runtime.h>
1312

1413
@implementation PHImageRequestOptions (SDWebImagePhotosPlugin)

SDWebImagePhotosPlugin/Classes/SDWebImagePhotosDefine.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* file that was distributed with this source code.
77
*/
88

9-
#import <SDWebImage/SDWebImageDefine.h>
9+
@import SDWebImage;
1010

1111
/**
1212
* The scheme when identifing the URL is Photos URL

SDWebImagePhotosPlugin/Classes/SDWebImagePhotosLoader.h

+2-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@
66
* file that was distributed with this source code.
77
*/
88

9-
#import <SDWebImage/SDWebImage.h>
10-
#import <Photos/Photos.h>
11-
#import "SDWebImagePhotosDefine.h"
9+
@import SDWebImage;
10+
@import Photos;
1211

1312
// The imgae loader to load image asset from Photos library. You need to register the loader into manager firstly. Use `@import SDWebImagePhotosPlugin` to import full framework instead of each header.
1413
// @note To control single image request options, use the context option in `SDWebImagePhotosDefine.h`.

SDWebImagePhotosPlugin/Classes/SDWebImagePhotosLoader.m

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
*/
88

99
#import "SDWebImagePhotosLoader.h"
10+
#import "SDWebImagePhotosDefine.h"
1011
#import "NSURL+SDWebImagePhotosPlugin.h"
1112
#import "PHImageRequestOptions+SDWebImagePhotosPlugin.h"
1213
#import "SDWebImagePhotosError.h"

0 commit comments

Comments
 (0)