Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added SwiftPM support #119

Merged
merged 2 commits into from Oct 11, 2019
Merged

Conversation

colemancda
Copy link
Contributor

Fixes SwiftPM and Mac Catalyst support (#118)

@JonasGessner
Copy link
Owner

What is the rationale for moving all the files into a different folder? And why is the module map file needed?

@colemancda
Copy link
Contributor Author

The ObjC framework needs the required include folder and module.modulemap to make the headers public. Without that the code is compiled but there is no JGProgressHUD module defined.

@colemancda
Copy link
Contributor Author

Also it seems the source code was not even compiling before, because the parent folder ./JGProgressHUD was defined instead of ./JGProgressHUD/JGProgressHUD

Headers moved to `include` folder with module map for SwiftPM support
@JonasGessner
Copy link
Owner

A module is defined though without these changes. I'll look into Catalyst support when I get time.

@colemancda
Copy link
Contributor Author

SwiftPM forces a specific directory layout to compile ObjC source. The module you specify is defined when building from the dynamic framework (e.g. Carthage). You need the module file for SwiftPM since SwiftPM has no knowledge of the Xcode project and build settings.

@JonasGessner
Copy link
Owner

I just tested this with catalyst (by enabling catalyst support in the example project) and it works fine. SwiftPM seems to work too, at least with Accio. Unless I'm missing something I am going to close this. So please double check on your end and if anything isn't working let me know.

@colemancda
Copy link
Contributor Author

Accio is third party, currently this does not build properly by just adding the Git URL to the project in Xcode 11, with the official iOS SwiftPM support.

@GottaGetSwifty
Copy link

Please merge this. Official SPM integration doesn't work as is.

import JGProgressHUD 
...
JGProgressHUD()

Gets you an error: "Cannot call value of non-function type 'module'"

To reproduce:

  • Start new project with Xcode 11
  • File->Swift Packages->Add PackageDependency...
  • Add JGProgressHUD git url and add the package
  • import the module and attempt to use anywhere in the project

@JonasGessner
Copy link
Owner

Ok I just tested this and while Accio works, SwiftPM in Xcode 11 doesn't. Your changes seem fine, except it would break CocoaPods support currently (the s.source_files glob needs to be updated to be recursive) and one deal breaker is the fact that you can't bundle resources with SwiftPM, which essentially makes the success and error indicators unusable. Only real way to fix is to generate the images at runtime/use a CAShapeLayer.

@JonasGessner JonasGessner changed the base branch from master to SwiftPM October 11, 2019 21:11
@JonasGessner JonasGessner merged commit 546ff79 into JonasGessner:SwiftPM Oct 11, 2019
@JonasGessner
Copy link
Owner

I made all the changes I mentioned in my last comment. Will release a new version now. Thanks for the contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants