diff --git a/Package.swift b/Package.swift index 4cd7c034..deaac044 100644 --- a/Package.swift +++ b/Package.swift @@ -1,10 +1,10 @@ -// swift-tools-version:5.0 +// swift-tools-version:5.7 import PackageDescription let package = Package( name: "rswift", platforms: [ - .macOS(.v10_11) + .iOS(.v16) ], products: [ .executable(name: "rswift", targets: ["rswift"]) diff --git a/Sources/RswiftCore/Util/Struct+InternalProperties.swift b/Sources/RswiftCore/Util/Struct+InternalProperties.swift index 7cc9eaae..ee1e1806 100644 --- a/Sources/RswiftCore/Util/Struct+InternalProperties.swift +++ b/Sources/RswiftCore/Util/Struct+InternalProperties.swift @@ -11,7 +11,10 @@ import Foundation extension Struct { func addingInternalProperties(forBundleIdentifier bundleIdentifier: String, hostingBundle: String? = nil) -> Struct { let hostingBundleValue: String - if let bundleName = hostingBundle, !bundleName.isEmpty { + // This case is extended by the fork cookpad/R.swift to support SPM + if let bundleName = hostingBundle, bundleName == "Bundle.module" { + hostingBundleValue = "Bundle.module" + } else if let bundleName = hostingBundle, !bundleName.isEmpty { hostingBundleValue = "Bundle(for: R.Class.self).path(forResource: \"\(bundleName)\", ofType: \"bundle\").flatMap(Bundle.init(path:)) ?? Bundle(for: R.Class.self)" } else { hostingBundleValue = "Bundle(for: R.Class.self)" @@ -82,12 +85,12 @@ extension Struct { .prefix(1) .flatMap { locale -> [String] in if hostingBundle.localizations.contains(locale.identifier) { - if let language = locale.languageCode, hostingBundle.localizations.contains(language) { + if let language = locale.language.languageCode?.identifier, hostingBundle.localizations.contains(language) { return [locale.identifier, language] } else { return [locale.identifier] } - } else if let language = locale.languageCode, hostingBundle.localizations.contains(language) { + } else if let language = locale.language.languageCode?.identifier, hostingBundle.localizations.contains(language) { return [language] } else { return []