Skip to content

Commit

Permalink
Merge pull request #3 from SDWebImage/swiftpm
Browse files Browse the repository at this point in the history
Added SwiftPM support
  • Loading branch information
dreampiggy authored Feb 19, 2021
2 parents f8dc0f0 + 1a64c35 commit cdeb11a
Show file tree
Hide file tree
Showing 6 changed files with 105 additions and 0 deletions.
34 changes: 34 additions & 0 deletions Package.resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"object": {
"pins": [
{
"package": "PINCache",
"repositoryURL": "https://github.com/pinterest/PINCache.git",
"state": {
"branch": null,
"revision": "875c654984fb52b47ca65ae70d24852b0003ccd9",
"version": "3.0.3"
}
},
{
"package": "PINOperation",
"repositoryURL": "https://github.com/pinterest/PINOperation.git",
"state": {
"branch": null,
"revision": "44d8ca154a4e75a028a5548c31ff3a53b90cef15",
"version": "1.2.1"
}
},
{
"package": "SDWebImage",
"repositoryURL": "https://github.com/SDWebImage/SDWebImage.git",
"state": {
"branch": null,
"revision": "a6b6e44eadf0d39250c10a7cc0e3b91d0bdb0e94",
"version": "5.10.4"
}
}
]
},
"version": 1
}
34 changes: 34 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// swift-tools-version:5.0
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "SDWebImagePINPlugin",
platforms: [
.macOS(.v10_11), .iOS(.v9), .tvOS(.v9), .watchOS(.v2)
],
products: [
// Products define the executables and libraries produced by a package, and make them visible to other packages.
.library(
name: "SDWebImagePINPlugin",
targets: ["SDWebImagePINPlugin"]),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
.package(url: "https://github.com/SDWebImage/SDWebImage.git", from: "5.10.0"),
.package(url: "https://github.com/pinterest/PINCache.git", from: "3.0.2")
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages which this package depends on.
.target(
name: "SDWebImagePINPlugin",
dependencies: ["SDWebImage", "PINCache"],
path: ".",
sources: ["SDWebImagePINPlugin/Classes"],
publicHeadersPath: "SDWebImagePINPlugin/Classes"
)
]
)
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
[![License](https://img.shields.io/cocoapods/l/SDWebImagePINPlugin.svg?style=flat)](https://cocoapods.org/pods/SDWebImagePINPlugin)
[![Platform](https://img.shields.io/cocoapods/p/SDWebImagePINPlugin.svg?style=flat)](https://cocoapods.org/pods/SDWebImagePINPlugin)
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/SDWebImage/SDWebImagePINPlugin)
[![SwiftPM compatible](https://img.shields.io/badge/SwiftPM-compatible-brightgreen.svg?style=flat)](https://swift.org/package-manager/)
[![codecov](https://codecov.io/gh/SDWebImage/SDWebImagePINPlugin/branch/master/graph/badge.svg)](https://codecov.io/gh/SDWebImage/SDWebImagePINPlugin)


Expand Down Expand Up @@ -97,6 +98,18 @@ SDWebImageFLPlugin is available through [Carthage](https://github.com/Carthage/C
github "SDWebImage/SDWebImagePINPlugin"
```

#### Swift Package Manager (Xcode 11+)

SDWebImagePhotosPlugin is available through [Swift Package Manager](https://swift.org/package-manager).

```swift
let package = Package(
dependencies: [
.package(url: "https://github.com/SDWebImage/SDWebImagePINPlugin.git", from: "0.3.0")
]
)
```

## Author

DreamPiggy, lizhuoli1126@126.com
Expand Down
8 changes: 8 additions & 0 deletions SDWebImagePINPlugin/Classes/PINCache+SDAdditions.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,16 @@
*/


#if __has_include(<PINCache/PINCache.h>)
#import <PINCache/PINCache.h>
#else
@import PINCache;
#endif
#if __has_include(<SDWebImage/SDWebImage.h>)
#import <SDWebImage/SDWebImage.h>
#else
@import SDWebImage;
#endif

/// PINCache category to support `SDImageCache` protocol. This allow user who prefer PINCache to be used as SDWebImage's custom image cache
@interface PINCache (SDAdditions) <SDImageCache>
Expand Down
8 changes: 8 additions & 0 deletions SDWebImagePINPlugin/Classes/PINDiskCache+SDAdditions.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,16 @@
* file that was distributed with this source code.
*/

#if __has_include(<PINCache/PINCache.h>)
#import <PINCache/PINCache.h>
#else
@import PINCache;
#endif
#if __has_include(<SDWebImage/SDWebImage.h>)
#import <SDWebImage/SDWebImage.h>
#else
@import SDWebImage;
#endif

/// PINDiskCache category to support `SDDiskCache` protocol. This allow user who prefer PINDiskCache to be used as SDWebImage's custom disk cache
@interface PINDiskCache (SDAdditions) <SDDiskCache>
Expand Down
8 changes: 8 additions & 0 deletions SDWebImagePINPlugin/Classes/PINMemoryCache+SDAdditions.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,16 @@
* file that was distributed with this source code.
*/

#if __has_include(<PINCache/PINCache.h>)
#import <PINCache/PINCache.h>
#else
@import PINCache;
#endif
#if __has_include(<SDWebImage/SDWebImage.h>)
#import <SDWebImage/SDWebImage.h>
#else
@import SDWebImage;
#endif

/// PINMemoryCache category to support `SDMemoryCache` protocol. This allow user who prefer PINMemoryCache to be used as SDWebImage's custom memory cache
@interface PINMemoryCache (SDAdditions) <SDMemoryCache>
Expand Down

0 comments on commit cdeb11a

Please sign in to comment.