NordicSemiconductor / IOS-DFU-Library

OTA DFU Library for Mac and iOS, compatible with nRF5x SoCs
http://www.nordicsemi.com
BSD 3-Clause "New" or "Revised" License
526 stars 215 forks source link

Module name with SPM vs Cocoapods #503

Closed jdanthinne closed 8 months ago

jdanthinne commented 1 year ago

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.

philips77 commented 1 year ago

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 commented 1 year ago

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.

jdanthinne commented 1 year ago

This is what I had to do in the end.

#if SWIFT_PACKAGE
    import NordicDFU
#else
    import iOSDFULibrary
#endif
ehmjaysee commented 8 months ago

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
philips77 commented 8 months ago

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