Skip to content

Commit c00b48d

Browse files
mehdiimrzMehdi Mirzaei
and
Mehdi Mirzaei
authored
Fix pod dependency (#20)
* Fix pod dependency Co-authored-by: Mehdi Mirzaei <[email protected]>
1 parent 7675afd commit c00b48d

7 files changed

+37
-20
lines changed

Diff for: NetShears.podspec

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Pod::Spec.new do |s|
22

33
s.name = "NetShears"
4-
s.version = "1.0.0"
4+
s.version = "3.2.1"
55
s.summary = "iOS Network interceptor framework written in Swift"
66

77
s.description = <<-DESC
@@ -22,4 +22,9 @@ Pod::Spec.new do |s|
2222
s.source = { :git => "https://github.com/divar-ir/NetShears.git", :tag => s.version }
2323
s.source_files = ["Sources/**/*.swift"]
2424

25+
s.resource_bundles = {
26+
'NetShears' => ['Sources/**/*.storyboard', 'Sources/**/*.xib']
27+
}
28+
s.frameworks = "Foundation"
29+
2530
end

Diff for: Sources/NetShears/Extension/Bundle+Extension.swift

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
//
2+
// Bundle+Extension.swift
3+
// NetShears
4+
//
5+
// Created by Mehdi Mirzaie on 7/12/22.
6+
//
7+
8+
import Foundation
9+
10+
extension Bundle {
11+
static var NetShearsBundle: Bundle {
12+
#if SWIFT_PACKAGE
13+
let resourceBundle = Bundle.module
14+
return resourceBundle
15+
#endif
16+
let podBundle = Bundle(for: NetShears.classForCoder())
17+
if let bundleURL = podBundle.url(forResource: "NetShears", withExtension: "bundle"){
18+
if let bundle = Bundle(url: bundleURL) {
19+
return bundle
20+
}
21+
}
22+
23+
return Bundle(for: NetShears.classForCoder())
24+
}
25+
}

Diff for: Sources/NetShears/Extension/Date+Extension.swift

-13
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,3 @@ extension Date{
1818
}
1919
}
2020

21-
22-
extension Bundle {
23-
static var NetShearsBundle: Bundle {
24-
let podBundle = Bundle(for: NetShears.classForCoder())
25-
if let bundleURL = podBundle.url(forResource: "NetShears", withExtension: "bundle"){
26-
if let bundle = Bundle(url: bundleURL) {
27-
return bundle
28-
}
29-
}
30-
31-
return Bundle(for: NetShears.classForCoder())
32-
}
33-
}

Diff for: Sources/NetShears/Extension/UIStoryBoard+Extension.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ import UIKit
99

1010
extension UIStoryboard {
1111
static var NetShearsStoryBoard: UIStoryboard {
12-
return UIStoryboard(name: "Flow", bundle: Bundle.module)
12+
return UIStoryboard(name: "Flow", bundle: Bundle.NetShearsBundle)
1313
}
1414
}

Diff for: Sources/NetShears/UI/RequestDetailViewController.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ final class RequestDetailViewController: UIViewController, ShowLoaderProtocol {
4242

4343
tableView.estimatedRowHeight = 100.0
4444
tableView.rowHeight = UITableView.automaticDimension
45-
tableView.register(UINib(nibName: "TextTableViewCell", bundle: Bundle.module), forCellReuseIdentifier: "TextTableViewCell")
46-
tableView.register(UINib(nibName: "ActionableTableViewCell", bundle: Bundle.module), forCellReuseIdentifier: "ActionableTableViewCell")
47-
tableView.register(UINib(nibName: "RequestTitleSectionView", bundle: Bundle.module), forHeaderFooterViewReuseIdentifier: "RequestTitleSectionView")
45+
tableView.register(UINib(nibName: "TextTableViewCell", bundle: Bundle.NetShearsBundle), forCellReuseIdentifier: "TextTableViewCell")
46+
tableView.register(UINib(nibName: "ActionableTableViewCell", bundle: Bundle.NetShearsBundle), forCellReuseIdentifier: "ActionableTableViewCell")
47+
tableView.register(UINib(nibName: "RequestTitleSectionView", bundle: Bundle.NetShearsBundle), forHeaderFooterViewReuseIdentifier: "RequestTitleSectionView")
4848
}
4949

5050
override func didReceiveMemoryWarning() {

Diff for: Sources/NetShears/UI/RequestListViewController.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class RequestsViewController: UIViewController, ShowLoaderProtocol {
3939
}
4040

4141
private func registerNibs() {
42-
collectionView?.register(UINib(nibName: String(describing: RequestCell.self), bundle: Bundle.module), forCellWithReuseIdentifier: requestCellIdentifier)
42+
collectionView?.register(UINib(nibName: String(describing: RequestCell.self), bundle: Bundle.NetShearsBundle), forCellWithReuseIdentifier: requestCellIdentifier)
4343
}
4444

4545
// MARK: - Search

Diff for: Sources/NetShears/Utils/NSHelper.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ final class NSHelper {
2323
}
2424

2525
let textShare = [text]
26-
let customItem = NSActivity(title: "Save to the desktop", image: UIImage(named: "activity_icon", in: Bundle.module, compatibleWith: nil)) { (sharedItems) in
26+
let customItem = NSActivity(title: "Save to the desktop", image: UIImage(named: "activity_icon", in: Bundle.NetShearsBundle, compatibleWith: nil)) { (sharedItems) in
2727
guard let sharedStrings = sharedItems as? [String] else { return }
2828

2929
let appName = Bundle.main.infoDictionary![kCFBundleNameKey as String] as! String

0 commit comments

Comments
 (0)