Skip to content

Commit

Permalink
Fix pod dependency (#20)
Browse files Browse the repository at this point in the history
* Fix pod dependency

Co-authored-by: Mehdi Mirzaei <[email protected]>
  • Loading branch information
mehdiimrz and Mehdi Mirzaei authored Jul 11, 2022
1 parent 7675afd commit c00b48d
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 20 deletions.
7 changes: 6 additions & 1 deletion NetShears.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|

s.name = "NetShears"
s.version = "1.0.0"
s.version = "3.2.1"
s.summary = "iOS Network interceptor framework written in Swift"

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

s.resource_bundles = {
'NetShears' => ['Sources/**/*.storyboard', 'Sources/**/*.xib']
}
s.frameworks = "Foundation"

end
25 changes: 25 additions & 0 deletions Sources/NetShears/Extension/Bundle+Extension.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//
// Bundle+Extension.swift
// NetShears
//
// Created by Mehdi Mirzaie on 7/12/22.
//

import Foundation

extension Bundle {
static var NetShearsBundle: Bundle {
#if SWIFT_PACKAGE
let resourceBundle = Bundle.module
return resourceBundle
#endif
let podBundle = Bundle(for: NetShears.classForCoder())
if let bundleURL = podBundle.url(forResource: "NetShears", withExtension: "bundle"){
if let bundle = Bundle(url: bundleURL) {
return bundle
}
}

return Bundle(for: NetShears.classForCoder())
}
}
13 changes: 0 additions & 13 deletions Sources/NetShears/Extension/Date+Extension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,3 @@ extension Date{
}
}


extension Bundle {
static var NetShearsBundle: Bundle {
let podBundle = Bundle(for: NetShears.classForCoder())
if let bundleURL = podBundle.url(forResource: "NetShears", withExtension: "bundle"){
if let bundle = Bundle(url: bundleURL) {
return bundle
}
}

return Bundle(for: NetShears.classForCoder())
}
}
2 changes: 1 addition & 1 deletion Sources/NetShears/Extension/UIStoryBoard+Extension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ import UIKit

extension UIStoryboard {
static var NetShearsStoryBoard: UIStoryboard {
return UIStoryboard(name: "Flow", bundle: Bundle.module)
return UIStoryboard(name: "Flow", bundle: Bundle.NetShearsBundle)
}
}
6 changes: 3 additions & 3 deletions Sources/NetShears/UI/RequestDetailViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ final class RequestDetailViewController: UIViewController, ShowLoaderProtocol {

tableView.estimatedRowHeight = 100.0
tableView.rowHeight = UITableView.automaticDimension
tableView.register(UINib(nibName: "TextTableViewCell", bundle: Bundle.module), forCellReuseIdentifier: "TextTableViewCell")
tableView.register(UINib(nibName: "ActionableTableViewCell", bundle: Bundle.module), forCellReuseIdentifier: "ActionableTableViewCell")
tableView.register(UINib(nibName: "RequestTitleSectionView", bundle: Bundle.module), forHeaderFooterViewReuseIdentifier: "RequestTitleSectionView")
tableView.register(UINib(nibName: "TextTableViewCell", bundle: Bundle.NetShearsBundle), forCellReuseIdentifier: "TextTableViewCell")
tableView.register(UINib(nibName: "ActionableTableViewCell", bundle: Bundle.NetShearsBundle), forCellReuseIdentifier: "ActionableTableViewCell")
tableView.register(UINib(nibName: "RequestTitleSectionView", bundle: Bundle.NetShearsBundle), forHeaderFooterViewReuseIdentifier: "RequestTitleSectionView")
}

override func didReceiveMemoryWarning() {
Expand Down
2 changes: 1 addition & 1 deletion Sources/NetShears/UI/RequestListViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class RequestsViewController: UIViewController, ShowLoaderProtocol {
}

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

// MARK: - Search
Expand Down
2 changes: 1 addition & 1 deletion Sources/NetShears/Utils/NSHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ final class NSHelper {
}

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

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

0 comments on commit c00b48d

Please sign in to comment.