Skip to content

Commit

Permalink
Fix bundle acessor (#523)
Browse files Browse the repository at this point in the history
* Fix #522

* Let's play safe

Co-authored-by: Bruno Guidolim <bruno@pockid.com>
  • Loading branch information
bguidolim and Bruno Guidolim authored May 4, 2022
1 parent 9a2304f commit 244f689
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion PhoneNumberKit/Bundle+Resources.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ private class CurrentBundleFinder {}
//
extension Bundle {
static var phoneNumberKit: Bundle = {
#if DEBUG && SWIFT_PACKAGE
let bundleName = "PhoneNumberKit_PhoneNumberKit"
let candidates = [
/* Bundle should be present here when the package is linked into an App. */
Expand All @@ -26,6 +27,12 @@ extension Bundle {
return bundle
}
}
fatalError("Could not find bundle \(bundleName), tried candidates: \(candidates)!")
#endif

#if SWIFT_PACKAGE
return Bundle.module
#else
return Bundle(for: CurrentBundleFinder.self)
#endif
}()
}

0 comments on commit 244f689

Please sign in to comment.