Skip to content

[2.1.0] target contains mixed language source files; feature not supported #133

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

Closed
Dean151 opened this issue Nov 2, 2023 · 14 comments
Closed

Comments

@Dean151
Copy link
Contributor

Dean151 commented Nov 2, 2023

Xcode 15.0.1 doesn't want to build latest version 2.1.0 of the library, with the following error:

 Showing All Messages target at '/Users/<redacted>/Library/Developer/Xcode/DerivedData/<redacted>/SourcePackages/checkouts/JDStatusBarNotification' contains mixed language source files; feature not supported
@calimarkus
Copy link
Owner

Thanks for the report. I don't see a problem locally with Xcode Version 15.0.1 (15A507) on a iOS 17.0.1 Simulator.

  • Which target did you try to build?
  • On device or simulator?
  • Which iOS version?
  • Did you also try using it in a project? E.g. through SPM or cocoapods?

@Dean151
Copy link
Contributor Author

Dean151 commented Nov 2, 2023

Hi!

The error is not occurring while building, but while SPM is resolving the dependencies.
So I'm using SPM, on an app targeting iOS 16+, watchOS 9+

Seems related to this: https://stackoverflow.com/questions/51540665/swift-package-manager-mixed-language-source-files
Different languages should be moved in different targets

@Dean151 Dean151 changed the title [2.1.0] Showing All Messages target contains mixed language source files; feature not supported [2.1.0] target contains mixed language source files; feature not supported Nov 2, 2023
@calimarkus
Copy link
Owner

calimarkus commented Nov 2, 2023

Thank you! I have a working (temporary) version in the following branch: https://github.com/calimarkus/JDStatusBarNotification/commits/fix_spm_mixed_language

But I still need to test/fix a few things before I'll publish a new version.

Some notes:

  1. This medium article was super helpful for the workaround I'm using, instead of shipping a binary framework. Even though the article itself recommends binary frameworks in the end, but my setup is simple enough to accept the downsides.
  2. Proper mixed language support for SPM is being discussed and hopefully coming soon:

@haarj
Copy link

haarj commented Nov 3, 2023

fix_spm_mixed_language works in building but it does break some objc code that I have

@calimarkus
Copy link
Owner

How so? Could you share some more details?

@haarj
Copy link

haarj commented Nov 3, 2023

Also this breaks where "dismissAfterDelay" isn't available anymore.

NotificationPresenter.shared().present(text: NSLocalizedString("EVENT_ADDED", comment: ""), dismissAfterDelay: 2, includedStyle: .defaultStyle)

I get an undeclared error where Xcode doesn't recognize this anymore.
[[JDStatusBarNotificationPresenter sharedPresenter]

@calimarkus
Copy link
Owner

calimarkus commented Nov 4, 2023

@haarj

  1. The SwiftAPI changed a bit as part of this update:

    • NotificationPresenter.shared().present(text:dismissAfterDelay:includedStyle:) is now: NotificationPresenter.shared().present(_:includedStyle:duration:)
    • This is a breaking change in v2.1.0. I decided to do a rewrite of the Swift API with a smaller API surface. Maybe I'll bring back the old APIs and mark them deprecated as part of the next version with the fix for the SPM issues.
  2. [JDStatusBarNotificationPresenter sharedPresenter] in ObjC works for me after integrating the fix_spm_mixed_language branch through SPM.

    • Could you describe your setup / how you integrated the library? Through SPM? Cocoapods? Manual?

@haarj
Copy link

haarj commented Nov 5, 2023

Nevermind. I had to import JDStatusBarNotificationObjC instead of JDStatusBarNotification now and it worked.

@calimarkus
Copy link
Owner

@haarj glad to hear that, but that shouldn't be needed. You're using spm and you're importing in an obj file, correct? I'd like to reproduce that.

@haarj
Copy link

haarj commented Nov 5, 2023 via email

@calimarkus
Copy link
Owner

calimarkus commented Nov 5, 2023

Ah I see it's module vs header imports.

  • If I use @import JDStatusBarNotification I can see the same issue.
  • If I use #import "JDStatusBarNotification.h" I don't see the issue - as the module is automatically resolved.

// edit: I couldn't find a way to avoid that.

@calimarkus
Copy link
Owner

This is now resolved and merged to main. I also tagged a new version as 2.1.1.

@calimarkus
Copy link
Owner

FYI @haarj the latest 2.2.0 version will require the regular module import again in ObjC:

  • @import JDStatusBarNotification; - just as before.

The JDStatusBarNotificationObjC module no longer exists.

For Swift nothing changes.

@haarj
Copy link

haarj commented Dec 11, 2023 via email

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

No branches or pull requests

3 participants