richardtop / CalendarKit

📅 Calendar for Apple platforms in Swift
https://www.youtube.com/watch?v=cJ63-_z1qg8
MIT License
2.52k stars 340 forks source link

add SPM #254

Closed tomaculum closed 4 years ago

tomaculum commented 4 years ago

This isn't a beautiful way of doing this but it works.

There is a open pull request for adding SPM to DateToolsSwift: https://github.com/MatthewYork/DateTools/pull/291

I took the branch and added it with its full url and mani_siwftpm as branch. After their pull request got merged, this should be changed to the typical from: notation with a release number.

As for the Neon dependency, I did fork this and added the Package.swift file myself. Since the project did not receive an update in a very long time, I guess this does not cause any issues. I would suggest that @richardtop should fork this, add this one file and we replace the url with his repo.

related issue: #210

richardtop commented 4 years ago

Thank you for your pull request! I've forked the repository, although I'm still unable to import CalendarKit to the project. Could you please verify that it works for you.

tomaculum commented 4 years ago

I am able to import CalendarKit to my project but I cannot build the project due to some errors since it cannot build the project for macOS ( -> UIKit). Apparently it adds macOS by default as valid platform with no (easy) way to exclude it? https://forums.swift.org/t/how-to-exclude-platforms-in-spm/32296

Maybe there is another way to exclude macOS where you do not need to add #if os(iOS) to every source file or rewrite the complete framework to work with UIKit as well as with Cocoa?

tomaculum commented 4 years ago

I've added all if os(iOS) lines necessary to build the project. I don't know if this solution is worth it? If you do not want to revert this pull request and we cannot find another solution, I can create a new one with the changes: https://github.com/richardtop/CalendarKit/compare/master...tomaculum:master

Since there is an open issue for adding macOS compatibility #156 probably it would be better to add proper macOS support to avoid those conditional compilation statements.

richardtop commented 4 years ago

Please, submit a pull request if the solution allows importing the library to the iOS project and successfully using it with just the iOS. But the CocoaPods integration support should also remain in force.

tomaculum commented 4 years ago

Unfortunately I don't use CocoaPods therefore I cannot check if this breaks anything.

This time I did check if it builds and runs on a real iOS device and it does