Finalet / Elegant-Emoji-Picker

Aesthetic, simple, and powerful emoji picker for Swift built with UIKit.
MIT License
64 stars 16 forks source link

Add ElegantEmojiPicker.podspec. #20

Open loongman opened 1 year ago

loongman commented 1 year ago

To make it possible for this lib being able to be used via CocoaPods.

loongman commented 1 year ago

Got below errors while i try to validate the podspec via:

pod spec lint ElegantEmojiPicker.podspec --allow-warnings --verbose

Screenshot 2023-06-02 at 13 36 56

Could you suggest how to proceed with? @Finalet

I understand that the source code works well with Swift Package Manager, however, to make it support CocoaPods as well, seems we should apply some adjustment to it.

It would be really cool if we can make this lib installable via CocoaPods due to its wide user base.

Finalet commented 1 year ago

Using Bundle.module is required for SPM to load external sources, like icons and json as seen in your error. My understanding is that you can use Bundle.main for CocoaPods. So using the #if SWIFT_PACKAGE preprocessor wherever necessary might help.

#if SWIFT_PACKAGE // SPM
let image = UIImage(named: "imade_name", in: .module, with: nil)
let bundle = Bundle.module 
#else // CocoaPods
let image = UIImage(named: "imade_name")
let bundle = Bundle.main
#endif
Finalet commented 1 year ago

Also, I noticed you are using the git tag as the source:

s.source = { :git => 'https://github.com/Finalet/Elegant-Emoji-Picker.git', :tag => s.version }

I'm not using any tags in this repo, as distinct versions are not really important here. I think you would have to change it to pull from the main branch instead.

s.source = { :git => 'https://github.com/Finalet/Elegant-Emoji-Picker.git', :branch => `main` }
loongman commented 1 year ago

Seems version is required for podspec. Anyway, i have updated the podspec as you suggested. @Finalet

And handover the remaining parts to you to make it finally work.

  1. My understanding is we can specify one init version, 1.0.0, or 0.0.1, etc., to satisfy CocoaPods, then, leave the chance for user to use the lib via branch as you suggested, so that no need to add/maintain further versions/tags.
  2. Formally publish the podspec with pod trunk push command. Because you are the owner of this lib, so, the honor to do that belongs to you. (Pre-condition: setup an account on Cocoapods.org and register session using pod trunk register.)

Please feel free to let me know if you want me to take any further actions on that.

Screenshot 2023-06-03 at 12 01 20
Finalet commented 1 year ago

After multiple failed attempts to install cocoapods (some issues with the ruby manager on my mac), I wondered the rationality of what we are doing.

SPM can be used together with CocoaPods in the same project (like here), and it's a more modern, convenient package manager. So what are the benefits of maintaining CocoaPods separately?

Thank you for your help and effort! But I don't really understand why, @loongman.

loongman commented 1 year ago
  1. Flexibility. By supporting CocoaPods, we do not force users who already use CocoaPods in them project to switch to SPM + CocoaPods, even though SPM + CocoaPods might work well together. Actually, in my case, there is conflict while i try to use this lib by introducing SPM + CocoaPods into my project.

  2. Increasing the possibilities for more users to use this lib. As you mentioned on Readme, why is there no built in emoji picker in UIKit? This lib fills the gap well, it can help a good number of users and them projects for sure.

Personally, i have been searching for such a lib for quite a while by using pod search, it did not guide me to here due to this lib's lack of CocoaPods support. Luckily and coincidentally, after a bundle of google search, finally, i got to here via https://iosexample.com/a-simple-and-powerful-emoji-picker-for-swift-built-with-uikit/

If we can add CocoaPods support to this lib, pod search can help much more users to reach to this lib. And the only thing we need to do is to add a podspec file and publish it the pod world. @Finalet