IOS-DFU-Library icon indicating copy to clipboard operation
IOS-DFU-Library copied to clipboard

Module name with SPM vs Cocoapods

Open jdanthinne opened this issue 2 years ago • 3 comments

Is there a reason why this library, when used with Cocoapods, must be imported with import iOSDFULibrary, and when used with SPM, must be imported with import NordicDFU?

I'm building a SDK that I'd like to offer for Cocoapods and SPM, and having two different names makes it impossible.

jdanthinne avatar Feb 15 '23 08:02 jdanthinne

Well.. That's a good question.

The first version of the DFU library is many years old now. Initially we started with this weird name iOSDFULibrary, which perhaps was generated automatically by Xcode... I don't remember. I do remember, however, that in SPM we had a discussion in #310 that it also supports MacOS, so the iOS in the name is misleading. Anyway, NordicDFU seems to be way more elegant name, but it's now difficult to change on Cocoapods. It would require creating a new library.

It's the first time that someone wants to use both Cocoapods and SPM. I understand your case. Any suggestions? CC: @NickKibish @dinesharjani @sylwester-zielinski

philips77 avatar Feb 23 '23 11:02 philips77

I see the following options:

  1. Adding some #ifdefs on your side - is it possible?
  2. Renaming our lib on Cocoapods to NordicDFU - perhaps other libraries also should be renamed?
  3. Deprecating Cocoapods?
  4. Saying that we're busy with lots of tasks and will come back to you in the future ;)

I vote for option 2. The current iOSDFULibrary can be modified to only include the new one, like a proxy, or can be deprecated. After all Find & Replace finally works in Xcode.

philips77 avatar Feb 23 '23 11:02 philips77

This is what I had to do in the end.

#if SWIFT_PACKAGE
    import NordicDFU
#else
    import iOSDFULibrary
#endif

jdanthinne avatar Feb 23 '23 12:02 jdanthinne

Just FYI.

I just upgraded to 4.15.0 and it appears the original package name 'iOSDFULibrary' no longer works with CocoaPods. The solution is to use the new name:

import NordicDFU

ehmjaysee avatar Mar 22 '24 02:03 ehmjaysee

Yes, this has changed in 4.14 and the migration guide is here: https://github.com/NordicSemiconductor/IOS-DFU-Library/releases/tag/4.14.0

philips77 avatar Mar 22 '24 10:03 philips77