Skip to content

Instantly share code, notes, and snippets.

@ArtSabintsev
Last active December 21, 2020 18:29
Show Gist options
  • Save ArtSabintsev/9b9fe72c54fb6ea16d42c05a988afd79 to your computer and use it in GitHub Desktop.
Save ArtSabintsev/9b9fe72c54fb6ea16d42c05a988afd79 to your computer and use it in GitHub Desktop.
Bundle Extension for Swift PM and CocoaPods
private extension Bundle {
/// The path to Siren's localization `Bundle`.
///
/// - Returns: The bundle's path or `nil`.
final class func sirenBundlePath() -> String? {
#if SWIFT_PACKAGE
return Bundle.module.path(forResource: "\(Siren.self)", ofType: "bundle")
#else
return Bundle(for: Siren.self).path(forResource: "\(Siren.self)", ofType: "bundle")
#endif
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment