espressif / esp-idf-provisioning-ios

Apache License 2.0
130 stars 62 forks source link

Swift Package Manager Support #26

Closed robkerr closed 1 year ago

robkerr commented 3 years ago

Hi thanks for this library, it works great! Question: is there a plan to include Swift Package Manager support to include this library into client applications?

vikas-chandra-mnnit commented 3 years ago

Hi @robkerr thanks for your feedback. Since we haven't got any request for Swift Package till now, it is currently not in our roadmap. If you have some pointers on how to make Swift Packages from existing library then kindly share it with us. Depending on the time it will take and priority of this we will plan to include Swift Package support.

robkerr commented 3 years ago

Thanks for the info. A positive thing is that both the CCurve and SwiftProtoBuf dependencies have already added Swift Package Manager support to their repos (which on a quick test from what I see they work as expected in SPM).

At first glance in this repo the main thing I see is some code organization relating to the mixed Obj-C and Swift files, and possibly moving package code within a Sources folder. Both items are file system organization and not code changes per se. I'm going to make a test here to check whether it's feasible and will share my findings for your review.

robkerr commented 3 years ago

HI @vikas-chandra-mnnit , I looked at the requirements to update your library with Swift Package Manager. The good news is the code changes are minimal. Primarily you would just need to move your source files around to comply with the Swift Package manager structure requirements, and separate the Objective-C code into a separate package from Swift code.

I created a reference implementation of your library with SPM support at the repo below. The Readme has more detail of the changes. I also updated the .podspec and verified that adding SPM doesn't break cocoa pods, they will both work if implemented in the way I have done it here. https://github.com/robkerr/esp-idf-swift

Mainly the changes are:

For the second change (separate Obj-C module), this is because SPM doesn't support mixed languages in a single module. This a common refactor when adding SPM support. The Curve25519 dependency your library depends on had to do this as well when they added SPM support (see what they did in version 2.0 of the library).

Hope this helps answer your questions about what the requirements and level of effort would be. Hopefully the reference implementation provides guidance on how you might make similar changes to the core repo.

Happy to answer any questions you have, just ask.

vikas-chandra-mnnit commented 3 years ago

@robkerr Thanks for the great work. We appreciate the time and effort you put in providing us the detail documentation.

I understood from your description that Obj-C code included in our library need to be separated in a different module. Since you have already provided us the solution, it won't take much time. However for consistency and maintenance we will look to convert those Obj-C classes and methods into Swift. Doing that will remove the requirement for second change and all of the library files will be in a single source. I do have couple of question related with SPM :

  1. Do we need to make some changes in structure if external dependency of our library has Obj-C code in it?
  2. How is versioning maintained in SPM?

As now we have clear understanding on the efforts required, we will provide you a timeline on the delivery very soon. Thanks again for all your hard work.

hhrvoic commented 2 years ago

Hi @vikas-chandra-mnnit, do we know when the SPM support will be part of this repo? Thanks in advance!

muddinho commented 2 years ago

Hi @vikas-chandra-mnnit, do we know when the SPM support will be part of this repo? Thanks in advance!

It just happened, that i created one today. Have a look at https://github.com/GCX-HCI/esp-idf-provisioning-ios

pricimus commented 1 year ago

any chance this is going to be an official release?

mevdev commented 1 year ago

@ muddinho They should pay you for this! @vikas-chandra-mnnit Take a look and integrate. As long as the original podspec works for people this is gold!

It looks like a good conversion of the remaining objective-c. It's only 22 commits behind master. This fork should be picked up!

muddinho commented 1 year ago

@mevdev FYI: I have pulled the latest changes and updated the package just now.

mevdev commented 1 year ago

Thanks @muddinho! I fret to use a forked version of this library in production.

That said, I may roll with this fork for a while and see if there are updates to the softAP problem listed in the repo. Is that bug in the main repo?

I cannot believe this library isn't available officially as a Swift Package. There's obviously interest and some development done for free by great community members. @vikas-chandra-mnnit You should get on this and pull in these changes. Any plans for this on the roadmap @shahpiyushv ?

dgduncan commented 1 year ago

Plus 1 to this! Having Swift Package Manager officially supported would be much appreciated :)

vikas-chandra-mnnit commented 1 year ago

Hello everyone, I wanted to give you all an update on our progress regarding the feature request for SPM support. I'm pleased to inform you that we have started working on it and are currently in the process of implementing the requested feature. We understand the importance of this and are committed to delivering it as soon as possible.

dgduncan commented 1 year ago

@vikas-chandra-mnnit awesome thank you for the update!!

vikas-chandra-mnnit commented 1 year ago

Hello everyone! We're excited to announce that, starting from Release 2.1.1. the ESPProvision library includes support for Swift Package Manager. To add this package to your app source, please refer to the README for detailed instructions. If you have any questions or encounter any issues, please don't hesitate to raise them on GitHub. We're here to help!.

dgduncan commented 1 year ago

@vikas-chandra-mnnit Can't wait to check this out! Thank you for all the work.

dgduncan commented 1 year ago

Already dropped it in my project with no issues. Thank you again for all the work!