From 6f38f672afa88a4ca9af19dcbe7b4b6d9fe4afee Mon Sep 17 00:00:00 2001 From: Luis Padron Date: Fri, 4 Oct 2024 16:23:22 -0400 Subject: [PATCH] Add support for Swift Package Manager --- .github/workflows/ci.yml | 8 ++++ AardvarkReveal.podspec | 2 +- Package.resolved | 14 ++++++ Package.swift | 44 +++++++++++++++++++ .../RevealAttachmentGenerator.swift | 5 +++ .../ARKCompressionUtility.m | 0 .../include}/ARKCompressionUtility.h | 0 .../include}/AardvarkReveal.h | 4 ++ 8 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 Package.resolved create mode 100644 Package.swift rename Sources/{AardvarkReveal => AardvarkRevealCompression}/ARKCompressionUtility.m (100%) rename Sources/{AardvarkReveal => AardvarkRevealCompression/include}/ARKCompressionUtility.h (100%) rename Sources/{AardvarkReveal => AardvarkRevealCompression/include}/AardvarkReveal.h (94%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6c5ffe8..4989537 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -49,3 +49,11 @@ jobs: run: bundle exec --gemfile=Example/Gemfile pod repo update - name: Lint AardvarkReveal Podspec run: bundle exec --gemfile=Example/Gemfile pod lib lint --verbose --fail-fast AardvarkReveal.podspec + swift-build: + name: Swift Build + runs-on: macos-latest + steps: + - name: Checkout Repo + uses: actions/checkout@v4 + - name: Swift Build + run: swift build --sdk "$(xcode-select -p)/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk" --triple "arm64-apple-ios14.0-simulator" diff --git a/AardvarkReveal.podspec b/AardvarkReveal.podspec index ef87d01..caf5fb4 100644 --- a/AardvarkReveal.podspec +++ b/AardvarkReveal.podspec @@ -10,7 +10,7 @@ Pod::Spec.new do |s| s.swift_version = '5.0' s.ios.deployment_target = '14.0' - s.source_files = 'Sources/AardvarkReveal/**/*.{h,m,swift}' + s.source_files = 'Sources/AardvarkReveal/**/*.{swift}', 'Sources/AardvarkRevealCompression/**/*.{h,m}' s.dependency 'Aardvark', '~> 5.0' diff --git a/Package.resolved b/Package.resolved new file mode 100644 index 0000000..33e7ac8 --- /dev/null +++ b/Package.resolved @@ -0,0 +1,14 @@ +{ + "originHash" : "a39d43170971306946381c9853254a3ad21bf79e9e07cbcb45cfe450e008250f", + "pins" : [ + { + "identity" : "aardvark", + "kind" : "remoteSourceControl", + "location" : "https://github.com/square/Aardvark", + "state" : { + "revision" : "ed81f4b510fdcf3d4c816480406427582e627efc" + } + } + ], + "version" : 3 +} diff --git a/Package.swift b/Package.swift new file mode 100644 index 0000000..58b968d --- /dev/null +++ b/Package.swift @@ -0,0 +1,44 @@ +// swift-tools-version:5.10 + +import PackageDescription + +let package = Package( + name: "AardvarkReveal", + platforms: [ + .iOS(.v14), + ], + products: [ + .library( + name: "AardvarkReveal", + targets: ["AardvarkReveal"] + ), + .library( + name: "AardvarkRevealCompression", + targets: ["AardvarkRevealCompression"] + ) + ], + dependencies: [ + .package( + url: "https://github.com/square/Aardvark", + revision: "ed81f4b510fdcf3d4c816480406427582e627efc" // TODO: use a release + ), + ], + targets: [ + .target( + name: "AardvarkReveal", + dependencies: [ + .product(name: "Aardvark", package: "Aardvark"), + .target(name: "AardvarkRevealCompression"), + ], + cSettings: [ + .define("SWIFT_PACKAGE"), + ] + ), + .target( + name: "AardvarkRevealCompression", + cSettings: [ + .define("SWIFT_PACKAGE"), + ] + ), + ] +) diff --git a/Sources/AardvarkReveal/RevealAttachmentGenerator.swift b/Sources/AardvarkReveal/RevealAttachmentGenerator.swift index f89b53c..4ef9003 100644 --- a/Sources/AardvarkReveal/RevealAttachmentGenerator.swift +++ b/Sources/AardvarkReveal/RevealAttachmentGenerator.swift @@ -19,6 +19,11 @@ import Foundation import UIKit import zlib +#if SWIFT_PACKAGE +import AardvarkSwift +import AardvarkRevealCompression +#endif + @objc(ARKRevealAttachmentGeneratorDelegate) public protocol RevealAttachmentGeneratorDelegate: AnyObject { diff --git a/Sources/AardvarkReveal/ARKCompressionUtility.m b/Sources/AardvarkRevealCompression/ARKCompressionUtility.m similarity index 100% rename from Sources/AardvarkReveal/ARKCompressionUtility.m rename to Sources/AardvarkRevealCompression/ARKCompressionUtility.m diff --git a/Sources/AardvarkReveal/ARKCompressionUtility.h b/Sources/AardvarkRevealCompression/include/ARKCompressionUtility.h similarity index 100% rename from Sources/AardvarkReveal/ARKCompressionUtility.h rename to Sources/AardvarkRevealCompression/include/ARKCompressionUtility.h diff --git a/Sources/AardvarkReveal/AardvarkReveal.h b/Sources/AardvarkRevealCompression/include/AardvarkReveal.h similarity index 94% rename from Sources/AardvarkReveal/AardvarkReveal.h rename to Sources/AardvarkRevealCompression/include/AardvarkReveal.h index be37b9b..54338eb 100644 --- a/Sources/AardvarkReveal/AardvarkReveal.h +++ b/Sources/AardvarkRevealCompression/include/AardvarkReveal.h @@ -24,4 +24,8 @@ FOUNDATION_EXPORT const unsigned char AardvarkRevealVersionString[]; // In this header, you should import all the public headers of your framework using statements like #import +#if SWIFT_PACKAGE +#import "ARKCompressionUtility.h" +#else #import +#endif