diff --git a/CountryPicker/Classes/CountryPicker.swift b/CountryPicker/Classes/CountryPicker.swift index ec10fb3..e3e7076 100755 --- a/CountryPicker/Classes/CountryPicker.swift +++ b/CountryPicker/Classes/CountryPicker.swift @@ -44,7 +44,12 @@ public struct Country { } public var flag: UIImage? { - return UIImage(named: flagName, in: Bundle(for: CountryPicker.self), compatibleWith: nil) + #if SWIFT_PACKAGE + let bundle = Bundle.module + #else + let bundle = Bundle(for: CountryPicker.self) + #endif + return UIImage(named: flagName, in: bundle, compatibleWith: nil) } } diff --git a/CountryPicker/Classes/CountryView.swift b/CountryPicker/Classes/CountryView.swift index 2ebff86..89d18a1 100755 --- a/CountryPicker/Classes/CountryView.swift +++ b/CountryPicker/Classes/CountryView.swift @@ -43,7 +43,11 @@ class NibLoadingView: UIView { /// /// - Returns: XIBView fileprivate func loadViewFromNib() -> UIView { + #if SWIFT_PACKAGE + let bundle = Bundle.module + #else let bundle = Bundle(for: type(of: self)) + #endif let nib = UINib(nibName: String(describing: type(of: self)), bundle: bundle) let nibView = nib.instantiate(withOwner: self, options: nil).first as! UIView diff --git a/CountryPickerSwift.podspec b/CountryPickerSwift.podspec index 0e97745..cf9837f 100644 --- a/CountryPickerSwift.podspec +++ b/CountryPickerSwift.podspec @@ -8,7 +8,7 @@ Pod::Spec.new do |s| s.name = 'CountryPickerSwift' - s.version = '1.8.2' + s.version = '1.8.3' s.summary = 'Swift CountryPicker' # This description is used to generate tags and improve search results. diff --git a/Example/Podfile.lock b/Example/Podfile.lock index aa984e8..9f26561 100644 --- a/Example/Podfile.lock +++ b/Example/Podfile.lock @@ -1,5 +1,5 @@ PODS: - - CountryPickerSwift (1.8.2) + - CountryPickerSwift (1.8.3) DEPENDENCIES: - CountryPickerSwift (from `../`) @@ -9,7 +9,7 @@ EXTERNAL SOURCES: :path: "../" SPEC CHECKSUMS: - CountryPickerSwift: f969cd261fc03978c0a556c4863b1047188bb4ca + CountryPickerSwift: 70dcf23b7f28895eb97d7e461a661524126b349a PODFILE CHECKSUM: 24f5b92c2a79e38c578da696a7b6140d7772a81d diff --git a/Example/Pods/Manifest.lock b/Example/Pods/Manifest.lock index aa984e8..9f26561 100644 --- a/Example/Pods/Manifest.lock +++ b/Example/Pods/Manifest.lock @@ -1,5 +1,5 @@ PODS: - - CountryPickerSwift (1.8.2) + - CountryPickerSwift (1.8.3) DEPENDENCIES: - CountryPickerSwift (from `../`) @@ -9,7 +9,7 @@ EXTERNAL SOURCES: :path: "../" SPEC CHECKSUMS: - CountryPickerSwift: f969cd261fc03978c0a556c4863b1047188bb4ca + CountryPickerSwift: 70dcf23b7f28895eb97d7e461a661524126b349a PODFILE CHECKSUM: 24f5b92c2a79e38c578da696a7b6140d7772a81d diff --git a/Package.swift b/Package.swift index 9f06609..96f8005 100644 --- a/Package.swift +++ b/Package.swift @@ -26,7 +26,7 @@ let package = Package( dependencies: [], path: "CountryPicker", resources: [ - .copy("Assets")] + .copy("Assets/CountryPicker.bundle")] ), .testTarget( name: "CountryCodeTests",