diff --git a/KVNProgress.podspec b/KVNProgress.podspec index 6f2142c..2a2a7fc 100644 --- a/KVNProgress.podspec +++ b/KVNProgress.podspec @@ -15,7 +15,7 @@ Pod::Spec.new do |s| } s.source_files = "KVNProgress/Classes", "KVNProgress/Classes/**/*.{h,m}", "KVNProgress/Categories", "KVNProgress/Categories/**/*.{h,m}" - s.resources = "KVNProgress/Resources/*.{png,xib}" + s.resources = "KVNProgress/*.{png,xib}" s.frameworks = "QuartzCore", "GLKit" s.requires_arc = true diff --git a/KVNProgress/Classes/KVNProgress.m b/KVNProgress/Classes/KVNProgress.m index 61357f8..0a2e793 100644 --- a/KVNProgress/Classes/KVNProgress.m +++ b/KVNProgress/Classes/KVNProgress.m @@ -101,9 +101,15 @@ + (KVNProgress *)sharedView static KVNProgress *sharedView = nil; static dispatch_once_t onceToken; +#if SWIFT_PACKAGE + NSBundle *bundle = SWIFTPM_MODULE_BUNDLE; +#else + NSBundle *bundle = [NSBundle bundleForClass:[KVNProgress class]]; +#endif + dispatch_once(&onceToken, ^{ UINib *nib = [UINib nibWithNibName:@"KVNProgressView" - bundle:[NSBundle bundleForClass:[KVNProgress class]]]; + bundle:bundle]; NSArray *nibViews = [nib instantiateWithOwner:self options:0]; diff --git a/KVNProgress/Resources/KVNProgressView.xib b/KVNProgress/Classes/KVNProgressView.xib similarity index 100% rename from KVNProgress/Resources/KVNProgressView.xib rename to KVNProgress/Classes/KVNProgressView.xib diff --git a/Package.swift b/Package.swift new file mode 100644 index 0000000..a3d4e3a --- /dev/null +++ b/Package.swift @@ -0,0 +1,32 @@ +// swift-tools-version:5.6 +// The swift-tools-version declares the minimum version of Swift required to build this package. + +import PackageDescription + +let package = Package( + name: "KVNProgress", + defaultLocalization: "en", + platforms: [.iOS(.v13)], + products: [ + .library( + name: "KVNProgress", + targets: ["KVNProgress"]), + ], + targets: [ + .target( + name: "KVNProgress", + dependencies: [ + "KVNProgressCategories", + ], + path: "KVNProgress/Classes", + resources: [.process("../Resources")], + publicHeadersPath: "." + ), + .target( + name: "KVNProgressCategories", + path: "KVNProgress/Categories", + publicHeadersPath: "." + ), + ], + swiftLanguageVersions: [.v5] +) diff --git a/README.md b/README.md index c3f52bb..d893dd7 100644 --- a/README.md +++ b/README.md @@ -99,7 +99,7 @@ If you want to try it yourself, just download/checkout this repository and launc ### Source files 1. Download the [latest code version](http://github.com/kevin-hirsch/KVNProgress/archive/master.zip) or add the repository as a git submodule to your git-tracked project. -2. Drag and drop the **Classes**, **Categories** and also the **Resources** directory from the archive in your project navigator. Make sure to select *Copy items* when asked if you extracted the code archive outside of your project. +2. Drag and drop the **Classes**, **Categories** directory from the archive in your project navigator. Make sure to select *Copy items* when asked if you extracted the code archive outside of your project. 3. Include KVNProgress wherever you need it with `#import `. ## Usage