From 2e30cc99526980bef65a6af714fd7ac9eabffbc3 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 +- Example/Podfile.lock | 2 +- Package.resolved | 15 +++++++ Package.swift | 44 +++++++++++++++++++ .../RevealAttachmentGenerator.swift | 5 +++ .../ARKCompressionUtility.m | 0 .../include}/ARKCompressionUtility.h | 0 .../include}/AardvarkReveal.h | 4 ++ 9 files changed, 78 insertions(+), 2 deletions(-) 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/Example/Podfile.lock b/Example/Podfile.lock index 7a9d2f6..1a01210 100644 --- a/Example/Podfile.lock +++ b/Example/Podfile.lock @@ -32,7 +32,7 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: Aardvark: 783a49c945545c11e82e22a87ef82ced58033c21 AardvarkMailUI: b5324ce0fab7c121e4093baad5280c89a4c8275a - AardvarkReveal: f053047040bd07360c99b782df12c68371a5a5bb + AardvarkReveal: 410027948dda92f201e26d1401ae6d53ed82952c CoreAardvark: a3e7c44b2889acdcf14d39a1d703d1e8bdfd94be Reveal-SDK: 0ecda2395cf587e2f574c19a723b3dd27c90572e diff --git a/Package.resolved b/Package.resolved new file mode 100644 index 0000000..25bf2b9 --- /dev/null +++ b/Package.resolved @@ -0,0 +1,15 @@ +{ + "originHash" : "0a4059d71ef3255e39435e63666b42b53838c8cc2ef6f517795297df18422dcb", + "pins" : [ + { + "identity" : "aardvark", + "kind" : "remoteSourceControl", + "location" : "https://github.com/square/Aardvark", + "state" : { + "revision" : "2eb62ce13df23128dcc89b70cf200d369d47dbbd", + "version" : "5.2.0" + } + } + ], + "version" : 3 +} diff --git a/Package.swift b/Package.swift new file mode 100644 index 0000000..6af7fbc --- /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", + .upToNextMajor(from: "5.2.0") + ), + ], + 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