Skip to content

Commit

Permalink
Merge pull request #29 from reown-com/develop
Browse files Browse the repository at this point in the history
1.0.3
  • Loading branch information
llbartekll authored Oct 9, 2024
2 parents b29d9c1 + 70cc87d commit 812139f
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 6 deletions.
42 changes: 37 additions & 5 deletions Sources/WalletConnectRelay/BundleFinder.swift
Original file line number Diff line number Diff line change
@@ -1,9 +1,41 @@

import Foundation

extension Bundle {
// This will provide access to the resources for the WalletConnectRelay module
static var resourceBundle: Bundle {
private class BundleFinder {}

extension Foundation.Bundle {
/// Returns the resource bundle associated with the current Swift module.
static var resourceBundle: Bundle = {
let bundleName = "reown_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,
// Bundle should be present here when running tests.
Bundle(for: BundleFinder.self).resourceURL?
.deletingLastPathComponent()
.deletingLastPathComponent()
.deletingLastPathComponent(),
// Other possibilities
Bundle(for: BundleFinder.self).resourceURL?
.deletingLastPathComponent()
.deletingLastPathComponent(),
]

for candidate in candidates {
let bundlePath = candidate?.appendingPathComponent(bundleName + ".bundle")
if let bundle = bundlePath.flatMap(Bundle.init(url:)) {
return bundle
}
}

// If we can't find the bundle, fall back to the module bundle if available
#if SWIFT_PACKAGE
return Bundle.module
}
#else
return Bundle(for: BundleFinder.self)
#endif
}()
}
2 changes: 1 addition & 1 deletion Sources/WalletConnectRelay/PackageConfig.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version": "1.0.2"}
{"version": "1.0.3"}

0 comments on commit 812139f

Please sign in to comment.