Skip to content
This repository was archived by the owner on Aug 3, 2022. It is now read-only.

Add SPM support #10

Merged
merged 3 commits into from
Dec 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ DerivedData
*.hmap
*.ipa

# SPM
.swiftpm/

# Bundler
.bundle

Expand Down
43 changes: 43 additions & 0 deletions Package.resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"object": {
"pins": [
{
"package": "CocoaLumberjack",
"repositoryURL": "https://github.com/CocoaLumberjack/CocoaLumberjack.git",
"state": {
"branch": null,
"revision": "e518eb6e362df327574ba5e04269cd6d29f40aec",
"version": "3.7.2"
}
},
{
"package": "SDWebImage",
"repositoryURL": "https://github.com/SDWebImage/SDWebImage.git",
"state": {
"branch": null,
"revision": "a72df4849408da7e5d3c1b586797b7c601c41d1b",
"version": "5.12.1"
}
},
{
"package": "SVGKit",
"repositoryURL": "https://github.com/SVGKit/SVGKit.git",
"state": {
"branch": null,
"revision": "58152b9f7c85eab239160b36ffdfd364aa43d666",
"version": "3.0.0"
}
},
{
"package": "swift-log",
"repositoryURL": "https://github.com/apple/swift-log.git",
"state": {
"branch": null,
"revision": "5d66f7ba25daf4f94100e7022febf3c75e37a6c7",
"version": "1.4.2"
}
}
]
},
"version": 1
}
33 changes: 33 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// swift-tools-version:5.1
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription

let package = Package(
name: "SDWebImageSVGKitPlugin",
platforms: [
.macOS(.v10_11), .iOS(.v13), .tvOS(.v13)
],
products: [
// Products define the executables and libraries produced by a package, and make them visible to other packages.
.library(
name: "SDWebImageSVGKitPlugin",
targets: ["SDWebImageSVGKitPlugin"]),
],
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/SVGKit/SVGKit.git", from: "3.0.0")
],
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: "SDWebImageSVGKitPlugin",
dependencies: ["SDWebImage", "SVGKit"],
path: ".",
sources: ["SDWebImageSVGKitPlugin/Classes"],
publicHeadersPath: "SDWebImageSVGKitPlugin/Classes"
)
]
)
4 changes: 4 additions & 0 deletions SDWebImageSVGKitPlugin/Classes/SDImageSVGKCoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
// Created by DreamPiggy on 2018/9/27.
//

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

NS_ASSUME_NONNULL_BEGIN

Expand Down
5 changes: 4 additions & 1 deletion SDWebImageSVGKitPlugin/Classes/SDImageSVGKCoder.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@
#import "SDImageSVGKCoder.h"
#import "SDSVGKImage.h"
#import "SDWebImageSVGKitDefine.h"
#if __has_include(<SVGKit/SVGKit.h>)
#import <SVGKit/SVGKit.h>

#else
@import SVGKit;
#endif
#define kSVGTagEnd @"</svg>"

@implementation SDImageSVGKCoder
Expand Down
8 changes: 8 additions & 0 deletions SDWebImageSVGKitPlugin/Classes/SDSVGKImage.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,16 @@
// Created by DreamPiggy on 2018/10/10.
//

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

NS_ASSUME_NONNULL_BEGIN

Expand Down
4 changes: 4 additions & 0 deletions SDWebImageSVGKitPlugin/Classes/SDWebImageSVGKitDefine.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
// Created by DreamPiggy on 2018/10/11.
//

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

@class SVGKImage;

Expand Down
5 changes: 4 additions & 1 deletion SDWebImageSVGKitPlugin/Classes/SDWebImageSVGKitDefine.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@
//

#import "SDWebImageSVGKitDefine.h"
#if __has_include(<SVGKit/SVGKit.h>)
#import <SVGKit/SVGKit.h>

#else
@import SVGKit;
#endif
#if SD_UIKIT
void SDAdjustSVGContentMode(SVGKImage * svgImage, UIViewContentMode contentMode, CGSize viewSize) {
NSCParameterAssert(svgImage);
Expand Down
4 changes: 4 additions & 0 deletions SDWebImageSVGKitPlugin/Classes/SVGKImageView+WebCache.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
// Created by DreamPiggy on 2018/10/10.
//

#if __has_include(<SVGKit/SVGKit.h>)
#import <SVGKit/SVGKit.h>
#else
@import SVGKit;
#endif
#import "SDWebImageSVGKitDefine.h"

NS_ASSUME_NONNULL_BEGIN
Expand Down