kasketis / netfox

A lightweight, one line setup, iOS / OSX network debugging library! 🦊
MIT License
3.67k stars 374 forks source link

Add support for SPM #204

Closed gbreen12 closed 2 years ago

gbreen12 commented 4 years ago

This adds support for Swift Package Manager. Currently only works for iOS and Swift

skydemarcoa commented 4 years ago

Hi @gbreen12, with Carthage we avoided to copy the framework where the configuration was Release.

Do you know how we can achieve the same result with SPM?

gbreen12 commented 4 years ago

Can you explain a little better what is needed? I'm not sure what you are asking for.

gbreen12 commented 4 years ago

Oh I think I understand what you are asking. You are saying you don't want to include this framework when you build your iOS app in release mode to make the ipa smaller. Is that right?

skydemarcoa commented 4 years ago

I found this solution: https://stackoverflow.com/questions/62837730/swift-package-manager-exclude-from-release

So I'm Ok 👍

rae commented 3 years ago

Why hasn't this PR been approved? 👍

MaxenceMottard commented 3 years ago

Up

jimmya commented 3 years ago

This doesn't seem to work in combination with Alamofire. I guess because https://github.com/kasketis/netfox/blob/92dbe403ab59d4dff96996225042d58475859752/netfox/Core/NFXHelper.swift#L403 Isn't called because Core/NFXLoader.m is excluded.

When using URLSession.shared directly it works fine. However when using Alamofire it just doesn't work.

jimmya commented 3 years ago

That's a bit of a shameless plug and totally not related to this PR to be honest.

gbreen12 commented 3 years ago

I've been using it with Alamofire for a while. I think it just takes an extra step when creating your session:

  let config = URLSessionConfiguration.default
  config.protocolClasses?.insert(NFXProtocol.self, at: 0)
  return Session(configuration: config, interceptor: self)
RobertDresler commented 3 years ago

Any update? I would like to have my project completely without CocoaPods instead of hybrid CocoaPods-SPM project 😅

kasketis commented 2 years ago

Thank you for your contribution, @gbreen12 ! Closed in favor of https://github.com/kasketis/netfox/pull/216