From 1a64c35ac2c97915ba4959f43eb24a9735e1ebb9 Mon Sep 17 00:00:00 2001 From: DreamPiggy Date: Fri, 19 Feb 2021 16:03:03 +0800 Subject: [PATCH] Added SwiftPM support --- Package.resolved | 34 +++++++++++++++++++ Package.swift | 34 +++++++++++++++++++ README.md | 13 +++++++ .../Classes/PINCache+SDAdditions.h | 8 +++++ .../Classes/PINDiskCache+SDAdditions.h | 8 +++++ .../Classes/PINMemoryCache+SDAdditions.h | 8 +++++ 6 files changed, 105 insertions(+) create mode 100644 Package.resolved create mode 100644 Package.swift diff --git a/Package.resolved b/Package.resolved new file mode 100644 index 0000000..84e80bd --- /dev/null +++ b/Package.resolved @@ -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 +} diff --git a/Package.swift b/Package.swift new file mode 100644 index 0000000..e5897b6 --- /dev/null +++ b/Package.swift @@ -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" + ) + ] +) diff --git a/README.md b/README.md index 0e72f4c..9b72b8b 100644 --- a/README.md +++ b/README.md @@ -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) @@ -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 diff --git a/SDWebImagePINPlugin/Classes/PINCache+SDAdditions.h b/SDWebImagePINPlugin/Classes/PINCache+SDAdditions.h index 68018c7..a2906ec 100644 --- a/SDWebImagePINPlugin/Classes/PINCache+SDAdditions.h +++ b/SDWebImagePINPlugin/Classes/PINCache+SDAdditions.h @@ -6,8 +6,16 @@ */ +#if __has_include() #import +#else +@import PINCache; +#endif +#if __has_include() #import +#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) diff --git a/SDWebImagePINPlugin/Classes/PINDiskCache+SDAdditions.h b/SDWebImagePINPlugin/Classes/PINDiskCache+SDAdditions.h index deea7bc..7b0b74f 100644 --- a/SDWebImagePINPlugin/Classes/PINDiskCache+SDAdditions.h +++ b/SDWebImagePINPlugin/Classes/PINDiskCache+SDAdditions.h @@ -5,8 +5,16 @@ * file that was distributed with this source code. */ +#if __has_include() #import +#else +@import PINCache; +#endif +#if __has_include() #import +#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) diff --git a/SDWebImagePINPlugin/Classes/PINMemoryCache+SDAdditions.h b/SDWebImagePINPlugin/Classes/PINMemoryCache+SDAdditions.h index c98b241..c2466e3 100644 --- a/SDWebImagePINPlugin/Classes/PINMemoryCache+SDAdditions.h +++ b/SDWebImagePINPlugin/Classes/PINMemoryCache+SDAdditions.h @@ -5,8 +5,16 @@ * file that was distributed with this source code. */ +#if __has_include() #import +#else +@import PINCache; +#endif +#if __has_include() #import +#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)