From a1c740ff2ae2b3bfd8b908b7ef75297a720e45a3 Mon Sep 17 00:00:00 2001 From: Cassius Pacheco Date: Wed, 3 Aug 2022 14:31:45 +1000 Subject: [PATCH] feat(cocoapods): add cocoapods spec Setup cocoapods spec for the package. --- .swift-version | 2 +- ImmutableXCore.podspec | 28 +++++++++++++++++++++ Sources/ImmutableXCore/ImmutableXCore.swift | 6 ++++- 3 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 ImmutableXCore.podspec diff --git a/.swift-version b/.swift-version index 566ac63..e5e7441 100644 --- a/.swift-version +++ b/.swift-version @@ -1 +1 @@ -5.6.1 \ No newline at end of file +5.5 \ No newline at end of file diff --git a/ImmutableXCore.podspec b/ImmutableXCore.podspec new file mode 100644 index 0000000..05fd876 --- /dev/null +++ b/ImmutableXCore.podspec @@ -0,0 +1,28 @@ +Pod::Spec.new do |spec| + spec.name = 'ImmutableXCore' + spec.version = '0.1.0' + spec.summary = 'The Immutable X Core SDK Swift for applications written on the Immutable X platform.' + + spec.description = <<-DESC + The Immutable Core SDK Swift provides convenient access to the Immutable API's for applications written on the Immutable X platform. + DESC + + spec.homepage = 'https://github.com/immutable/imx-core-sdk-swift' + spec.documentation_url = 'https://docs.x.immutable.com/sdk-docs/core-sdk-swift/overview' + spec.license = { :type => 'Apache License 2.0', :file => 'LICENSE' } + spec.author = { 'Immutable' => 'opensource@immutable.com'} + + spec.source = { :git => 'https://github.com/immutable/imx-core-sdk-swift.git', :tag => "v#{spec.version}" } + spec.source_files = 'Sources/**/*.swift' + + spec.swift_version = '5.5' + + spec.ios.deployment_target = '13' + spec.osx.deployment_target = '10.15' + + spec.dependency 'AnyCodable-FlightSchool', '~> 0.6' + spec.dependency 'BigInt', '~> 5.2.0' + spec.dependency 'secp256k1.swift', '~> 0.1' + + spec.resources = ['Sources/ImmutableXCore/version'] + end \ No newline at end of file diff --git a/Sources/ImmutableXCore/ImmutableXCore.swift b/Sources/ImmutableXCore/ImmutableXCore.swift index 2fb1c59..744628a 100644 --- a/Sources/ImmutableXCore/ImmutableXCore.swift +++ b/Sources/ImmutableXCore/ImmutableXCore.swift @@ -28,7 +28,11 @@ public struct ImmutableXCore { /// Returns the version of the sdk reading from the `version` file, e.g. `"1.0.0"` internal var sdkVersion: String { - let file = Bundle.module.path(forResource: "version", ofType: "")! + #if SWIFT_PACKAGE + let file = Bundle.module.path(forResource: "version", ofType: "")! + #else + let file = Bundle(for: BuyWorkflow.self).path(forResource: "version", ofType: "")! + #endif // swiftlint:disable:next force_try return try! String(contentsOfFile: file).trimmingCharacters(in: CharacterSet.whitespacesAndNewlines) }