Skip to content

Commit

Permalink
Merge pull request #574 from WalletConnect/develop
Browse files Browse the repository at this point in the history
1.0.5
  • Loading branch information
flypaper0 authored Nov 8, 2022
2 parents 02b3b8f + d93f8c1 commit 84197cd
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
29 changes: 29 additions & 0 deletions Sources/WalletConnectRelay/BundleFinder.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import class Foundation.Bundle

private class BundleFinder {}

extension Foundation.Bundle {
/// Returns the resource bundle associated with the current Swift module.
static var resourceBundle: Bundle = {
let bundleName = "WalletConnect_WalletConnectRelay"

let candidates = [
// Bundle should be present here when the package is linked into an App.
Bundle.main.resourceURL,

// Bundle should be present here when the package is linked into a framework.
Bundle(for: BundleFinder.self).resourceURL,

// For command-line tools.
Bundle.main.bundleURL,
]

for candidate in candidates {
let bundlePath = candidate?.appendingPathComponent(bundleName + ".bundle")
if let bundle = bundlePath.flatMap(Bundle.init(url:)) {
return bundle
}
}
fatalError("unable to find bundle named WalletConnect_WalletConnectRelay")
}()
}
2 changes: 1 addition & 1 deletion Sources/WalletConnectRelay/EnvironmentInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ enum EnvironmentInfo {
}

static var packageVersion: String {
let configURL = Bundle.module.url(forResource: "PackageConfig", withExtension: "json")!
let configURL = Bundle.resourceBundle.url(forResource: "PackageConfig", withExtension: "json")!
let jsonData = try! Data(contentsOf: configURL)
let config = try! JSONDecoder().decode(PackageConfig.self, from: jsonData)
return config.version
Expand Down
5 changes: 5 additions & 0 deletions WalletConnectSwiftV2.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,11 @@ Pod::Spec.new do |spec|
spec.subspec 'WalletConnectRelay' do |ss|
ss.source_files = 'Sources/WalletConnectRelay/**/*'
ss.dependency 'WalletConnectSwiftV2/WalletConnectKMS'
ss.resource_bundles = {
'WalletConnect_WalletConnectRelay' => [
'Sources/WalletConnectRelay/PackageConfig.json'
]
}
end

spec.subspec 'WalletConnectUtils' do |ss|
Expand Down

0 comments on commit 84197cd

Please sign in to comment.